SourcePreferencesController: Also call onBindEditText listener set by extension (#6310)

This commit is contained in:
Ivan Iskandar 2021-12-04 22:52:52 +07:00 committed by GitHub
parent a9d2741e6a
commit e51a6d332e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,8 @@
package androidx.preference
/**
* Returns package-private [EditTextPreference.getOnBindEditTextListener]
*/
fun EditTextPreference.getOnBindEditTextListener(): EditTextPreference.OnBindEditTextListener? {
return onBindEditTextListener
}

View file

@ -19,6 +19,7 @@ import androidx.preference.Preference
import androidx.preference.PreferenceGroupAdapter import androidx.preference.PreferenceGroupAdapter
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import androidx.preference.getOnBindEditTextListener
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.SharedPreferencesDataStore import eu.kanade.tachiyomi.data.preference.SharedPreferencesDataStore
@ -117,7 +118,9 @@ class SourcePreferencesController(bundle: Bundle? = null) :
// Apply incognito IME for EditTextPreference // Apply incognito IME for EditTextPreference
if (pref is EditTextPreference) { if (pref is EditTextPreference) {
val setListener = pref.getOnBindEditTextListener()
pref.setOnBindEditTextListener { pref.setOnBindEditTextListener {
setListener?.onBindEditText(it)
it.setIncognito(viewScope) it.setIncognito(viewScope)
} }
} }