Fix crash for bound intListPreferences

This commit is contained in:
arkon 2021-12-26 15:44:34 -05:00
parent f3718257f5
commit 2db2b7348d

View File

@ -128,6 +128,12 @@ inline fun <T> Preference.bindTo(preference: com.tfcporciuncula.flow.Preference<
defaultValue = preference.defaultValue
}
inline fun <T> ListPreference.bindTo(preference: com.tfcporciuncula.flow.Preference<T>) {
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 }
}