1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2022 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<ConstraintSet
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:app="http://schemas.android.com/apk/res-auto">
20
21    <Constraint
22        android:id="@+id/media_action_barrier_start"
23        android:layout_width="0dp"
24        android:layout_height="0dp"
25        app:layout_constraintTop_toBottomOf="@id/media_seamless"
26        app:layout_constraintStart_toEndOf="@id/action_button_guideline" />
27
28    <Constraint
29        android:id="@+id/album_art"
30        android:layout_width="match_parent"
31        android:layout_height="@dimen/qs_media_session_height_collapsed"
32        app:layout_constraintStart_toStartOf="parent"
33        app:layout_constraintEnd_toEndOf="parent"
34        app:layout_constraintTop_toTopOf="parent"
35        app:layout_constraintBottom_toBottomOf="parent" />
36
37    <!-- Touch ripple must have the same constraint as the album art. -->
38    <Constraint
39        android:id="@+id/touch_ripple_view"
40        android:layout_width="match_parent"
41        android:layout_height="@dimen/qs_media_session_height_collapsed"
42        app:layout_constraintStart_toStartOf="@+id/album_art"
43        app:layout_constraintEnd_toEndOf="@+id/album_art"
44        app:layout_constraintTop_toTopOf="@+id/album_art"
45        app:layout_constraintBottom_toBottomOf="@+id/album_art" />
46
47    <!-- Turbulence noise must have the same constraint as the album art. -->
48    <Constraint
49        android:id="@+id/turbulence_noise_view"
50        android:layout_width="match_parent"
51        android:layout_height="@dimen/qs_media_session_height_collapsed"
52        app:layout_constraintStart_toStartOf="@+id/album_art"
53        app:layout_constraintEnd_toEndOf="@+id/album_art"
54        app:layout_constraintTop_toTopOf="@+id/album_art"
55        app:layout_constraintBottom_toBottomOf="@+id/album_art" />
56
57    <Constraint
58        android:id="@+id/header_title"
59        android:layout_width="wrap_content"
60        android:layout_height="wrap_content"
61        android:layout_marginTop="20dp"
62        android:layout_marginStart="@dimen/qs_media_padding"
63        android:layout_marginEnd="@dimen/qs_media_padding"
64        app:layout_constraintEnd_toStartOf="@id/action_button_guideline"
65        app:layout_constrainedWidth="true"
66        app:layout_constraintStart_toStartOf="parent"
67        app:layout_constraintBottom_toTopOf="@id/header_artist"
68        app:layout_constraintHorizontal_bias="0" />
69
70    <Constraint
71        android:id="@+id/media_explicit_indicator"
72        android:layout_width="wrap_content"
73        android:layout_height="wrap_content"
74        android:layout_marginEnd="@dimen/qs_media_info_spacing"
75        android:layout_marginBottom="@dimen/qs_media_padding"
76        android:layout_marginTop="@dimen/qs_media_icon_offset"
77        app:layout_constraintStart_toStartOf="@id/header_title"
78        app:layout_constraintEnd_toStartOf="@id/header_artist"
79        app:layout_constraintTop_toTopOf="@id/header_artist"
80        app:layout_constraintBottom_toBottomOf="@id/header_artist"
81        app:layout_constraintVertical_bias="0"
82        app:layout_constraintHorizontal_bias="0"
83        app:layout_constraintHorizontal_chainStyle="packed" />
84
85    <Constraint
86        android:id="@+id/header_artist"
87        android:layout_width="wrap_content"
88        android:layout_height="wrap_content"
89        android:layout_marginEnd="@dimen/qs_media_padding"
90        android:layout_marginBottom="@dimen/qs_media_padding"
91        android:layout_marginTop="0dp"
92        app:layout_constraintEnd_toStartOf="@id/action_button_guideline"
93        app:layout_constrainedWidth="true"
94        app:layout_constraintStart_toEndOf="@id/media_explicit_indicator"
95        app:layout_constraintBottom_toBottomOf="parent"
96        app:layout_constraintVertical_bias="0" />
97
98    <Constraint
99        android:id="@+id/actionPlayPause"
100        android:layout_width="48dp"
101        android:layout_height="48dp"
102        android:layout_marginEnd="@dimen/qs_media_padding"
103        android:layout_marginBottom="@dimen/qs_media_padding"
104        app:layout_constraintVertical_bias="1"
105        app:layout_constraintEnd_toEndOf="parent"
106        app:layout_constraintBottom_toBottomOf="parent"
107        app:layout_constraintTop_toBottomOf="@id/media_seamless"
108        app:layout_constraintStart_toEndOf="@id/media_action_barrier_end" />
109
110    <!--
111    There will only be 3 action buttons shown at most in this layout (controlled in code).
112    Play/Pause should always be at the end, but the other buttons should remain in the same order
113    when in RTL.
114    This is accomplished by setting two barriers at the start and end of the small buttons,
115    anchored to a guideline set at 3x button width from the end. The text and play/pause button are
116    positioned relative to the barriers, and the small buttons use right/left constraints to stay
117    in the correct order inside the barriers.
118    -->
119    <Constraint
120        android:id="@+id/actionPrev"
121        android:layout_width="48dp"
122        android:layout_height="48dp"
123        android:layout_marginBottom="@dimen/qs_media_padding"
124        app:layout_constraintHorizontal_bias="1"
125        app:layout_constraintVertical_bias="1"
126        app:layout_constraintHorizontal_chainStyle="packed"
127        app:layout_constraintRight_toLeftOf="@id/media_progress_bar"
128        app:layout_constraintBottom_toBottomOf="parent"
129        app:layout_constraintTop_toBottomOf="@id/media_seamless"
130        app:layout_constraintLeft_toRightOf="@id/media_action_barrier_start" />
131
132    <!-- Showing time while scrubbing isn't available in collapsed mode. -->
133    <Constraint
134        android:id="@+id/media_scrubbing_elapsed_time"
135        android:visibility="gone"
136        app:layout_constraintRight_toLeftOf="@id/media_progress_bar"
137        app:layout_constraintBottom_toBottomOf="parent"
138        app:layout_constraintTop_toBottomOf="@id/media_seamless"
139        app:layout_constraintLeft_toRightOf="@id/media_action_barrier_start" />
140
141    <Constraint
142        android:id="@+id/media_progress_bar"
143        android:layout_width="0dp"
144        android:layout_height="wrap_content"
145        android:layout_marginBottom="@dimen/qs_media_padding"
146        android:visibility="gone"
147        app:layout_constraintVertical_bias="1"
148        app:layout_constraintLeft_toRightOf="@id/actionPrev"
149        app:layout_constraintRight_toLeftOf="@id/actionNext"
150        app:layout_constraintBottom_toBottomOf="parent"
151        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
152
153    <Constraint
154        android:id="@+id/actionNext"
155        android:layout_width="48dp"
156        android:layout_height="48dp"
157        android:layout_marginBottom="@dimen/qs_media_padding"
158        app:layout_constraintVertical_bias="1"
159        app:layout_constraintLeft_toRightOf="@id/media_progress_bar"
160        app:layout_constraintRight_toLeftOf="@id/action0"
161        app:layout_constraintBottom_toBottomOf="parent"
162        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
163
164    <!-- Showing time while scrubbing isn't available in collapsed mode. -->
165    <Constraint
166        android:id="@+id/media_scrubbing_total_time"
167        android:visibility="gone"
168        app:layout_constraintVertical_bias="1"
169        app:layout_constraintLeft_toRightOf="@id/media_progress_bar"
170        app:layout_constraintRight_toLeftOf="@id/action0"
171        app:layout_constraintBottom_toBottomOf="parent"
172        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
173
174    <Constraint
175        android:id="@+id/action0"
176        android:layout_width="48dp"
177        android:layout_height="48dp"
178        android:layout_marginBottom="@dimen/qs_media_padding"
179        android:visibility="gone"
180        app:layout_constraintVertical_bias="1"
181        app:layout_constraintLeft_toRightOf="@id/actionNext"
182        app:layout_constraintRight_toLeftOf="@id/action1"
183        app:layout_constraintBottom_toBottomOf="parent"
184        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
185
186    <Constraint
187        android:id="@+id/action1"
188        android:layout_width="48dp"
189        android:layout_height="48dp"
190        android:layout_marginBottom="@dimen/qs_media_padding"
191        android:visibility="gone"
192        app:layout_constraintVertical_bias="1"
193        app:layout_constraintLeft_toRightOf="@id/action0"
194        app:layout_constraintRight_toLeftOf="@id/action2"
195        app:layout_constraintBottom_toBottomOf="parent"
196        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
197
198    <Constraint
199        android:id="@+id/action2"
200        android:layout_width="48dp"
201        android:layout_height="48dp"
202        android:layout_marginBottom="@dimen/qs_media_padding"
203        android:visibility="gone"
204        app:layout_constraintVertical_bias="1"
205        app:layout_constraintLeft_toRightOf="@id/action1"
206        app:layout_constraintRight_toLeftOf="@id/action3"
207        app:layout_constraintBottom_toBottomOf="parent"
208        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
209
210    <Constraint
211        android:id="@+id/action3"
212        android:layout_width="48dp"
213        android:layout_height="48dp"
214        android:layout_marginBottom="@dimen/qs_media_padding"
215        android:visibility="gone"
216        app:layout_constraintVertical_bias="1"
217        app:layout_constraintLeft_toRightOf="@id/action2"
218        app:layout_constraintRight_toLeftOf="@id/action4"
219        app:layout_constraintBottom_toBottomOf="parent"
220        app:layout_constraintTop_toBottomOf="@id/media_seamless" />
221
222    <Constraint
223        android:id="@+id/action4"
224        android:layout_width="48dp"
225        android:layout_height="48dp"
226        android:layout_marginBottom="@dimen/qs_media_padding"
227        android:visibility="gone"
228        app:layout_constraintVertical_bias="1"
229        app:layout_constraintLeft_toRightOf="@id/action3"
230        app:layout_constraintBottom_toBottomOf="parent"
231        app:layout_constraintTop_toBottomOf="@id/media_seamless"
232        app:layout_constraintRight_toLeftOf="@id/media_action_barrier_end" />
233</ConstraintSet>
234