浏览代码

Fix extension setting dialogs not handling duplicate keys (fixes #2876)

arkon 5 年之前
父节点
当前提交
c2330fe3af
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt

+ 4 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt

@@ -191,8 +191,11 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
         f.showDialog(router)
         f.showDialog(router)
     }
     }
 
 
+    @Suppress("UNCHECKED_CAST")
     override fun <T : Preference> findPreference(key: CharSequence): T? {
     override fun <T : Preference> 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 {
     private companion object {