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 arkon
parent c22e2e8159
commit 7f5e650796
2 changed files with 7 additions and 4 deletions

View File

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

View File

@ -27,7 +27,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>
@ -74,7 +74,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>