1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  Copyright 2018, 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<androidx.constraintlayout.widget.ConstraintLayout
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:app="http://schemas.android.com/apk/res-auto"
20    android:id="@+id/playback_container"
21    android:layout_width="match_parent"
22    android:layout_height="match_parent">
23
24    <androidx.constraintlayout.widget.Guideline
25        android:id="@+id/app_bar_guideline"
26        android:layout_width="wrap_content"
27        android:layout_height="wrap_content"
28        android:orientation="horizontal"
29        app:layout_constraintGuide_begin="@dimen/car_ui_toolbar_first_row_height"/>
30
31    <Space
32        android:id="@+id/control_bar_first_row_guideline"
33        android:layout_width="0dp"
34        android:layout_height="@dimen/control_bar_height"
35        android:layout_marginBottom="@dimen/control_bar_margin_bottom"
36        app:layout_constraintBottom_toBottomOf="parent"/>
37
38    <com.android.car.apps.common.BackgroundImageView
39        android:id="@+id/playback_background"
40        android:layout_width="match_parent"
41        android:layout_height="match_parent"/>
42
43    <include
44        layout="@layout/scrim_overlay"
45        android:id="@+id/background_scrim"
46        android:layout_width="0dp"
47        android:layout_height="0dp"
48        app:layout_constraintTop_toTopOf="parent"
49        app:layout_constraintBottom_toBottomOf="parent"
50        app:layout_constraintLeft_toLeftOf="parent"
51        app:layout_constraintRight_toRightOf="parent"/>
52
53    <FrameLayout
54        android:id="@+id/nav_icon_container"
55        android:layout_width="@dimen/car_ui_toolbar_margin"
56        android:layout_height="@dimen/car_ui_toolbar_first_row_height"
57        android:background="?android:attr/selectableItemBackground"
58        app:layout_constraintTop_toTopOf="parent"
59        app:layout_constraintLeft_toLeftOf="parent">
60        <ImageView
61            android:id="@+id/nav_icon"
62            android:layout_width="@dimen/car_ui_toolbar_nav_icon_size"
63            android:layout_height="@dimen/car_ui_toolbar_nav_icon_size"
64            android:src="@drawable/car_ui_icon_down"
65            android:layout_gravity="center"
66            android:scaleType="fitXY"
67            style="@style/Widget.CarUi.Toolbar.NavIcon"/>
68    </FrameLayout>
69
70    <FrameLayout
71        android:id="@+id/title_logo_container"
72        android:layout_width="wrap_content"
73        android:layout_height="wrap_content"
74        android:paddingEnd="@dimen/car_ui_toolbar_title_logo_padding"
75        app:layout_constraintTop_toTopOf="@id/nav_icon_container"
76        app:layout_constraintBottom_toBottomOf="@id/nav_icon_container"
77        app:layout_constraintStart_toEndOf="@id/nav_icon_container">
78
79        <ImageView
80            android:id="@+id/car_ui_toolbar_title_logo"
81            android:layout_width="@dimen/car_ui_primary_icon_size"
82            android:layout_height="@dimen/car_ui_primary_icon_size"
83            android:layout_gravity="center"
84            android:scaleType="fitXY"/>
85    </FrameLayout>
86
87    <TextView
88        android:id="@+id/playback_title"
89        android:layout_width="0dp"
90        android:layout_height="wrap_content"
91        android:layout_marginStart="@dimen/car_ui_toolbar_title_margin_start"
92        android:singleLine="true"
93        android:text="@string/fragment_playback_title"
94        style="@style/TextAppearance.CarUi.Widget.Toolbar.Title"
95        app:layout_constraintTop_toTopOf="@id/nav_icon_container"
96        app:layout_constraintBottom_toBottomOf="@id/nav_icon_container"
97        app:layout_constraintLeft_toRightOf="@id/title_logo_container"
98        app:layout_constraintRight_toLeftOf="@+id/queue_button"/>
99
100    <ImageView
101        android:id="@+id/queue_button"
102        android:layout_width="@dimen/appbar_view_icon_touch_target_size"
103        android:layout_height="@dimen/appbar_view_icon_touch_target_size"
104        android:layout_marginEnd="@dimen/playback_queue_button_margin_end"
105        android:src="@drawable/ic_queue_button"
106        android:scaleType="center"
107        android:background="@drawable/appbar_view_icon_background"
108        app:layout_constraintTop_toTopOf="@id/nav_icon_container"
109        app:layout_constraintBottom_toBottomOf="@id/nav_icon_container"
110        app:layout_constraintRight_toRightOf="parent"/>
111
112    <include
113        style="@style/MetadataContainerStyle"
114        android:id="@+id/metadata_container"
115        layout="@layout/metadata_normal"
116        app:layout_constraintStart_toStartOf="parent"
117        app:layout_constraintEnd_toEndOf="parent"
118        app:layout_constraintTop_toBottomOf="@id/app_bar_guideline"
119        app:layout_constraintBottom_toTopOf="@+id/control_bar_first_row_guideline"/>
120
121    <!-- @id/seek_bar should be hidden when @id/control_bar_scrim is expanded, and shown when the
122    scrim is collapsed. Since its visibility is also controlled by MetadataController, it could
123    become visible again even if the scrim is still expanded. To solve that we add a wrapper around
124    it and hide/show the wrapper when the scrim is expanded/collapsed.-->
125    <FrameLayout
126        style="@style/SeekBarStyle"
127        android:id="@+id/seek_bar_container"
128        android:layout_gravity="center"
129        android:layout_marginStart="@dimen/playback_seekbar_margin_x"
130        android:layout_marginEnd="@dimen/playback_seekbar_margin_x"
131        app:layout_constraintStart_toStartOf="parent"
132        app:layout_constraintEnd_toEndOf="parent"
133        app:layout_constraintTop_toBottomOf="@+id/metadata_container"
134        app:layout_constraintBottom_toTopOf="@+id/control_bar_first_row_guideline">
135        <SeekBar
136            android:id="@+id/seek_bar"
137            android:layout_width="match_parent"
138            android:layout_height="match_parent"
139            android:clickable="false"
140            android:focusable="false"
141            android:paddingEnd="@dimen/playback_seekbar_padding_x"
142            android:paddingStart="@dimen/playback_seekbar_padding_x"
143            android:progressDrawable="@drawable/seekbar_background"
144            android:thumb="@drawable/seekbar_thumb"
145            android:thumbOffset="@dimen/playback_seekbar_thumb_offset"
146            android:splitTrack="false"
147            android:progressTint="@color/progress_bar_highlight"
148            android:progressBackgroundTint="@color/progress_bar_background"
149            android:background="@null"/>
150    </FrameLayout>
151
152    <Space
153        android:id="@+id/queue_list_top_constraint"
154        android:layout_width="match_parent"
155        android:layout_height="@dimen/fragment_playback_queue_overlap_top"
156        app:layout_constraintBottom_toBottomOf="@+id/app_bar_guideline"/>
157
158    <Space
159        android:id="@+id/queue_list_bottom_constraint"
160        android:layout_width="match_parent"
161        android:layout_height="@dimen/fragment_playback_queue_overlap_bottom"
162        app:layout_constraintTop_toTopOf="@+id/control_bar_first_row_guideline"/>
163
164    <!-- The queue_container is a workaround for a bug in PagedRecyclerView (b/136669451). -->
165    <RelativeLayout
166        android:id="@+id/queue_container"
167        android:layout_width="match_parent"
168        android:layout_height="0dp"
169        app:layout_constraintTop_toTopOf="@+id/queue_list_top_constraint"
170        app:layout_constraintBottom_toBottomOf="@+id/queue_list_bottom_constraint">
171        <com.android.car.ui.recyclerview.CarUiRecyclerView
172            android:id="@+id/queue_list"
173            android:layout_width="match_parent"
174            android:layout_height="match_parent"
175            android:visibility="gone"
176            android:fadeScrollbars="true"
177            android:requiresFadingEdge="vertical"
178            android:fadingEdgeLength="@dimen/queue_fading_edge_length"/>
179    </RelativeLayout>
180
181    <include
182        layout="@layout/scrim_overlay"
183        android:id="@+id/control_bar_scrim"
184        android:layout_width="0dp"
185        android:layout_height="0dp"
186        app:layout_constraintTop_toTopOf="parent"
187        app:layout_constraintBottom_toBottomOf="parent"
188        app:layout_constraintLeft_toLeftOf="parent"
189        app:layout_constraintRight_toRightOf="parent"/>
190
191    <com.android.car.media.common.PlaybackControlsActionBar
192        android:id="@+id/playback_controls"
193        style="@style/ControlBar"
194        android:layout_marginHorizontal="@dimen/control_bar_margin_x"
195        android:layout_marginBottom="@dimen/control_bar_margin_bottom"
196        app:columns="5"
197        app:enableOverflow="true"
198        app:layout_constraintBottom_toBottomOf="parent"
199        app:layout_constraintLeft_toLeftOf="parent"
200        app:layout_constraintRight_toRightOf="parent"/>
201</androidx.constraintlayout.widget.ConstraintLayout>
202