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:
Angelo Suzuki 2023-08-06 11:50:11 +02:00 committed by GitHub
parent ef8afe02b6
commit a84d7f56a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 13 deletions

View File

@ -19,9 +19,9 @@ import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.settings.PrefKeys
import com.keylesspalace.tusky.settings.checkBoxPreference
import com.keylesspalace.tusky.settings.makePreferenceScreen
import com.keylesspalace.tusky.settings.preferenceCategory
import com.keylesspalace.tusky.settings.switchPreference
class TabFilterPreferencesFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -29,14 +29,14 @@ class TabFilterPreferencesFragment : PreferenceFragmentCompat() {
preferenceCategory(R.string.title_home) { category ->
category.isIconSpaceReserved = false
checkBoxPreference {
switchPreference {
setTitle(R.string.pref_title_show_boosts)
key = PrefKeys.TAB_FILTER_HOME_BOOSTS
setDefaultValue(true)
isIconSpaceReserved = false
}
checkBoxPreference {
switchPreference {
setTitle(R.string.pref_title_show_replies)
key = PrefKeys.TAB_FILTER_HOME_REPLIES
setDefaultValue(true)

View File

@ -6,7 +6,6 @@ import androidx.activity.result.ActivityResultRegistryOwner
import androidx.annotation.StringRes
import androidx.core.widget.doAfterTextChanged
import androidx.lifecycle.LifecycleOwner
import androidx.preference.CheckBoxPreference
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.Preference
@ -86,15 +85,6 @@ inline fun PreferenceParent.validatedEditTextPreference(
return pref
}
inline fun PreferenceParent.checkBoxPreference(
builder: CheckBoxPreference.() -> Unit
): CheckBoxPreference {
val pref = CheckBoxPreference(context)
builder(pref)
addPref(pref)
return pref
}
inline fun PreferenceParent.preferenceCategory(
@StringRes title: Int? = null,
builder: PreferenceParent.(PreferenceCategory) -> Unit