From 1231e6b0aaadb9c0db5de40296689fe9d4f1ecad Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Thu, 8 Oct 2020 16:05:07 +0200 Subject: [PATCH] Don't invalidate theme if it hasn't changed Change-Id: I0811218679409ac7e111aa7609736fc19de5236b --- .../main/java/im/vector/app/features/themes/ThemeUtils.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/themes/ThemeUtils.kt b/vector/src/main/java/im/vector/app/features/themes/ThemeUtils.kt index aaa38c9292..37b17f03b4 100644 --- a/vector/src/main/java/im/vector/app/features/themes/ThemeUtils.kt +++ b/vector/src/main/java/im/vector/app/features/themes/ThemeUtils.kt @@ -91,8 +91,12 @@ object ThemeUtils { } fun invalidateNightMode(context: Context) { - mThemeInitialized = false; - setApplicationTheme(context.applicationContext, getApplicationLightTheme(context), getApplicationDarkTheme(context)) + val lightTheme = getApplicationLightTheme(context) + val darkTheme = getApplicationDarkTheme(context) + if (lightTheme != darkTheme && darkThemePossible(context)) { + mThemeInitialized = false; + setApplicationTheme(context.applicationContext, getApplicationLightTheme(context), getApplicationDarkTheme(context)) + } } // init the theme