Merge "Fix preview cut on clock settings page" into udc-dev
diff --git a/res/layout/clock_color_option.xml b/res/layout/clock_color_option.xml
new file mode 100644
index 0000000..4203a39
--- /dev/null
+++ b/res/layout/clock_color_option.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- Content description is set programmatically on the parent FrameLayout -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="@dimen/option_item_size"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:clipChildren="false">
+ <FrameLayout
+ android:id="@+id/icon_container"
+ android:layout_width="@dimen/option_item_size"
+ android:layout_height="@dimen/option_item_size"
+ android:clipChildren="false">
+
+ <ImageView
+ android:id="@id/selection_border"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/option_item_border"
+ android:alpha="0"
+ android:importantForAccessibility="no" />
+
+ <ImageView
+ android:id="@id/background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/option_item_background"
+ android:importantForAccessibility="no" />
+
+ <FrameLayout
+ android:id="@id/foreground"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/color_preview_0"
+ android:layout_width="@dimen/component_color_chip_small_radius_default2"
+ android:layout_height="@dimen/component_color_chip_small_radius_default2"
+ android:layout_gravity="center"
+ android:layout_marginRight="@dimen/color_seed_chip_margin2"
+ android:layout_marginBottom="@dimen/color_seed_chip_margin2"
+ android:src="@drawable/color_chip_seed_filled0"
+ android:importantForAccessibility="no"/>
+
+ <ImageView
+ android:id="@+id/color_preview_1"
+ android:layout_width="@dimen/component_color_chip_small_radius_default2"
+ android:layout_height="@dimen/component_color_chip_small_radius_default2"
+ android:layout_gravity="center"
+ android:layout_marginLeft="@dimen/color_seed_chip_margin2"
+ android:layout_marginBottom="@dimen/color_seed_chip_margin2"
+ android:src="@drawable/color_chip_seed_filled2"
+ android:importantForAccessibility="no"/>
+
+ <ImageView
+ android:id="@+id/color_preview_2"
+ android:layout_width="@dimen/component_color_chip_small_radius_default2"
+ android:layout_height="@dimen/component_color_chip_small_radius_default2"
+ android:layout_gravity="center"
+ android:layout_marginRight="@dimen/color_seed_chip_margin2"
+ android:layout_marginTop="@dimen/color_seed_chip_margin2"
+ android:src="@drawable/color_chip_seed_filled1"
+ android:importantForAccessibility="no"/>
+
+ <ImageView
+ android:id="@+id/color_preview_3"
+ android:layout_width="@dimen/component_color_chip_small_radius_default2"
+ android:layout_height="@dimen/component_color_chip_small_radius_default2"
+ android:layout_gravity="center"
+ android:layout_marginLeft="@dimen/color_seed_chip_margin2"
+ android:layout_marginTop="@dimen/color_seed_chip_margin2"
+ android:src="@drawable/color_chip_seed_filled3"
+ android:importantForAccessibility="no" />
+ </FrameLayout>
+ </FrameLayout>
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/option_bottom_margin"
+ android:textColor="@color/text_color_primary"
+ android:visibility="invisible"
+ android:gravity="center"
+ android:text="Placeholder for stable size calculation, please do not remove."
+ tools:ignore="HardcodedText" />
+</LinearLayout>
+
diff --git a/res/layout/fragment_clock_settings.xml b/res/layout/fragment_clock_settings.xml
index 58232a7..d52ebdf 100644
--- a/res/layout/fragment_clock_settings.xml
+++ b/res/layout/fragment_clock_settings.xml
@@ -18,7 +18,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:clipChildren="false">
+
<FrameLayout
android:id="@+id/section_header_container"
android:layout_width="match_parent"
@@ -31,13 +33,13 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:paddingTop="36dp"
+ android:paddingTop="20dp"
android:paddingBottom="40dp">
<include
android:id="@+id/lock_preview"
layout="@layout/wallpaper_preview_card"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center" />
@@ -48,7 +50,6 @@
android:layout_gravity="center" />
</com.android.wallpaper.picker.DisplayAspectRatioFrameLayout>
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -123,7 +124,7 @@
without changing its size after the content is loaded into the RecyclerView.
-->
<include
- layout="@layout/color_option_2"
+ layout="@layout/clock_color_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible" />
diff --git a/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt b/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt
index b358873..7de45e9 100644
--- a/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt
+++ b/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt
@@ -63,7 +63,7 @@
val colorOptionContainerView: RecyclerView = view.requireViewById(R.id.color_options)
val colorOptionAdapter =
OptionItemAdapter(
- layoutResourceId = R.layout.color_option_2,
+ layoutResourceId = R.layout.clock_color_option,
lifecycleOwner = lifecycleOwner,
bindIcon = { foregroundView: View, colorIcon: ColorOptionIconViewModel ->
val viewGroup = foregroundView as? ViewGroup
diff --git a/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt b/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt
index dd4c968..fc1e018 100644
--- a/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt
+++ b/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt
@@ -85,7 +85,7 @@
.createCurrentWallpaperInfos(
{ homeWallpaper, lockWallpaper, _ ->
continuation.resume(
- homeWallpaper ?: lockWallpaper,
+ lockWallpaper ?: homeWallpaper,
null,
)
},