Commit 331090d1 authored by Hakkı Kaan Çalışkan's avatar Hakkı Kaan Çalışkan Committed by Emily Kager
Browse files

For #12007: Fix add search engine items using wrap content for height

parent 296bdc59
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen

        availableEngines.forEachIndexed(setupSearchEngineItem)

        val engineItem = makeCustomButton(layoutInflater)
        val engineItem = makeCustomButton(layoutInflater, res = resources)
        engineItem.id = CUSTOM_INDEX
        engineItem.radio_button.isChecked = selectedIndex == CUSTOM_INDEX
        engineViews.add(engineItem)
@@ -250,11 +250,12 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen
        toggleCustomForm(selectedIndex == -1)
    }

    private fun makeCustomButton(layoutInflater: LayoutInflater): View {
    private fun makeCustomButton(layoutInflater: LayoutInflater, res: Resources): View {
        val wrapper = layoutInflater
            .inflate(R.layout.custom_search_engine_radio_button, null) as ConstraintLayout
        wrapper.setOnClickListener { wrapper.radio_button.isChecked = true }
        wrapper.radio_button.setOnCheckedChangeListener(this)
        wrapper.minHeight = res.getDimensionPixelSize(R.dimen.radio_button_preference_height)
        return wrapper
    }

@@ -280,6 +281,7 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen
        engineIcon.setBounds(0, 0, iconSize, iconSize)
        wrapper.engine_icon.setImageDrawable(engineIcon)
        wrapper.overflow_menu.visibility = View.GONE
        wrapper.minHeight = res.getDimensionPixelSize(R.dimen.radio_button_preference_height)
        return wrapper
    }

+5 −3
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
        android:textAppearance="?android:attr/textAppearanceListItem"
        android:layout_marginStart="@dimen/search_bar_search_engine_icon_padding"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>
    <TextView
        android:id="@+id/engine_text"
        android:textColor="?primaryText"
@@ -29,8 +30,9 @@
        android:layout_marginStart="@dimen/search_bar_search_icon_margin"
        android:layout_marginEnd="@dimen/radio_button_padding_horizontal"
        android:text="@string/search_add_custom_engine_label_other"
        android:textSize="16sp"
        app:layout_constraintStart_toEndOf="@id/radio_button"
        app:layout_constraintTop_toTopOf="@id/radio_button"
        app:layout_constraintBottom_toBottomOf="@id/radio_button"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>