Fix color option update animation

When changing tabs in color picker, the recycler view color options are
replaced with a new list, with item animation. This animation is
proceeded by an undesirable shift in the options, due to the fact that
item decoration is set on the items, and this decoration is removed
before animating. Since we only need edge item spacing, we can remove
the item decoration and set padding on the recycler view instead, and
keep clip children as false. This achieves the same layout without
animation jank.

Flag: com.android.systemui.shared.new_customization_picker_ui
Bug: 376295026
Test: manually verified, see bug
Change-Id: I2efa16ca81a5126ff7b7a9d8398a24948b1842f2
diff --git a/res/layout/floating_sheet_colors.xml b/res/layout/floating_sheet_colors.xml
index 9a27a6c..1cc0583 100644
--- a/res/layout/floating_sheet_colors.xml
+++ b/res/layout/floating_sheet_colors.xml
@@ -45,6 +45,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginBottom="12dp"
+            android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding"
             android:clipChildren="false"
             android:clipToPadding="false" />
 
diff --git a/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
index 30e4f9a..4f5adab 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
@@ -16,7 +16,6 @@
 
 package com.android.wallpaper.customization.ui.binder
 
-import android.content.Context
 import android.content.res.Configuration.UI_MODE_NIGHT_MASK
 import android.content.res.Configuration.UI_MODE_NIGHT_YES
 import android.view.View
@@ -32,7 +31,6 @@
 import com.android.customization.picker.color.ui.binder.ColorOptionIconBinder2
 import com.android.customization.picker.color.ui.view.ColorOptionIconView2
 import com.android.customization.picker.color.ui.viewmodel.ColorOptionIconViewModel
-import com.android.customization.picker.common.ui.view.SingleRowListItemSpacing
 import com.android.customization.picker.mode.ui.binder.DarkModeBinder
 import com.android.themepicker.R
 import com.android.wallpaper.customization.ui.util.ThemePickerCustomizationOptionUtil.ThemePickerHomeCustomizationOption.COLORS
@@ -98,8 +96,14 @@
                 lifecycleOwner = lifecycleOwner,
             )
         val colorsList =
-            view.requireViewById<RecyclerView>(R.id.colors_horizontal_list).also {
-                it.initColorsList(view.context.applicationContext, colorsAdapter)
+            view.requireViewById<RecyclerView>(R.id.colors_horizontal_list).apply {
+                adapter = colorsAdapter
+                layoutManager =
+                    LinearLayoutManager(
+                        view.context.applicationContext,
+                        LinearLayoutManager.HORIZONTAL,
+                        false,
+                    )
             }
 
         DarkModeBinder.bind(
@@ -162,22 +166,4 @@
             colorUpdateViewModel = WeakReference(colorUpdateViewModel),
             shouldAnimateColor = shouldAnimateColor,
         )
-
-    private fun RecyclerView.initColorsList(
-        context: Context,
-        adapter: OptionItemAdapter2<ColorOptionIconViewModel>,
-    ) {
-        apply {
-            this.adapter = adapter
-            layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
-            addItemDecoration(
-                SingleRowListItemSpacing(
-                    context.resources.getDimensionPixelSize(
-                        R.dimen.floating_sheet_content_horizontal_padding
-                    ),
-                    0,
-                )
-            )
-        }
-    }
 }