From 33836ba049f467eb9e837c6fce4ee5503fa44893 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 5a0e65c2d0..b5b362eeb2 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 @@ -53,7 +53,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 { @@ -88,7 +90,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 @@ -155,6 +157,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.fragment = "source_${source.id}" 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 759803c936..6b27500ba7 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -26,7 +26,7 @@ true @style/Theme.ActionBar.Light - @style/PreferenceThemeOverlay.v14.Material + @style/PreferenceThemeOverlay @style/Theme.AlertDialog.Light @@ -90,7 +90,7 @@ true @style/ThemeOverlay.AppCompat.Dark.ActionBar @style/ThemeOverlay.AppCompat - @style/PreferenceThemeOverlay.v14.Material + @style/PreferenceThemeOverlay @color/dialogDark @style/Theme.AlertDialog.Dark