Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d43457e authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix layout of the grid option customization (2/2)" into main

parents 2de50a18 72781287
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -54,24 +54,23 @@
        android:orientation="vertical"
        android:layout_marginHorizontal="24dp"
        android:layout_marginBottom="28dp"
        android:background="@drawable/picker_fragment_background"
        android:paddingBottom="62dp"
        android:clipChildren="false">
        android:background="@drawable/picker_fragment_background">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="22dp"
            android:clipChildren="false">
            android:paddingVertical="20dp"
            android:clipChildren="false"
            android:clipToPadding="false">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@id/options"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:clipToPadding="false"
                android:paddingHorizontal="16dp"
                android:clipChildren="false" />
                android:clipChildren="false"
                android:clipToPadding="false"/>

            <!--
            This is just an invisible placeholder put in place so that the parent keeps its height
+3 −2
Original line number Diff line number Diff line
@@ -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" />

+6 −7
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.launch

object GridScreenBinder {

    const val GRID_ITEM_SPACING_DP = 20

    fun bind(
        view: View,
        viewModel: GridScreenViewModel,
@@ -47,12 +50,8 @@ object GridScreenBinder {
    ) {
        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 @@ object GridScreenBinder {
                bindIcon = { foregroundView: View, gridIcon: GridIconViewModel ->
                    val imageView = foregroundView as? ImageView
                    imageView?.let { GridIconViewBinder.bind(imageView, gridIcon) }
                }
                },
            )
        optionView.adapter = adapter