1<?xml version="1.0" encoding="utf-8"?>
2<!--
3     Copyright (C) 2023 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.motion.widget.MotionLayout
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:app="http://schemas.android.com/apk/res-auto"
20    android:id="@+id/motion_container"
21    android:layout_width="match_parent"
22    android:layout_height="match_parent"
23    app:layoutDescription="@xml/carousel_scene">
24
25    <FrameLayout
26        android:id="@+id/item_view_0"
27        android:layout_width="@dimen/screen_preview_width"
28        android:layout_height="wrap_content"
29        android:layout_marginEnd="@dimen/clock_carousel_item_margin"
30        app:layout_constraintBottom_toBottomOf="parent"
31        app:layout_constraintEnd_toStartOf="@+id/item_view_1"
32        app:layout_constraintTop_toTopOf="parent">
33
34        <View
35            android:id="@+id/item_card_0"
36            android:layout_width="@dimen/clock_carousel_item_card_width"
37            android:layout_height="@dimen/clock_carousel_item_card_height"
38            android:layout_gravity="center"
39            android:background="@drawable/carousel_item_card_background"/>
40
41        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
42            android:id="@+id/clock_scale_view_0"
43            android:layout_width="@dimen/screen_preview_width"
44            android:layout_height="wrap_content"
45            android:layout_gravity="center"
46            android:clipChildren="false"
47            android:importantForAccessibility="noHideDescendants">
48            <com.android.customization.picker.clock.ui.view.ClockHostView
49                android:id="@+id/clock_host_view_0"
50                android:layout_width="match_parent"
51                android:layout_height="match_parent"
52                android:layout_gravity="center"
53                android:clipChildren="false" />
54        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
55    </FrameLayout>
56
57    <FrameLayout
58        android:id="@+id/item_view_1"
59        android:layout_width="@dimen/screen_preview_width"
60        android:layout_height="wrap_content"
61        android:layout_marginEnd="@dimen/clock_carousel_item_margin"
62        app:layout_constraintBottom_toBottomOf="parent"
63        app:layout_constraintEnd_toStartOf="@+id/item_view_2"
64        app:layout_constraintTop_toTopOf="parent">
65
66        <View
67            android:id="@+id/item_card_1"
68            android:layout_width="@dimen/clock_carousel_item_card_width"
69            android:layout_height="@dimen/clock_carousel_item_card_height"
70            android:layout_gravity="center"
71            android:background="@drawable/carousel_item_card_background"/>
72
73        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
74            android:id="@+id/clock_scale_view_1"
75            android:layout_width="@dimen/screen_preview_width"
76            android:layout_height="wrap_content"
77            android:layout_gravity="center"
78            android:clipChildren="false"
79            android:importantForAccessibility="noHideDescendants">
80            <com.android.customization.picker.clock.ui.view.ClockHostView
81                android:id="@+id/clock_host_view_1"
82                android:layout_width="match_parent"
83                android:layout_height="match_parent"
84                android:layout_gravity="center"
85                android:clipChildren="false"/>
86        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
87    </FrameLayout>
88
89    <FrameLayout
90        android:id="@+id/item_view_2"
91        android:layout_width="@dimen/screen_preview_width"
92        android:layout_height="wrap_content"
93        app:layout_constraintBottom_toBottomOf="parent"
94        app:layout_constraintEnd_toEndOf="parent"
95        app:layout_constraintHorizontal_bias="0.5"
96        app:layout_constraintStart_toStartOf="parent"
97        app:layout_constraintTop_toTopOf="parent">
98
99        <View
100            android:id="@+id/item_card_2"
101            android:layout_width="@dimen/clock_carousel_item_card_width"
102            android:layout_height="@dimen/clock_carousel_item_card_height"
103            android:alpha="0.0"
104            android:layout_gravity="center"
105            android:background="@drawable/carousel_item_card_background"/>
106
107        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
108            android:id="@+id/clock_scale_view_2"
109            android:layout_width="@dimen/screen_preview_width"
110            android:layout_height="wrap_content"
111            android:layout_gravity="center"
112            android:clipChildren="false"
113            android:importantForAccessibility="noHideDescendants">
114            <com.android.customization.picker.clock.ui.view.ClockHostView
115                android:id="@+id/clock_host_view_2"
116                android:layout_width="match_parent"
117                android:layout_height="match_parent"
118                android:layout_gravity="center"
119                android:clipChildren="false"/>
120        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
121    </FrameLayout>
122
123    <FrameLayout
124        android:id="@+id/item_view_3"
125        android:layout_width="@dimen/screen_preview_width"
126        android:layout_height="wrap_content"
127        android:layout_marginStart="@dimen/clock_carousel_item_margin"
128        app:layout_constraintBottom_toBottomOf="parent"
129        app:layout_constraintStart_toEndOf="@+id/item_view_2"
130        app:layout_constraintTop_toTopOf="parent">
131
132        <View
133            android:id="@+id/item_card_3"
134            android:layout_width="@dimen/clock_carousel_item_card_width"
135            android:layout_height="@dimen/clock_carousel_item_card_height"
136            android:layout_gravity="center"
137            android:background="@drawable/carousel_item_card_background"/>
138
139        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
140            android:id="@+id/clock_scale_view_3"
141            android:layout_width="@dimen/screen_preview_width"
142            android:layout_height="wrap_content"
143            android:layout_gravity="center"
144            android:clipChildren="false"
145            android:importantForAccessibility="noHideDescendants">
146            <com.android.customization.picker.clock.ui.view.ClockHostView
147                android:id="@+id/clock_host_view_3"
148                android:layout_width="match_parent"
149                android:layout_height="match_parent"
150                android:layout_gravity="center"
151                android:clipChildren="false"/>
152        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
153    </FrameLayout>
154
155    <FrameLayout
156        android:id="@+id/item_view_4"
157        android:layout_width="@dimen/screen_preview_width"
158        android:layout_height="wrap_content"
159        android:layout_marginStart="@dimen/clock_carousel_item_margin"
160        app:layout_constraintBottom_toBottomOf="parent"
161        app:layout_constraintStart_toEndOf="@+id/item_view_3"
162        app:layout_constraintTop_toTopOf="parent">
163
164        <View
165            android:id="@+id/item_card_4"
166            android:layout_width="@dimen/clock_carousel_item_card_width"
167            android:layout_height="@dimen/clock_carousel_item_card_height"
168            android:layout_gravity="center"
169            android:background="@drawable/carousel_item_card_background"/>
170
171        <com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout
172            android:id="@+id/clock_scale_view_4"
173            android:layout_width="@dimen/screen_preview_width"
174            android:layout_height="wrap_content"
175            android:layout_gravity="center"
176            android:clipChildren="false"
177            android:importantForAccessibility="noHideDescendants">
178            <com.android.customization.picker.clock.ui.view.ClockHostView
179                android:id="@+id/clock_host_view_4"
180                android:layout_width="match_parent"
181                android:layout_height="match_parent"
182                android:layout_gravity="center"
183                android:clipChildren="false" />
184        </com.android.wallpaper.picker.FixedWidthDisplayRatioFrameLayout>
185    </FrameLayout>
186
187    <androidx.constraintlayout.helper.widget.Carousel
188        android:id="@+id/carousel"
189        android:layout_width="wrap_content"
190        android:layout_height="wrap_content"
191        app:carousel_backwardTransition="@+id/backward"
192        app:carousel_firstView="@+id/item_view_2"
193        app:carousel_forwardTransition="@+id/forward"
194        app:carousel_infinite="true"
195        app:carousel_nextState="@+id/next"
196        app:carousel_previousState="@+id/previous"
197        app:constraint_referenced_ids="item_view_0,item_view_1,item_view_2,item_view_3,item_view_4" />
198
199    <!-- The guidelines make sure that only the view in the middle show between the lines  -->
200    <androidx.constraintlayout.widget.Guideline
201        android:id="@+id/guideline_start"
202        android:layout_width="wrap_content"
203        android:layout_height="wrap_content"
204        android:orientation="vertical"
205        app:layout_constraintGuide_begin="@dimen/clock_carousel_guideline_margin" />
206
207    <androidx.constraintlayout.widget.Guideline
208        android:id="@+id/guideline_end"
209        android:layout_width="wrap_content"
210        android:layout_height="wrap_content"
211        android:orientation="vertical"
212        app:layout_constraintGuide_end="@dimen/clock_carousel_guideline_margin" />
213</androidx.constraintlayout.motion.widget.MotionLayout>