1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2019 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License
16  -->
17
18<!-- Layout for media controls inside QSPanel carousel -->
19<com.android.systemui.util.animation.TransitionLayout xmlns:android="http://schemas.android.com/apk/res/android"
20    xmlns:app="http://schemas.android.com/apk/res-auto"
21    android:id="@+id/qs_media_controls"
22    android:layout_width="match_parent"
23    android:layout_height="wrap_content"
24    android:clipChildren="false"
25    android:clipToPadding="false"
26    android:gravity="center_horizontal|fill_vertical"
27    android:forceHasOverlappingRendering="false"
28    android:background="@drawable/qs_media_background"
29    android:theme="@style/MediaPlayer">
30
31    <androidx.constraintlayout.widget.Guideline
32        android:id="@+id/center_vertical_guideline"
33        android:layout_width="wrap_content"
34        android:layout_height="wrap_content"
35        android:orientation="vertical"
36        app:layout_constraintGuide_percent="0.6" />
37
38    <androidx.constraintlayout.widget.Guideline
39        android:id="@+id/center_horizontal_guideline"
40        android:layout_width="wrap_content"
41        android:layout_height="wrap_content"
42        android:orientation="horizontal"
43        app:layout_constraintGuide_begin="48dp" />
44
45    <!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
46    <FrameLayout
47        android:id="@+id/notification_media_progress_time"
48        android:layout_width="0dp"
49        android:layout_height="wrap_content"
50        android:forceHasOverlappingRendering="false">
51        <!-- width is set to "match_parent" to avoid extra layout calls -->
52        <TextView
53            android:id="@+id/media_elapsed_time"
54            android:layout_width="match_parent"
55            android:layout_height="wrap_content"
56            android:layout_alignParentStart="true"
57            android:fontFamily="@*android:string/config_bodyFontFamily"
58            android:gravity="start"
59            android:textSize="12sp" />
60
61        <TextView
62            android:id="@+id/media_total_time"
63            android:layout_width="match_parent"
64            android:layout_height="wrap_content"
65            android:layout_alignParentEnd="true"
66            android:fontFamily="@*android:string/config_bodyFontFamily"
67            android:gravity="end"
68            android:textSize="12sp" />
69    </FrameLayout>
70
71    <!--  Actions must be ordered left-to-right even in RTL layout.  However, they appear in a chain
72    with the artist name, and must as a group appear at the end of that chain.  This is
73    accomplished by having all actions appear in a LTR chain within the parent, and then biasing it
74    to the right side, then this barrier is used to bound the text views.  -->
75    <androidx.constraintlayout.widget.Barrier
76        android:id="@+id/media_action_barrier"
77        android:layout_width="0dp"
78        android:layout_height="0dp"
79        android:orientation="vertical"
80        app:layout_constraintTop_toBottomOf="@id/header_title"
81        app:barrierDirection="start"
82        app:constraint_referenced_ids="action0,action1,action2,action3,action4"
83         />
84
85    <ImageButton
86        android:id="@+id/action0"
87        style="@style/MediaPlayer.Action"
88        android:layout_width="48dp"
89        android:layout_height="48dp" />
90
91    <ImageButton
92        android:id="@+id/action1"
93        style="@style/MediaPlayer.Action"
94        android:layout_width="48dp"
95        android:layout_height="48dp" />
96
97    <ImageButton
98        android:id="@+id/action2"
99        style="@style/MediaPlayer.Action"
100        android:layout_width="48dp"
101        android:layout_height="48dp" />
102
103    <ImageButton
104        android:id="@+id/action3"
105        style="@style/MediaPlayer.Action"
106        android:layout_width="48dp"
107        android:layout_height="48dp" />
108
109    <ImageButton
110        android:id="@+id/action4"
111        style="@style/MediaPlayer.Action"
112        android:layout_width="48dp"
113        android:layout_height="48dp" />
114
115    <!-- Album Art -->
116    <ImageView
117        android:id="@+id/album_art"
118        android:layout_width="@dimen/qs_media_album_size"
119        android:layout_height="@dimen/qs_media_album_size"
120        android:layout_gravity="center_vertical"
121        style="@style/MediaPlayer.Album"
122        android:background="@drawable/qs_media_art_background"
123        android:clipToOutline="true" />
124
125    <!-- Seamless Output Switcher -->
126    <LinearLayout
127        android:id="@+id/media_seamless"
128        android:layout_width="0dp"
129        android:layout_height="48dp"
130        android:orientation="horizontal"
131        android:gravity="top|end"
132        android:paddingTop="@dimen/qs_media_padding"
133        android:paddingEnd="@dimen/qs_media_padding"
134        android:background="@drawable/qs_media_light_source"
135        android:forceHasOverlappingRendering="false">
136        <LinearLayout
137            android:id="@+id/media_seamless_button"
138            android:layout_width="wrap_content"
139            android:layout_height="wrap_content"
140            android:minHeight="@dimen/qs_seamless_height"
141            android:theme="@style/MediaPlayer.SolidButton"
142            android:background="@drawable/qs_media_seamless_background"
143            android:orientation="horizontal"
144            android:contentDescription="@string/quick_settings_media_device_label">
145            <ImageView
146                android:id="@+id/media_seamless_image"
147                android:layout_width="@dimen/qs_seamless_icon_size"
148                android:layout_height="@dimen/qs_seamless_icon_size"
149                android:layout_gravity="center"
150                android:tint="?android:attr/textColorPrimary"
151                android:src="@*android:drawable/ic_media_seamless" />
152            <TextView
153                android:id="@+id/media_seamless_text"
154                android:layout_width="wrap_content"
155                android:layout_height="wrap_content"
156                android:layout_gravity="center_vertical"
157                android:layout_marginStart="4dp"
158                android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
159                android:singleLine="true"
160                android:text="@*android:string/ext_media_seamless_action"
161                android:textDirection="locale"
162                android:textSize="12sp"
163                android:lineHeight="16sp" />
164        </LinearLayout>
165    </LinearLayout>
166
167    <!-- Seek Bar -->
168    <!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
169    <SeekBar
170        android:id="@+id/media_progress_bar"
171        style="@style/MediaPlayer.ProgressBar"
172        android:layout_width="0dp"
173        android:layout_height="wrap_content"
174        android:maxHeight="@dimen/qs_media_enabled_seekbar_height"
175        android:paddingTop="@dimen/qs_media_enabled_seekbar_vertical_padding"
176        android:layout_marginTop="-22dp"
177        android:paddingBottom="2dp"
178        android:splitTrack="false" />
179
180    <!-- Song name -->
181    <TextView
182        android:id="@+id/header_title"
183        android:layout_width="0dp"
184        android:layout_height="wrap_content"
185        android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
186        android:singleLine="true"
187        android:textSize="16sp" />
188
189    <!-- Artist name -->
190    <TextView
191        android:id="@+id/header_artist"
192        android:layout_width="0dp"
193        android:layout_height="wrap_content"
194        android:fontFamily="@*android:string/config_headlineFontFamily"
195        android:singleLine="true"
196        style="@style/MediaPlayer.Subtitle"
197        android:textSize="14sp" />
198
199    <com.android.internal.widget.CachingIconView
200        android:id="@+id/icon"
201        style="@style/MediaPlayer.AppIcon"
202        android:layout_width="@dimen/qs_media_icon_size"
203        android:layout_height="@dimen/qs_media_icon_size" />
204
205    <!-- Long press menu -->
206    <TextView
207        android:layout_width="match_parent"
208        android:layout_height="wrap_content"
209        android:layout_marginTop="@dimen/qs_media_padding"
210        android:layout_marginStart="@dimen/qs_media_padding"
211        android:layout_marginEnd="@dimen/qs_media_padding"
212        android:id="@+id/remove_text"
213        android:fontFamily="@*android:string/config_headlineFontFamily"
214        android:singleLine="true"
215        android:ellipsize="marquee"
216        android:marqueeRepeatLimit="marquee_forever"
217        android:text="@string/controls_media_close_session"
218        android:gravity="center_horizontal|top"
219        app:layout_constraintTop_toTopOf="parent"
220        app:layout_constraintStart_toStartOf="parent"
221        app:layout_constraintEnd_toEndOf="parent"
222        app:layout_constraintBottom_toTopOf="@id/cancel"/>
223
224    <FrameLayout
225        android:id="@+id/settings"
226        android:background="@drawable/qs_media_light_source"
227        android:layout_width="0dp"
228        android:layout_height="wrap_content"
229        android:layout_marginStart="@dimen/qs_media_padding"
230        android:layout_marginEnd="@dimen/qs_media_action_spacing"
231        android:layout_marginBottom="@dimen/qs_media_padding"
232        app:layout_constrainedWidth="true"
233        app:layout_constraintWidth_min="48dp"
234        app:layout_constraintHeight_min="48dp"
235        app:layout_constraintHorizontal_chainStyle="spread_inside"
236        app:layout_constraintStart_toStartOf="parent"
237        app:layout_constraintEnd_toStartOf="@id/cancel"
238        app:layout_constraintBottom_toBottomOf="parent"
239        app:layout_constraintTop_toBottomOf="@id/remove_text">
240
241        <TextView
242            android:id="@+id/settings_text"
243            android:layout_width="wrap_content"
244            android:layout_height="wrap_content"
245            android:layout_gravity="center|bottom"
246            style="@style/MediaPlayer.OutlineButton"
247            android:text="@string/controls_media_settings_button" />
248    </FrameLayout>
249
250    <FrameLayout
251        android:id="@+id/cancel"
252        android:background="@drawable/qs_media_light_source"
253        android:layout_width="0dp"
254        android:layout_height="wrap_content"
255        android:layout_marginStart="@dimen/qs_media_action_spacing"
256        android:layout_marginEnd="@dimen/qs_media_action_spacing"
257        android:layout_marginBottom="@dimen/qs_media_padding"
258        app:layout_constrainedWidth="true"
259        app:layout_constraintWidth_min="48dp"
260        app:layout_constraintHeight_min="48dp"
261        app:layout_constraintStart_toEndOf="@id/settings"
262        app:layout_constraintEnd_toStartOf="@id/dismiss"
263        app:layout_constraintBottom_toBottomOf="parent"
264        app:layout_constraintTop_toBottomOf="@id/remove_text">
265
266        <TextView
267            android:layout_width="wrap_content"
268            android:layout_height="wrap_content"
269            android:layout_gravity="center|bottom"
270            style="@style/MediaPlayer.OutlineButton"
271            android:text="@string/cancel" />
272    </FrameLayout>
273
274    <FrameLayout
275        android:id="@+id/dismiss"
276        android:background="@drawable/qs_media_light_source"
277        android:layout_width="0dp"
278        android:layout_height="wrap_content"
279        android:layout_marginStart="@dimen/qs_media_action_spacing"
280        android:layout_marginEnd="@dimen/qs_media_padding"
281        android:layout_marginBottom="@dimen/qs_media_padding"
282        app:layout_constrainedWidth="true"
283        app:layout_constraintWidth_min="48dp"
284        app:layout_constraintHeight_min="48dp"
285        app:layout_constraintStart_toEndOf="@id/cancel"
286        app:layout_constraintEnd_toEndOf="parent"
287        app:layout_constraintBottom_toBottomOf="parent"
288        app:layout_constraintTop_toBottomOf="@id/remove_text">
289
290        <TextView
291            android:layout_width="wrap_content"
292            android:layout_height="wrap_content"
293            android:layout_gravity="center|bottom"
294            style="@style/MediaPlayer.OutlineButton"
295            android:text="@string/controls_media_dismiss_button"
296        />
297    </FrameLayout>
298</com.android.systemui.util.animation.TransitionLayout>
299