* Remove RadioButton drawable applied in runtime * Add default RadioButton layoutmaster
parent
654c2b12df
commit
887102d215
|
@ -14,7 +14,6 @@ import android.view.ViewGroup
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import android.widget.RadioGroup
|
import android.widget.RadioGroup
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceViewHolder
|
import androidx.preference.PreferenceViewHolder
|
||||||
import kotlinx.android.synthetic.main.search_engine_radio_button.view.*
|
import kotlinx.android.synthetic.main.search_engine_radio_button.view.*
|
||||||
|
@ -23,7 +22,6 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import mozilla.components.browser.search.SearchEngine
|
import mozilla.components.browser.search.SearchEngine
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ThemeManager
|
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.utils.Settings
|
import org.mozilla.fenix.utils.Settings
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
@ -119,19 +117,11 @@ abstract class SearchEngineListPreference @JvmOverloads constructor(
|
||||||
val wrapper = layoutInflater.inflate(itemResId, null) as ConstraintLayout
|
val wrapper = layoutInflater.inflate(itemResId, null) as ConstraintLayout
|
||||||
wrapper.setOnClickListener { wrapper.radio_button.isChecked = true }
|
wrapper.setOnClickListener { wrapper.radio_button.isChecked = true }
|
||||||
wrapper.radio_button.setOnCheckedChangeListener(this)
|
wrapper.radio_button.setOnCheckedChangeListener(this)
|
||||||
val buttonItem = wrapper.radio_button
|
|
||||||
wrapper.engine_text.text = engine.name
|
wrapper.engine_text.text = engine.name
|
||||||
val iconSize = res.getDimension(R.dimen.preference_icon_drawable_size).toInt()
|
val iconSize = res.getDimension(R.dimen.preference_icon_drawable_size).toInt()
|
||||||
val engineIcon = BitmapDrawable(res, engine.icon)
|
val engineIcon = BitmapDrawable(res, engine.icon)
|
||||||
engineIcon.setBounds(0, 0, iconSize, iconSize)
|
engineIcon.setBounds(0, 0, iconSize, iconSize)
|
||||||
wrapper.engine_icon.setImageDrawable(engineIcon)
|
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
|
return wrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
android:id="@+id/radio_button"
|
android:id="@+id/radio_button"
|
||||||
android:layout_width="@dimen/search_engine_radio_button_height"
|
android:layout_width="@dimen/search_engine_radio_button_height"
|
||||||
android:layout_height="@dimen/search_engine_radio_button_height"
|
android:layout_height="@dimen/search_engine_radio_button_height"
|
||||||
android:button="@null"
|
|
||||||
android:textAlignment="textStart"
|
android:textAlignment="textStart"
|
||||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
android:layout_marginStart="@dimen/radio_button_padding_horizontal"
|
android:layout_marginStart="@dimen/radio_button_padding_horizontal"
|
||||||
|
|
Loading…
Reference in New Issue