Merge changes I7af876ab,Idd79864d into tm-qpr-dev am: b968c7a46e

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/21063811

Change-Id: Ibc3630254a522713c057fd3baacb5d9c4a7bc48b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/drawable/picker_fragment_tab_background.xml b/res/drawable/picker_fragment_tab_background.xml
index 3fbced3..3dad344 100644
--- a/res/drawable/picker_fragment_tab_background.xml
+++ b/res/drawable/picker_fragment_tab_background.xml
@@ -15,6 +15,6 @@
 -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <corners android:radius="50dp" />
+    <corners android:radius="12dp" />
     <solid android:color="@color/keyguard_quick_affordance_slot_tab_background_color" />
 </shape>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index af8dfe1..5da2c33 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -272,18 +272,18 @@
     <string name="adaptive_color_title">Dynamic</string>
 
     <!--
-    Name of the slot on the "start" side of the bottom of the lock screen, where quick affordance
-    buttons can be added to the lock screen. In left-to-right languages, this is the left-hand side
-    button. In right-to-left languages, this is the right-hand side button. [CHAR LIMIT=16].
+    Name of the slot on the "start" side of the bottom of the lock screen, where lock screen
+    shortcuts can be added to the lock screen. In left-to-right languages, this is the left-hand
+    side button. In right-to-left languages, this is the right-hand side button. [CHAR LIMIT=16].
     -->
-    <string name="keyguard_slot_name_bottom_start">Left</string>
+    <string name="keyguard_slot_name_bottom_start">Left shortcut</string>
 
     <!--
-    Name of the slot on the "end" side of the bottom of the lock screen, where quick affordance
-    buttons can be added to the lock screen. In left-to-right languages, this is the right-hand side
-    button. In right-to-left languages, this is the left-hand side button. [CHAR LIMIT=16].
+    Name of the slot on the "end" side of the bottom of the lock screen, where lock screen shortcuts
+    can be added to the lock screen. In left-to-right languages, this is the right-hand side button.
+    In right-to-left languages, this is the left-hand side button. [CHAR LIMIT=16].
     -->
-    <string name="keyguard_slot_name_bottom_end">Right</string>
+    <string name="keyguard_slot_name_bottom_end">Right shortcut</string>
 
     <!--
     Name for an option to have no quick affordance selected for one of the sides of the lock
diff --git a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePickerBinder.kt b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePickerBinder.kt
index 57e9401..74d38b1 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePickerBinder.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePickerBinder.kt
@@ -54,12 +54,12 @@
         slotTabView.adapter = slotTabAdapter
         slotTabView.layoutManager =
             LinearLayoutManager(view.context, RecyclerView.HORIZONTAL, false)
-        slotTabView.addItemDecoration(ItemSpacing())
+        slotTabView.addItemDecoration(ItemSpacing(SLOT_TAB_ITEM_SPACING_DP))
         val affordancesAdapter = AffordancesAdapter()
         affordancesView.adapter = affordancesAdapter
         affordancesView.layoutManager =
             LinearLayoutManager(view.context, RecyclerView.HORIZONTAL, false)
-        affordancesView.addItemDecoration(ItemSpacing())
+        affordancesView.addItemDecoration(ItemSpacing(AFFORDANCE_ITEM_SPACING_DP))
 
         var dialog: Dialog? = null
 
@@ -108,27 +108,29 @@
         )
     }
 
-    private class ItemSpacing : RecyclerView.ItemDecoration() {
+    private class ItemSpacing(
+        private val itemSpacingDp: Int,
+    ) : RecyclerView.ItemDecoration() {
         override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
             val addSpacingToStart = itemPosition > 0
             val addSpacingToEnd = itemPosition < (parent.adapter?.itemCount ?: 0) - 1
             val isRtl = parent.layoutManager?.layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL
             val density = parent.context.resources.displayMetrics.density
+            val halfItemSpacingPx = itemSpacingDp.toPx(density) / 2
             if (!isRtl) {
-                outRect.left = if (addSpacingToStart) ITEM_SPACING_DP.toPx(density) else 0
-                outRect.right = if (addSpacingToEnd) ITEM_SPACING_DP.toPx(density) else 0
+                outRect.left = if (addSpacingToStart) halfItemSpacingPx else 0
+                outRect.right = if (addSpacingToEnd) halfItemSpacingPx else 0
             } else {
-                outRect.left = if (addSpacingToEnd) ITEM_SPACING_DP.toPx(density) else 0
-                outRect.right = if (addSpacingToStart) ITEM_SPACING_DP.toPx(density) else 0
+                outRect.left = if (addSpacingToEnd) halfItemSpacingPx else 0
+                outRect.right = if (addSpacingToStart) halfItemSpacingPx else 0
             }
         }
 
         private fun Int.toPx(density: Float): Int {
             return (this * density).toInt()
         }
-
-        companion object {
-            private const val ITEM_SPACING_DP = 8
-        }
     }
+
+    private const val SLOT_TAB_ITEM_SPACING_DP = 12
+    private const val AFFORDANCE_ITEM_SPACING_DP = 8
 }