From 3438d722327238746c77ca421b5edd686dbf6e15 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Apr 2020 19:32:52 -0400 Subject: [PATCH] Fix extension setting dialogs not handling duplicate keys (fixes #2876) --- .../tachiyomi/ui/extension/ExtensionDetailsController.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt index faedb06e1e..c8075de4f3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt @@ -210,8 +210,11 @@ class ExtensionDetailsController(bundle: Bundle? = null) : f.showDialog(router) } + @Suppress("UNCHECKED_CAST") override fun findPreference(key: CharSequence): T? { - return preferenceScreen!!.findPreference(key) + // We track [lastOpenPreferencePosition] when displaying the dialog + // [key] isn't useful since there may be duplicates + return preferenceScreen!!.getPreference(lastOpenPreferencePosition!!) as T } override fun loginDialogClosed(source: LoginSource) {