From c2330fe3af3cd48f771f353c3bc8e2c615a13354 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 134ee3f47..8936b6222 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 @@ -191,8 +191,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 } private companion object {