From 47723042c50344aaa8bd8af8cb3c2ab69a03ef90 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 6 Jan 2022 22:53:54 -0500 Subject: [PATCH] Fallback to preference title if dialog title isn't set --- app/build.gradle.kts | 2 +- .../tachiyomi/util/preference/PreferenceDSL.kt | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index dc80b98034..5469a9b9c3 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -248,7 +248,7 @@ dependencies { val conductorVersion = "3.1.1" implementation("com.bluelinelabs:conductor:$conductorVersion") implementation("com.bluelinelabs:conductor-viewpager:$conductorVersion") - implementation("com.github.tachiyomiorg:conductor-support-preference:$conductorVersion") + implementation("com.github.tachiyomiorg:conductor-support-preference:3.1.2") // FlowBinding val flowbindingVersion = "1.2.0" diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt index e978ea6bf2..58b2ea9a31 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt @@ -5,7 +5,6 @@ import androidx.appcompat.content.res.AppCompatResources import androidx.biometric.BiometricPrompt import androidx.fragment.app.FragmentActivity import androidx.preference.CheckBoxPreference -import androidx.preference.DialogPreference import androidx.preference.EditTextPreference import androidx.preference.ListPreference import androidx.preference.MultiSelectListPreference @@ -66,19 +65,19 @@ inline fun PreferenceGroup.checkBoxPreference(block: (@DSL CheckBoxPreference).( } inline fun PreferenceGroup.editTextPreference(block: (@DSL EditTextPreference).() -> Unit): EditTextPreference { - return initThenAdd(EditTextPreference(context), block).also(::initDialog) + return initThenAdd(EditTextPreference(context), block) } inline fun PreferenceGroup.listPreference(block: (@DSL ListPreference).() -> Unit): ListPreference { - return initThenAdd(ListPreference(context), block).also(::initDialog) + return initThenAdd(ListPreference(context), block) } inline fun PreferenceGroup.intListPreference(block: (@DSL IntListPreference).() -> Unit): IntListPreference { - return initThenAdd(IntListPreference(context), block).also(::initDialog) + return initThenAdd(IntListPreference(context), block) } inline fun PreferenceGroup.multiSelectListPreference(block: (@DSL MultiSelectListPreference).() -> Unit): MultiSelectListPreference { - return initThenAdd(MultiSelectListPreference(context), block).also(::initDialog) + return initThenAdd(MultiSelectListPreference(context), block) } inline fun PreferenceScreen.preferenceCategory(block: (@DSL PreferenceCategory).() -> Unit): PreferenceCategory { @@ -89,14 +88,6 @@ inline fun PreferenceScreen.preferenceScreen(block: (@DSL PreferenceScreen).() - return addThenInit(preferenceManager.createPreferenceScreen(context), block) } -fun initDialog(dialogPreference: DialogPreference) { - with(dialogPreference) { - if (dialogTitle == null) { - dialogTitle = title - } - } -} - inline fun

PreferenceGroup.add(p: P): P { return p.apply { this.isIconSpaceReserved = false