From e51a6d332ec61aee94f516f7770e8a8568130cde Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Sat, 4 Dec 2021 22:52:52 +0700 Subject: [PATCH] SourcePreferencesController: Also call onBindEditText listener set by extension (#6310) --- .../androidx/preference/EditTextPreferenceExtensions.kt | 8 ++++++++ .../extension/details/SourcePreferencesController.kt | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 app/src/main/java/androidx/preference/EditTextPreferenceExtensions.kt diff --git a/app/src/main/java/androidx/preference/EditTextPreferenceExtensions.kt b/app/src/main/java/androidx/preference/EditTextPreferenceExtensions.kt new file mode 100644 index 0000000000..0a3c817e3c --- /dev/null +++ b/app/src/main/java/androidx/preference/EditTextPreferenceExtensions.kt @@ -0,0 +1,8 @@ +package androidx.preference + +/** + * Returns package-private [EditTextPreference.getOnBindEditTextListener] + */ +fun EditTextPreference.getOnBindEditTextListener(): EditTextPreference.OnBindEditTextListener? { + return onBindEditTextListener +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesController.kt index f2b1f81a68..3b726b23da 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesController.kt @@ -19,6 +19,7 @@ import androidx.preference.Preference import androidx.preference.PreferenceGroupAdapter import androidx.preference.PreferenceManager import androidx.preference.PreferenceScreen +import androidx.preference.getOnBindEditTextListener import androidx.recyclerview.widget.LinearLayoutManager import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.SharedPreferencesDataStore @@ -117,7 +118,9 @@ class SourcePreferencesController(bundle: Bundle? = null) : // Apply incognito IME for EditTextPreference if (pref is EditTextPreference) { + val setListener = pref.getOnBindEditTextListener() pref.setOnBindEditTextListener { + setListener?.onBindEditText(it) it.setIncognito(viewScope) } }