Fix changing inactive theme

Bug introduced in commit 65716c0ee8.

Fixes:
- Change inactive theme
- Switch to inactive theme -> still the old theme setting

Change-Id: I1b56144ffdb5e0f33efa67702e8aa05065285488
This commit is contained in:
SpiritCroc 2020-10-17 16:50:43 +02:00
parent db7a82f567
commit 863f07cbe4
1 changed files with 2 additions and 2 deletions

View File

@ -56,8 +56,8 @@ class VectorSettingsPreferencesFragment @Inject constructor(
val darkThemePref = findPreference<VectorListPreference>(ThemeUtils.APPLICATION_DARK_THEME_KEY)!! val darkThemePref = findPreference<VectorListPreference>(ThemeUtils.APPLICATION_DARK_THEME_KEY)!!
lightThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> lightThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue is String) { if (newValue is String) {
ThemeUtils.setApplicationLightTheme(requireContext().applicationContext, newValue)
if (!ThemeUtils.shouldUseDarkTheme(requireContext())) { if (!ThemeUtils.shouldUseDarkTheme(requireContext())) {
ThemeUtils.setApplicationLightTheme(requireContext().applicationContext, newValue)
// Restart the Activity // Restart the Activity
activity?.restart() activity?.restart()
} }
@ -70,8 +70,8 @@ class VectorSettingsPreferencesFragment @Inject constructor(
lightThemePref.title = getString(R.string.settings_light_theme) lightThemePref.title = getString(R.string.settings_light_theme)
darkThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> darkThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue is String) { if (newValue is String) {
ThemeUtils.setApplicationDarkTheme(requireContext().applicationContext, newValue)
if (ThemeUtils.shouldUseDarkTheme(requireContext())) { if (ThemeUtils.shouldUseDarkTheme(requireContext())) {
ThemeUtils.setApplicationDarkTheme(requireContext().applicationContext, newValue)
// Restart the Activity // Restart the Activity
activity?.restart() activity?.restart()
} }