Merge "Fixes touch targets for several tabs in ThemePicker" into udc-dev
diff --git a/res/layout/clock_color_option.xml b/res/layout/clock_color_option.xml
index 4203a39..f27c13d 100644
--- a/res/layout/clock_color_option.xml
+++ b/res/layout/clock_color_option.xml
@@ -21,72 +21,8 @@
     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>
+    <include layout="@layout/color_option_2"/>
 
     <TextView
         android:id="@+id/text"
diff --git a/res/layout/color_option_2.xml b/res/layout/color_option_2.xml
index 8bacd99..dff03d0 100644
--- a/res/layout/color_option_2.xml
+++ b/res/layout/color_option_2.xml
@@ -16,7 +16,6 @@
 <!-- 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"
@@ -48,16 +47,5 @@
             android:layout_height="match_parent"
             android:layout_margin="@dimen/color_seed_chip_margin2"/>
     </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="gone"
-        android:gravity="center"
-        android:text="Placeholder for stable size calculation, please do not remove."
-        tools:ignore="HardcodedText" />
 </LinearLayout>
 
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 921151b..4a8ebeb 100644
--- a/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt
+++ b/src/com/android/customization/picker/clock/ui/binder/ClockSettingsBinder.kt
@@ -133,7 +133,7 @@
                                 val item =
                                     LayoutInflater.from(view.context)
                                         .inflate(
-                                            R.layout.color_option_2,
+                                            R.layout.clock_color_option,
                                             colorOptionContainerListView,
                                             false,
                                         ) as LinearLayout
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 88d6d8e..7edaecf 100644
--- a/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt
+++ b/src/com/android/customization/picker/clock/ui/fragment/ClockSettingsFragment.kt
@@ -79,7 +79,7 @@
                                     R.string.lock_screen_preview_provider_authority,
                                 ),
                         ),
-                    wallpaperInfoProvider = {
+                    wallpaperInfoProvider = { forceReload ->
                         suspendCancellableCoroutine { continuation ->
                             injector
                                 .getCurrentWallpaperInfoFactory(context)
@@ -90,7 +90,7 @@
                                             null,
                                         )
                                     },
-                                    /* forceRefresh= */ true,
+                                    forceReload,
                                 )
                         }
                     },
@@ -134,6 +134,10 @@
     }
 
     override fun getDefaultTitle(): CharSequence {
-        return requireContext().getString(R.string.clock_settings_title)
+        return requireContext().getString(R.string.clock_color_and_size_title)
+    }
+
+    override fun getToolbarColorId(): Int {
+        return android.R.color.transparent
     }
 }
diff --git a/src/com/android/customization/picker/color/ColorPickerFragment.kt b/src/com/android/customization/picker/color/ColorPickerFragment.kt
deleted file mode 100644
index c8ecb7f..0000000
--- a/src/com/android/customization/picker/color/ColorPickerFragment.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package com.android.customization.picker.color
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import com.android.wallpaper.R
-import com.android.wallpaper.picker.AppbarFragment
-
-// TODO (b/262924623): Color Picker Fragment
-class ColorPickerFragment : AppbarFragment() {
-    override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
-    ): View {
-        val view =
-            inflater.inflate(
-                R.layout.fragment_color_picker,
-                container,
-                false,
-            )
-        setUpToolbar(view)
-        return view
-    }
-}
diff --git a/src/com/android/customization/picker/color/ui/fragment/ColorPickerFragment.kt b/src/com/android/customization/picker/color/ui/fragment/ColorPickerFragment.kt
index 23ad037..ef38f8b 100644
--- a/src/com/android/customization/picker/color/ui/fragment/ColorPickerFragment.kt
+++ b/src/com/android/customization/picker/color/ui/fragment/ColorPickerFragment.kt
@@ -98,13 +98,13 @@
                                         R.string.lock_screen_preview_provider_authority,
                                     ),
                         ),
-                    wallpaperInfoProvider = {
+                    wallpaperInfoProvider = { forceReload ->
                         suspendCancellableCoroutine { continuation ->
                             wallpaperInfoFactory.createCurrentWallpaperInfos(
                                 { homeWallpaper, lockWallpaper, _ ->
                                     continuation.resume(lockWallpaper ?: homeWallpaper, null)
                                 },
-                                /* forceRefresh= */ true,
+                                forceReload,
                             )
                         }
                     },
@@ -133,13 +133,13 @@
                                         R.string.grid_control_metadata_name,
                                     ),
                         ),
-                    wallpaperInfoProvider = {
+                    wallpaperInfoProvider = { forceReload ->
                         suspendCancellableCoroutine { continuation ->
                             wallpaperInfoFactory.createCurrentWallpaperInfos(
                                 { homeWallpaper, lockWallpaper, _ ->
                                     continuation.resume(homeWallpaper ?: lockWallpaper, null)
                                 },
-                                /* forceRefresh= */ true,
+                                forceReload,
                             )
                         }
                     },
diff --git a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
index 0a52e8f..8a8bb20 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
@@ -91,13 +91,13 @@
                     )
                 }
             },
-            wallpaperInfoProvider = {
+            wallpaperInfoProvider = { forceReload ->
                 suspendCancellableCoroutine { continuation ->
                     wallpaperInfoFactory.createCurrentWallpaperInfos(
                         { homeWallpaper, lockWallpaper, _ ->
                             continuation.resume(lockWallpaper ?: homeWallpaper, null)
                         },
-                        /* forceRefresh= */ true,
+                        forceReload,
                     )
                 }
             },