Correctly update full application theme on night mode change

This commit is contained in:
SpiritCroc 2020-06-15 16:01:55 +02:00
parent 0ba49f5596
commit 6b1c75dae4
2 changed files with 3 additions and 3 deletions

View File

@ -37,11 +37,10 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
Timber.v("## onConfigurationChanged(): the locale has been updated to ${Locale.getDefault()}") Timber.v("## onConfigurationChanged(): the locale has been updated to ${Locale.getDefault()}")
Timber.v("## onConfigurationChanged(): restore the expected value ${VectorLocale.applicationLocale}") Timber.v("## onConfigurationChanged(): restore the expected value ${VectorLocale.applicationLocale}")
Locale.setDefault(VectorLocale.applicationLocale) Locale.setDefault(VectorLocale.applicationLocale)
ThemeUtils.invalidateNightMode()
} }
if (ThemeUtils.useDarkTheme(context) != ThemeUtils.shouldUseDarkTheme(context)) { if (ThemeUtils.useDarkTheme(context) != ThemeUtils.shouldUseDarkTheme(context)) {
Timber.v("## onConfigurationChanged(): night mode has changed") Timber.v("## onConfigurationChanged(): night mode has changed")
ThemeUtils.invalidateNightMode() ThemeUtils.invalidateNightMode(context)
} }
} }

View File

@ -68,8 +68,9 @@ object ThemeUtils {
return mUseDarkTheme return mUseDarkTheme
} }
fun invalidateNightMode() { fun invalidateNightMode(context: Context) {
mThemeInitialized = false; mThemeInitialized = false;
setApplicationTheme(context.applicationContext, getApplicationLightTheme(context), getApplicationDarkTheme(context))
} }
/** /**