Bug/2513 edit text preference crash (#2522)

* use themedContext for preference

* use inflater with themed context
remove icon space

* v14 preferenceThemes are deprecated
This commit is contained in:
MCAxiaz 2020-01-20 15:37:42 -08:00 committed by Jay
parent 44aae85493
commit 33836ba049
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -26,7 +26,7 @@
<!-- Themes -->
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/Theme.ActionBar.Light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.Light</item>
@ -90,7 +90,7 @@
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="md_background_color">@color/dialogDark</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>