1
0
Fork 0

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

master
Hakkı Kaan Çalışkan 2020-07-03 12:27:40 +03:00 committed by Emily Kager
parent 296bdc5967
commit 331090d1e6
2 changed files with 9 additions and 5 deletions

View File

@ -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
}

View File

@ -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>