Filters> Tabs: use checkbox instead of switch (#3927)
Nowhere else in the preferences are checkboxes used. Also removed the now unused extension function. Fixes #3535
This commit is contained in:
parent
ef8afe02b6
commit
a84d7f56a0
|
@ -19,9 +19,9 @@ import android.os.Bundle
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.settings.PrefKeys
|
import com.keylesspalace.tusky.settings.PrefKeys
|
||||||
import com.keylesspalace.tusky.settings.checkBoxPreference
|
|
||||||
import com.keylesspalace.tusky.settings.makePreferenceScreen
|
import com.keylesspalace.tusky.settings.makePreferenceScreen
|
||||||
import com.keylesspalace.tusky.settings.preferenceCategory
|
import com.keylesspalace.tusky.settings.preferenceCategory
|
||||||
|
import com.keylesspalace.tusky.settings.switchPreference
|
||||||
|
|
||||||
class TabFilterPreferencesFragment : PreferenceFragmentCompat() {
|
class TabFilterPreferencesFragment : PreferenceFragmentCompat() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
|
@ -29,14 +29,14 @@ class TabFilterPreferencesFragment : PreferenceFragmentCompat() {
|
||||||
preferenceCategory(R.string.title_home) { category ->
|
preferenceCategory(R.string.title_home) { category ->
|
||||||
category.isIconSpaceReserved = false
|
category.isIconSpaceReserved = false
|
||||||
|
|
||||||
checkBoxPreference {
|
switchPreference {
|
||||||
setTitle(R.string.pref_title_show_boosts)
|
setTitle(R.string.pref_title_show_boosts)
|
||||||
key = PrefKeys.TAB_FILTER_HOME_BOOSTS
|
key = PrefKeys.TAB_FILTER_HOME_BOOSTS
|
||||||
setDefaultValue(true)
|
setDefaultValue(true)
|
||||||
isIconSpaceReserved = false
|
isIconSpaceReserved = false
|
||||||
}
|
}
|
||||||
|
|
||||||
checkBoxPreference {
|
switchPreference {
|
||||||
setTitle(R.string.pref_title_show_replies)
|
setTitle(R.string.pref_title_show_replies)
|
||||||
key = PrefKeys.TAB_FILTER_HOME_REPLIES
|
key = PrefKeys.TAB_FILTER_HOME_REPLIES
|
||||||
setDefaultValue(true)
|
setDefaultValue(true)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import androidx.activity.result.ActivityResultRegistryOwner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.preference.CheckBoxPreference
|
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
|
@ -86,15 +85,6 @@ inline fun PreferenceParent.validatedEditTextPreference(
|
||||||
return pref
|
return pref
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun PreferenceParent.checkBoxPreference(
|
|
||||||
builder: CheckBoxPreference.() -> Unit
|
|
||||||
): CheckBoxPreference {
|
|
||||||
val pref = CheckBoxPreference(context)
|
|
||||||
builder(pref)
|
|
||||||
addPref(pref)
|
|
||||||
return pref
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fun PreferenceParent.preferenceCategory(
|
inline fun PreferenceParent.preferenceCategory(
|
||||||
@StringRes title: Int? = null,
|
@StringRes title: Int? = null,
|
||||||
builder: PreferenceParent.(PreferenceCategory) -> Unit
|
builder: PreferenceParent.(PreferenceCategory) -> Unit
|
||||||
|
|
Loading…
Reference in New Issue