From 7f5e6507964090066eebcdbee0707bbbd7ba0c64 Mon Sep 17 00:00:00 2001 From: MCAxiaz Date: Mon, 20 Jan 2020 15:37:42 -0800 Subject: [PATCH] Bug/2513 edit text preference crash (#2522) * use themedContext for preference * use inflater with themed context remove icon space * v14 preferenceThemes are deprecated --- .../tachiyomi/ui/extension/ExtensionDetailsController.kt | 7 +++++-- app/src/main/res/values/themes.xml | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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 73afc46810..461e7b6d9c 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 @@ -42,7 +42,9 @@ class ExtensionDetailsController(bundle: Bundle? = null) : }) override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { - return inflater.inflate(R.layout.extension_detail_controller, container, false) + val themedInflater = inflater.cloneInContext(getPreferenceThemeContext()) + + return themedInflater.inflate(R.layout.extension_detail_controller, container, false) } override fun createPresenter(): ExtensionDetailsPresenter { @@ -77,7 +79,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : val manager = PreferenceManager(themedContext) manager.preferenceDataStore = EmptyPreferenceDataStore() manager.onDisplayPreferenceDialogListener = this - val screen = manager.createPreferenceScreen(context) + val screen = manager.createPreferenceScreen(themedContext) preferenceScreen = screen val multiSource = extension.sources.size > 1 @@ -142,6 +144,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : // Reparent the preferences while (newScreen.preferenceCount != 0) { val pref = newScreen.getPreference(0) + pref.isIconSpaceReserved = false pref.preferenceDataStore = dataStore pref.order = Int.MAX_VALUE // reset to default order diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 3f3c35a4be..90cedbda08 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -27,7 +27,7 @@ true @style/Theme.ActionBar.Light - @style/PreferenceThemeOverlay.v14.Material + @style/PreferenceThemeOverlay @style/Theme.AlertDialog.Light @@ -74,7 +74,7 @@ true @style/ThemeOverlay.AppCompat.Dark.ActionBar @style/ThemeOverlay.AppCompat - @style/PreferenceThemeOverlay.v14.Material + @style/PreferenceThemeOverlay @color/dialogDark @style/Theme.AlertDialog.Dark