Fix the layout of the grid option customization (2/2)
Test: Manully tested. See bug.
Bug: 381119451
Flag: EXEMPT bugfix
Change-Id: I4b5189204315cc1c2d133e24a21edef7eeeedfbd
diff --git a/res/layout/fragment_grid.xml b/res/layout/fragment_grid.xml
index e77da57..20c9069 100644
--- a/res/layout/fragment_grid.xml
+++ b/res/layout/fragment_grid.xml
@@ -55,13 +55,12 @@
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="28dp"
android:background="@drawable/picker_fragment_background"
- android:paddingBottom="62dp"
android:clipChildren="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="22dp"
+ android:layout_marginVertical="20dp"
android:clipChildren="false">
<androidx.recyclerview.widget.RecyclerView
diff --git a/res/layout/grid_option.xml b/res/layout/grid_option.xml
index efed018..459584c 100644
--- a/res/layout/grid_option.xml
+++ b/res/layout/grid_option.xml
@@ -47,8 +47,8 @@
<ImageView
android:id="@id/foreground"
- android:layout_width="58dp"
- android:layout_height="58dp"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
android:layout_gravity="center" />
</FrameLayout>
@@ -64,6 +64,7 @@
android:textColor="@color/system_on_surface"
android:singleLine="true"
android:ellipsize="end"
+ android:textSize="12sp"
android:text="Placeholder for stable size calculation, please do not remove."
tools:ignore="HardcodedText" />
diff --git a/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt b/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
index 36d16cd..ae06fff 100644
--- a/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
+++ b/src/com/android/customization/picker/grid/ui/binder/GridScreenBinder.kt
@@ -36,6 +36,9 @@
import kotlinx.coroutines.launch
object GridScreenBinder {
+
+ const val GRID_ITEM_SPACING_DP = 20
+
fun bind(
view: View,
viewModel: GridScreenViewModel,
@@ -47,12 +50,8 @@
) {
val optionView: RecyclerView = view.requireViewById(com.android.wallpaper.R.id.options)
optionView.layoutManager =
- LinearLayoutManager(
- view.context,
- RecyclerView.HORIZONTAL,
- /* reverseLayout= */ false,
- )
- optionView.addItemDecoration(ItemSpacing(ItemSpacing.ITEM_SPACING_DP))
+ LinearLayoutManager(view.context, RecyclerView.HORIZONTAL, /* reverseLayout= */ false)
+ optionView.addItemDecoration(ItemSpacing(GRID_ITEM_SPACING_DP))
val adapter =
OptionItemAdapter(
layoutResourceId = R.layout.grid_option,
@@ -68,7 +67,7 @@
bindIcon = { foregroundView: View, gridIcon: GridIconViewModel ->
val imageView = foregroundView as? ImageView
imageView?.let { GridIconViewBinder.bind(imageView, gridIcon) }
- }
+ },
)
optionView.adapter = adapter