From 2db2b7348d470c53485839718ccb0325b44fcd57 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 26 Dec 2021 15:44:34 -0500 Subject: [PATCH] Fix crash for bound intListPreferences --- .../eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt | 6 ++++++ 1 file changed, 6 insertions(+) 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 644f6a15c..e978ea6bf 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 @@ -128,6 +128,12 @@ inline fun Preference.bindTo(preference: com.tfcporciuncula.flow.Preference< defaultValue = preference.defaultValue } +inline fun ListPreference.bindTo(preference: com.tfcporciuncula.flow.Preference) { + key = preference.key + // ListPreferences persist values as strings, even when we're using our IntListPreference + defaultValue = preference.defaultValue.toString() +} + inline fun Preference.onClick(crossinline block: () -> Unit) { setOnPreferenceClickListener { block(); true } }