[TP] Fix digital clocks in clock carousel
1. Modify the view size of the clock carousel to make it same as the
screen preview
2. Choose a proper ratio for the text size for text view clocks
Test: Manually tested that the text clocks are showing
Bug: 262924055
Change-Id: I06220c4f10dc4b7b475efe5471dcf19a94a4ce82
diff --git a/res/layout/clock_carousel.xml b/res/layout/clock_carousel.xml
index 098586e..cfc7e4e 100644
--- a/res/layout/clock_carousel.xml
+++ b/res/layout/clock_carousel.xml
@@ -19,59 +19,79 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/motion_container"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
app:layoutDescription="@xml/carousel_scene">
- <FrameLayout
+ <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:id="@+id/item_view_0"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
- android:layout_marginEnd="16dp"
- android:scaleType="centerCrop"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ android:layout_marginEnd="@dimen/clock_carousel_item_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_view_1"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+ </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
- <FrameLayout
+ <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:id="@+id/item_view_1"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
- android:layout_marginEnd="16dp"
- android:scaleType="centerCrop"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ android:layout_marginEnd="@dimen/clock_carousel_item_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_view_2"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent" >
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+ </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
- <FrameLayout
+ <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:id="@+id/item_view_2"
- android:layout_width="@dimen/clock_carousel_item_large_size"
- android:layout_height="@dimen/clock_carousel_item_large_size"
- android:scaleType="centerCrop"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+ </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
- <FrameLayout
+ <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:id="@+id/item_view_3"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
- android:layout_marginStart="16dp"
- android:scaleType="centerCrop"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ android:layout_marginStart="@dimen/clock_carousel_item_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_view_2"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent" >
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+ </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
- <FrameLayout
+ <com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:id="@+id/item_view_4"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
- android:layout_marginStart="16dp"
- android:scaleType="centerCrop"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ android:layout_marginStart="@dimen/clock_carousel_item_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_view_3"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent" >
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+ </com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
<androidx.constraintlayout.helper.widget.Carousel
android:id="@+id/carousel"
diff --git a/res/layout/clock_carousel_view.xml b/res/layout/clock_carousel_view.xml
index 21ff266..f1c959c 100644
--- a/res/layout/clock_carousel_view.xml
+++ b/res/layout/clock_carousel_view.xml
@@ -17,4 +17,4 @@
<com.android.customization.picker.clock.ui.view.ClockCarouselView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
\ No newline at end of file
+ android:layout_height="@dimen/screen_preview_height" />
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index febca46..b856c35 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -153,7 +153,7 @@
<!-- Width of a single selectable item in the lock screen quick affordance picker. -->
<dimen name="keyguard_quick_affordance_picker_item_width">74dp</dimen>
- <dimen name="clock_carousel_item_small_size">100dp</dimen>
- <dimen name="clock_carousel_item_large_size">120dp</dimen>
- <dimen name="clock_carousel_item_margin">32dp</dimen>
+ <dimen name="clock_carousel_item_width">190dp</dimen>
+ <dimen name="clock_carousel_item_height">380dp</dimen>
+ <dimen name="clock_carousel_item_margin">16dp</dimen>
</resources>
diff --git a/res/xml/carousel_scene.xml b/res/xml/carousel_scene.xml
index 345f690..8c6738b 100644
--- a/res/xml/carousel_scene.xml
+++ b/res/xml/carousel_scene.xml
@@ -40,94 +40,82 @@
<ConstraintSet android:id="@+id/previous">
<Constraint
android:id="@+id/item_view_0"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintEnd_toStartOf="@id/guideline_start"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginEnd="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_1"
- android:layout_width="0dp"
- android:layout_height="0dp"
- motion:layout_constraintDimensionRatio="1:1"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ motion:layout_constraintWidth_max="@dimen/clock_carousel_item_width"
motion:layout_constraintHorizontal_bias="0.5"
- motion:layout_constraintStart_toStartOf="@id/guideline_start"
- motion:layout_constraintEnd_toEndOf="@id/guideline_end"
+ motion:layout_constraintStart_toStartOf="parent"
+ motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="@dimen/clock_carousel_item_margin"
- android:layout_marginEnd="@dimen/clock_carousel_item_margin" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_2"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintStart_toStartOf="@id/guideline_end"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/item_view_1"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintEnd_toStartOf="@id/guideline_start"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginEnd="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_2"
- android:layout_width="0dp"
- android:layout_height="0dp"
- motion:layout_constraintDimensionRatio="1:1"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ motion:layout_constraintWidth_max="@dimen/clock_carousel_item_width"
motion:layout_constraintHorizontal_bias="0.5"
- motion:layout_constraintStart_toStartOf="@id/guideline_start"
- motion:layout_constraintEnd_toEndOf="@id/guideline_end"
+ motion:layout_constraintStart_toStartOf="parent"
+ motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="@dimen/clock_carousel_item_margin"
- android:layout_marginEnd="@dimen/clock_carousel_item_margin" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_3"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintStart_toStartOf="@id/guideline_end"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/next">
<Constraint
android:id="@+id/item_view_2"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintEnd_toStartOf="@id/guideline_start"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginEnd="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_3"
- android:layout_width="0dp"
- android:layout_height="0dp"
- motion:layout_constraintDimensionRatio="1:1"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
+ motion:layout_constraintWidth_max="@dimen/clock_carousel_item_width"
motion:layout_constraintHorizontal_bias="0.5"
- motion:layout_constraintStart_toStartOf="@id/guideline_start"
- motion:layout_constraintEnd_toEndOf="@id/guideline_end"
+ motion:layout_constraintStart_toStartOf="parent"
+ motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="@dimen/clock_carousel_item_margin"
- android:layout_marginEnd="@dimen/clock_carousel_item_margin" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
<Constraint
android:id="@+id/item_view_4"
- android:layout_width="@dimen/clock_carousel_item_small_size"
- android:layout_height="@dimen/clock_carousel_item_small_size"
+ android:layout_width="@dimen/clock_carousel_item_width"
+ android:layout_height="@dimen/clock_carousel_item_height"
motion:layout_constraintStart_toStartOf="@id/guideline_end"
motion:layout_constraintTop_toTopOf="parent"
- motion:layout_constraintBottom_toBottomOf="parent"
- android:layout_marginStart="16dp" />
+ motion:layout_constraintBottom_toBottomOf="parent" />
</ConstraintSet>
</MotionScene>
\ No newline at end of file