2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

For #3645: Fix search engine selection (#3665)

* Remove RadioButton drawable applied in runtime

* Add default RadioButton layout
This commit is contained in:
Weverson Nascimento 2019-07-01 13:08:58 -03:00 committed by Colin Lee
parent 654c2b12df
commit 887102d215
2 changed files with 0 additions and 11 deletions

View File

@ -14,7 +14,6 @@ import android.view.ViewGroup
import android.widget.CompoundButton
import android.widget.RadioGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import kotlinx.android.synthetic.main.search_engine_radio_button.view.*
@ -23,7 +22,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import mozilla.components.browser.search.SearchEngine
import org.mozilla.fenix.R
import org.mozilla.fenix.ThemeManager
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.utils.Settings
import kotlin.coroutines.CoroutineContext
@ -119,19 +117,11 @@ abstract class SearchEngineListPreference @JvmOverloads constructor(
val wrapper = layoutInflater.inflate(itemResId, null) as ConstraintLayout
wrapper.setOnClickListener { wrapper.radio_button.isChecked = true }
wrapper.radio_button.setOnCheckedChangeListener(this)
val buttonItem = wrapper.radio_button
wrapper.engine_text.text = engine.name
val iconSize = res.getDimension(R.dimen.preference_icon_drawable_size).toInt()
val engineIcon = BitmapDrawable(res, engine.icon)
engineIcon.setBounds(0, 0, iconSize, iconSize)
wrapper.engine_icon.setImageDrawable(engineIcon)
val attr =
ThemeManager.resolveAttribute(android.R.attr.listChoiceIndicatorSingle, context)
val buttonDrawable = ContextCompat.getDrawable(context, attr)
buttonDrawable.apply {
this?.setBounds(0, 0, this.intrinsicWidth, this.intrinsicHeight)
}
buttonItem.setCompoundDrawablesRelative(buttonDrawable, null, null, null)
return wrapper
}

View File

@ -14,7 +14,6 @@
android:id="@+id/radio_button"
android:layout_width="@dimen/search_engine_radio_button_height"
android:layout_height="@dimen/search_engine_radio_button_height"
android:button="@null"
android:textAlignment="textStart"
android:textAppearance="?android:attr/textAppearanceListItem"
android:layout_marginStart="@dimen/radio_button_padding_horizontal"