From 18e30d2726c349c9cdc1782e918f149c788eeba0 Mon Sep 17 00:00:00 2001 From: Katharine Chui Date: Sun, 6 Feb 2022 03:38:28 +0800 Subject: [PATCH] apply dynamic color instead of leaving it as catima theme for invalid theme key --- app/src/main/java/protect/card_locker/Utils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/protect/card_locker/Utils.java b/app/src/main/java/protect/card_locker/Utils.java index 79bcd0ded..bb14d8a18 100644 --- a/app/src/main/java/protect/card_locker/Utils.java +++ b/app/src/main/java/protect/card_locker/Utils.java @@ -471,9 +471,7 @@ public class Utils { Resources.Theme theme = activity.getTheme(); Resources resources = activity.getResources(); - if (color.equals(resources.getString(R.string.settings_key_system_theme))) { - DynamicColors.applyIfAvailable(activity); - } else if (color.equals(resources.getString(R.string.settings_key_pink_theme))) { + if (color.equals(resources.getString(R.string.settings_key_pink_theme))) { theme.applyStyle(R.style.pink, true); } else if (color.equals(resources.getString(R.string.settings_key_magenta_theme))) { theme.applyStyle(R.style.magenta, true); @@ -489,6 +487,11 @@ public class Utils { theme.applyStyle(R.style.brown, true); } else if (color.equals(resources.getString(R.string.settings_key_catima_theme))) { // catima theme is AppTheme itself, no dynamic colors nor applyStyle + } else if (color.equals(resources.getString(R.string.settings_key_system_theme))) { + DynamicColors.applyIfAvailable(activity); + } else { + // final catch all in case of invalid theme value from older versions + DynamicColors.applyIfAvailable(activity); } if (isDarkModeEnabled(activity) && settings.getOledDark()) {