1<!--
2  ~ Copyright (C) 2024 The Android Open Source Project
3  ~
4  ~ Licensed under the Apache License, Version 2.0 (the "License");
5  ~ you may not use this file except in compliance with the License.
6  ~ You may obtain a copy of the License at
7  ~
8  ~      http://www.apache.org/licenses/LICENSE-2.0
9  ~
10  ~ Unless required by applicable law or agreed to in writing, software
11  ~ distributed under the License is distributed on an "AS IS" BASIS,
12  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ~ See the License for the specific language governing permissions and
14  ~ limitations under the License.
15  -->
16
17<androidx.cardview.widget.CardView
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:app="http://schemas.android.com/apk/res-auto"
20    android:layout_width="match_parent"
21    android:layout_height="match_parent"
22    app:cardBackgroundColor="@color/car_surface_variant"
23    app:cardCornerRadius="@dimen/media_card_card_radius"
24    app:cardElevation="0dp">
25
26    <androidx.constraintlayout.motion.widget.MotionLayout
27        android:id="@+id/motion_layout"
28        android:layout_height="match_parent"
29        android:layout_width="match_parent"
30        app:layoutDescription="@xml/panel_animation_motion_scene">
31
32        <LinearLayout
33            android:id="@+id/media_card_panel_content_container"
34            android:layout_width="match_parent"
35            android:layout_height="@dimen/media_card_panel_content_height"
36            android:background="@color/car_surface"
37            android:orientation="vertical"
38            app:layout_constraintBottom_toBottomOf="parent">
39            <FrameLayout
40                android:id="@+id/media_card_panel_handlebar"
41                android:layout_width="match_parent"
42                android:layout_height="@dimen/media_card_panel_handlebar_touch_target_height"
43                android:paddingStart="@dimen/media_card_panel_handlebar_horizontal_padding"
44                android:paddingEnd="@dimen/media_card_panel_handlebar_horizontal_padding"
45                app:layout_constraintStart_toStartOf="parent"
46                app:layout_constraintEnd_toEndOf="parent"
47                app:layout_constraintTop_toBottomOf="parent"
48                app:layout_constraintBottom_toBottomOf="parent">
49                <View
50                    android:layout_width="match_parent"
51                    android:layout_height="@dimen/media_card_panel_handlebar_height"
52                    android:layout_gravity="center"
53                    android:background="@drawable/media_card_panel_handlebar" />
54            </FrameLayout>
55
56            <androidx.viewpager2.widget.ViewPager2
57                android:id="@+id/view_pager"
58                android:background="@color/car_surface"
59                android:layout_width="match_parent"
60                android:layout_height="match_parent" />
61        </LinearLayout>
62
63        <FrameLayout
64            android:id="@+id/empty_panel"
65            android:layout_width="match_parent"
66            android:layout_height="match_parent"
67            android:background="@color/car_surface_variant"
68            app:layout_constraintTop_toTopOf="parent"/>
69
70        <ImageView
71            android:id="@+id/media_widget_app_icon"
72            android:layout_width="@dimen/media_card_app_icon_size"
73            android:layout_height="@dimen/media_card_app_icon_size"
74            android:clipToOutline="true"
75            android:layout_marginEnd="@dimen/media_card_horizontal_margin"
76            android:layout_marginTop="@dimen/media_card_horizontal_margin"
77            app:layout_constraintTop_toTopOf="parent"
78            app:layout_constraintEnd_toEndOf="parent" />
79
80        <ImageView
81            android:id="@+id/album_art"
82            android:layout_width="@dimen/media_card_album_art_size"
83            android:layout_height="@dimen/media_card_album_art_size"
84            android:background="@drawable/radius_16_background"
85            android:clipToOutline="true"
86            android:layout_marginStart="@dimen/media_card_horizontal_margin"
87            android:layout_marginTop="@dimen/media_card_horizontal_margin"
88            app:layout_constraintTop_toTopOf="parent"
89            app:layout_constraintStart_toStartOf="parent" />
90
91        <TextView
92            android:id="@+id/title"
93            android:layout_height="wrap_content"
94            android:layout_width="0dp"
95            android:text="@string/metadata_default_title"
96            android:textColor="@color/car_on_surface"
97            android:gravity="center_vertical"
98            android:maxLines="1"
99            android:ellipsize="end"
100            android:layout_marginTop="@dimen/media_card_view_separation_margin"
101            android:layout_marginHorizontal="@dimen/media_card_horizontal_margin"
102            app:layout_constraintStart_toStartOf="parent"
103            app:layout_constraintEnd_toEndOf="parent"
104            app:layout_constraintTop_toBottomOf="@id/album_art"
105            app:layout_constraintBottom_toBottomOf="parent"
106            app:layout_constraintVertical_bias="0"/>
107
108        <TextView
109            android:id="@+id/subtitle"
110            android:layout_height="wrap_content"
111            android:layout_width="0dp"
112            style="@style/TextAppearance.Car.Body.Small"
113            android:textColor="@color/media_card_subtitle_color"
114            android:maxLines="1"
115            android:ellipsize="end"
116            android:layout_marginTop="@dimen/media_card_artist_top_margin"
117            android:layout_marginHorizontal="@dimen/media_card_horizontal_margin"
118            app:layout_constraintStart_toStartOf="parent"
119            app:layout_constraintEnd_toEndOf="parent"
120            app:layout_constraintTop_toBottomOf="@id/title" />
121
122        <SeekBar
123            android:id="@+id/playback_seek_bar"
124            android:layout_width="0dp"
125            android:layout_height="wrap_content"
126            android:clickable="false"
127            android:paddingEnd="0dp"
128            android:paddingStart="0dp"
129            android:progressBackgroundTint="@color/car_on_surface_40"
130            android:progressDrawable="@drawable/media_card_seekbar_progress"
131            android:progressTint="@color/car_on_surface"
132            android:splitTrack="true"
133            android:thumb="@drawable/media_card_seekbar_thumb"
134            android:thumbTint="@color/car_on_surface"
135            android:thumbOffset="0px"
136            android:layout_marginTop="@dimen/media_card_view_separation_margin"
137            android:layout_marginStart="@dimen/media_card_horizontal_margin"
138            android:layout_marginEnd="@dimen/media_card_view_separation_margin"
139            app:layout_goneMarginEnd="@dimen/media_card_horizontal_margin"
140            app:layout_constraintStart_toStartOf="parent"
141            app:layout_constraintEnd_toStartOf="@id/content_format"
142            app:layout_constraintTop_toBottomOf="@id/subtitle" />
143
144        <com.android.car.media.common.ContentFormatView
145            android:id="@+id/content_format"
146            android:layout_width="wrap_content"
147            android:layout_height="@dimen/media_card_small_button_size"
148            android:layout_gravity="center_vertical"
149            android:adjustViewBounds="true"
150            android:scaleType="fitStart"
151            app:logoTint="@color/car_on_surface_40"
152            app:logoSize="small"
153            android:layout_marginEnd="@dimen/media_card_horizontal_margin"
154            app:layout_constraintStart_toEndOf="@id/playback_seek_bar"
155            app:layout_constraintEnd_toEndOf="parent"
156            app:layout_constraintTop_toTopOf="@id/playback_seek_bar"
157            app:layout_constraintBottom_toBottomOf="@id/playback_seek_bar" />
158
159        <ImageButton
160            android:id="@+id/play_pause_button"
161            android:layout_width="0dp"
162            android:layout_height="@dimen/media_card_large_button_size"
163            android:src="@drawable/ic_play_pause_selector"
164            android:scaleType="center"
165            android:tint="@color/car_surface"
166            android:background="@drawable/pill_button_shape"
167            android:backgroundTint="@color/car_on_surface"
168            android:layout_marginBottom="@dimen/media_card_play_button_bottom_margin"
169            app:layout_goneMarginEnd="@dimen/media_card_horizontal_margin"
170            app:layout_goneMarginStart="@dimen/media_card_horizontal_margin"
171            app:layout_constraintStart_toEndOf="@id/playback_action_id1"
172            app:layout_constraintEnd_toStartOf="@id/playback_action_id2"
173            app:layout_constraintTop_toTopOf="parent"
174            app:layout_constraintBottom_toBottomOf="parent"
175            app:layout_constraintVertical_bias="1" />
176
177        <ImageButton
178            android:id="@+id/playback_action_id1"
179            android:layout_width="@dimen/media_card_large_button_size"
180            android:layout_height="@dimen/media_card_large_button_size"
181            android:scaleType="centerInside"
182            android:padding="@dimen/media_card_large_button_icon_padding"
183            android:cropToPadding="true"
184            android:tint="@color/playback_control_color"
185            android:background="@drawable/dark_circle_button_background"
186            android:layout_marginStart="@dimen/media_card_horizontal_margin"
187            android:layout_marginEnd="@dimen/media_card_play_button_horizontal_margin"
188            app:layout_constraintStart_toStartOf="parent"
189            app:layout_constraintEnd_toStartOf="@id/play_pause_button"
190            app:layout_constraintTop_toTopOf="@id/play_pause_button"
191            app:layout_constraintBottom_toBottomOf="@id/play_pause_button"
192            app:layout_constraintHorizontal_bias="0"/>
193
194        <ImageButton
195            android:id="@+id/playback_action_id2"
196            android:layout_width="@dimen/media_card_large_button_size"
197            android:layout_height="@dimen/media_card_large_button_size"
198            android:scaleType="centerInside"
199            android:padding="@dimen/media_card_large_button_icon_padding"
200            android:cropToPadding="true"
201            android:tint="@color/playback_control_color"
202            android:background="@drawable/dark_circle_button_background"
203            android:layout_marginEnd="@dimen/media_card_horizontal_margin"
204            android:layout_marginStart="@dimen/media_card_play_button_horizontal_margin"
205            app:layout_constraintStart_toEndOf="@id/play_pause_button"
206            app:layout_constraintEnd_toEndOf="parent"
207            app:layout_constraintTop_toTopOf="@id/play_pause_button"
208            app:layout_constraintBottom_toBottomOf="@id/play_pause_button"
209            app:layout_constraintHorizontal_bias="1" />
210
211        <LinearLayout
212            android:id="@+id/button_panel_background"
213            android:layout_width="match_parent"
214            android:layout_height="@dimen/media_card_bottom_panel_height"
215            android:background="@drawable/media_card_button_panel_background"
216            android:backgroundTint="@color/car_surface"
217            app:layout_constraintStart_toStartOf="parent"
218            app:layout_constraintEnd_toEndOf="parent"
219            app:layout_constraintTop_toTopOf="parent"
220            app:layout_constraintBottom_toBottomOf="parent"
221            app:layout_constraintVertical_bias="1">
222            <ImageButton
223                android:id="@+id/overflow_button"
224                android:layout_width="0dp"
225                android:layout_height="@dimen/media_card_bottom_panel_button_size"
226                android:layout_gravity="center"
227                android:src="@drawable/ic_overflow_horizontal"
228                android:layout_weight="1"
229                style="@style/MediaCardPanelButtonStyle"/>
230            <ImageButton
231                android:id="@+id/queue_button"
232                android:layout_width="0dp"
233                android:layout_height="@dimen/media_card_bottom_panel_button_size"
234                android:layout_gravity="center"
235                android:src="@drawable/ic_queue"
236                android:layout_weight="1"
237                style="@style/MediaCardPanelButtonStyle"/>
238            <ImageButton
239                android:id="@+id/history_button"
240                android:layout_width="0dp"
241                android:layout_height="@dimen/media_card_bottom_panel_button_size"
242                android:layout_gravity="center"
243                android:src="@drawable/ic_history"
244                android:layout_weight="1"
245                style="@style/MediaCardPanelButtonStyle"/>
246        </LinearLayout>
247    </androidx.constraintlayout.motion.widget.MotionLayout>
248</androidx.cardview.widget.CardView>
249