From a84d7f56a0dc0d09e8b1690c4201a68d930d0264 Mon Sep 17 00:00:00 2001 From: Angelo Suzuki <1063155+tinsukE@users.noreply.github.com> Date: Sun, 6 Aug 2023 11:50:11 +0200 Subject: [PATCH] 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 --- .../preference/TabFilterPreferencesFragment.kt | 6 +++--- .../com/keylesspalace/tusky/settings/SettingsDSL.kt | 10 ---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/preference/TabFilterPreferencesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/preference/TabFilterPreferencesFragment.kt index 023905291..375922b3c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/preference/TabFilterPreferencesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/preference/TabFilterPreferencesFragment.kt @@ -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) diff --git a/app/src/main/java/com/keylesspalace/tusky/settings/SettingsDSL.kt b/app/src/main/java/com/keylesspalace/tusky/settings/SettingsDSL.kt index 720dc817f..cb8b13e67 100644 --- a/app/src/main/java/com/keylesspalace/tusky/settings/SettingsDSL.kt +++ b/app/src/main/java/com/keylesspalace/tusky/settings/SettingsDSL.kt @@ -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