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 <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout 26 android:id="@+id/item_view_0" 27 android:layout_width="@dimen/clock_carousel_item_width" 28 android:layout_height="@dimen/clock_carousel_item_height" 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 <FrameLayout 34 android:layout_width="match_parent" 35 android:layout_height="match_parent" 36 android:layout_gravity="center" /> 37 </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout> 38 39 <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout 40 android:id="@+id/item_view_1" 41 android:layout_width="@dimen/clock_carousel_item_width" 42 android:layout_height="@dimen/clock_carousel_item_height" 43 android:layout_marginEnd="@dimen/clock_carousel_item_margin" 44 app:layout_constraintBottom_toBottomOf="parent" 45 app:layout_constraintEnd_toStartOf="@+id/item_view_2" 46 app:layout_constraintTop_toTopOf="parent" > 47 <FrameLayout 48 android:layout_width="match_parent" 49 android:layout_height="match_parent" 50 android:layout_gravity="center" /> 51 </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout> 52 53 <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout 54 android:id="@+id/item_view_2" 55 android:layout_width="@dimen/clock_carousel_item_width" 56 android:layout_height="@dimen/clock_carousel_item_height" 57 app:layout_constraintBottom_toBottomOf="parent" 58 app:layout_constraintEnd_toEndOf="parent" 59 app:layout_constraintHorizontal_bias="0.5" 60 app:layout_constraintStart_toStartOf="parent" 61 app:layout_constraintTop_toTopOf="parent"> 62 <FrameLayout 63 android:layout_width="match_parent" 64 android:layout_height="match_parent" 65 android:layout_gravity="center" /> 66 </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout> 67 68 <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout 69 android:id="@+id/item_view_3" 70 android:layout_width="@dimen/clock_carousel_item_width" 71 android:layout_height="@dimen/clock_carousel_item_height" 72 android:layout_marginStart="@dimen/clock_carousel_item_margin" 73 app:layout_constraintBottom_toBottomOf="parent" 74 app:layout_constraintStart_toEndOf="@+id/item_view_2" 75 app:layout_constraintTop_toTopOf="parent" > 76 <FrameLayout 77 android:layout_width="match_parent" 78 android:layout_height="match_parent" 79 android:layout_gravity="center" /> 80 </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout> 81 82 <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout 83 android:id="@+id/item_view_4" 84 android:layout_width="@dimen/clock_carousel_item_width" 85 android:layout_height="@dimen/clock_carousel_item_height" 86 android:layout_marginStart="@dimen/clock_carousel_item_margin" 87 app:layout_constraintBottom_toBottomOf="parent" 88 app:layout_constraintStart_toEndOf="@+id/item_view_3" 89 app:layout_constraintTop_toTopOf="parent" > 90 <FrameLayout 91 android:layout_width="match_parent" 92 android:layout_height="match_parent" 93 android:layout_gravity="center" /> 94 </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout> 95 96 <androidx.constraintlayout.helper.widget.Carousel 97 android:id="@+id/carousel" 98 android:layout_width="wrap_content" 99 android:layout_height="wrap_content" 100 app:carousel_backwardTransition="@+id/backward" 101 app:carousel_firstView="@+id/item_view_2" 102 app:carousel_forwardTransition="@+id/forward" 103 app:carousel_infinite="true" 104 app:carousel_nextState="@+id/next" 105 app:carousel_previousState="@+id/previous" 106 app:constraint_referenced_ids="item_view_0,item_view_1,item_view_2,item_view_3,item_view_4" /> 107 108 <!-- The guidelines make sure that only the view in the middle show between the lines --> 109 <androidx.constraintlayout.widget.Guideline 110 android:id="@+id/guideline_start" 111 android:layout_width="wrap_content" 112 android:layout_height="wrap_content" 113 android:orientation="vertical" 114 app:layout_constraintGuide_begin="@dimen/clock_carousel_guideline_margin" /> 115 116 <androidx.constraintlayout.widget.Guideline 117 android:id="@+id/guideline_end" 118 android:layout_width="wrap_content" 119 android:layout_height="wrap_content" 120 android:orientation="vertical" 121 app:layout_constraintGuide_end="@dimen/clock_carousel_guideline_margin" /> 122</androidx.constraintlayout.motion.widget.MotionLayout>