diff --git a/app/src/main/java/protect/card_locker/Utils.java b/app/src/main/java/protect/card_locker/Utils.java
index bc1042821..79bcd0ded 100644
--- a/app/src/main/java/protect/card_locker/Utils.java
+++ b/app/src/main/java/protect/card_locker/Utils.java
@@ -468,50 +468,29 @@ public class Utils {
public static void patchColors(AppCompatActivity activity) {
Settings settings = new Settings(activity);
String color = settings.getColor();
- final String system = activity.getResources().getString(R.string.settings_key_system_theme);
- final String red = activity.getResources().getString(R.string.settings_key_red_theme);
- final String pink = activity.getResources().getString(R.string.settings_key_pink_theme);
- final String magenta = activity.getResources().getString(R.string.settings_key_magenta_theme);
- final String violet = activity.getResources().getString(R.string.settings_key_violet_theme);
- final String blue = activity.getResources().getString(R.string.settings_key_blue_theme);
- final String sky_blue = activity.getResources().getString(R.string.settings_key_sky_blue_theme);
- final String green = activity.getResources().getString(R.string.settings_key_green_theme);
- final String brown = activity.getResources().getString(R.string.settings_key_brown_theme);
- // do nothing if color is catima
- // final String catima = activity.getResources().getString(R.string.settings_key_catima_theme);
Resources.Theme theme = activity.getTheme();
-
- if (color.equals(system)) {
+ Resources resources = activity.getResources();
+ if (color.equals(resources.getString(R.string.settings_key_system_theme))) {
DynamicColors.applyIfAvailable(activity);
- } else {
- if (color.equals(red)) {
- theme.applyStyle(R.style.red, true);
- }
- if (color.equals(pink)) {
- theme.applyStyle(R.style.pink, true);
- }
- if (color.equals(magenta)) {
- theme.applyStyle(R.style.magenta, true);
- }
- if (color.equals(violet)) {
- theme.applyStyle(R.style.violet, true);
- }
- if (color.equals(blue)) {
- theme.applyStyle(R.style.blue, true);
- }
- if (color.equals(sky_blue)) {
- theme.applyStyle(R.style.skyblue, true);
- }
- if (color.equals(green)) {
- theme.applyStyle(R.style.green, true);
- }
- if (color.equals(brown)) {
- theme.applyStyle(R.style.brown, true);
- }
+ } else 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);
+ } else if (color.equals(resources.getString(R.string.settings_key_violet_theme))) {
+ theme.applyStyle(R.style.violet, true);
+ } else if (color.equals(resources.getString(R.string.settings_key_blue_theme))) {
+ theme.applyStyle(R.style.blue, true);
+ } else if (color.equals(resources.getString(R.string.settings_key_sky_blue_theme))) {
+ theme.applyStyle(R.style.skyblue, true);
+ } else if (color.equals(resources.getString(R.string.settings_key_green_theme))) {
+ theme.applyStyle(R.style.green, true);
+ } else if (color.equals(resources.getString(R.string.settings_key_brown_theme))) {
+ 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
}
-
if (isDarkModeEnabled(activity) && settings.getOledDark()) {
theme.applyStyle(R.style.DarkBackground, true);
}
diff --git a/app/src/main/java/protect/card_locker/preferences/Settings.java b/app/src/main/java/protect/card_locker/preferences/Settings.java
index 36a5b8b00..345107429 100644
--- a/app/src/main/java/protect/card_locker/preferences/Settings.java
+++ b/app/src/main/java/protect/card_locker/preferences/Settings.java
@@ -108,5 +108,7 @@ public class Settings {
return getBoolean(R.string.settings_key_oled_dark, false);
}
- public String getColor() { return getString(R.string.setting_key_theme_color, mContext.getResources().getString(R.string.settings_key_system_theme)); }
+ public String getColor() {
+ return getString(R.string.setting_key_theme_color, mContext.getResources().getString(R.string.settings_key_system_theme));
+ }
}
diff --git a/app/src/main/java/protect/card_locker/preferences/SettingsActivity.java b/app/src/main/java/protect/card_locker/preferences/SettingsActivity.java
index fa9f83a36..d2fc17448 100644
--- a/app/src/main/java/protect/card_locker/preferences/SettingsActivity.java
+++ b/app/src/main/java/protect/card_locker/preferences/SettingsActivity.java
@@ -150,20 +150,8 @@ public class SettingsActivity extends CatimaAppCompatActivity {
return true;
});
if (!DynamicColors.isDynamicColorAvailable()) {
- // remove catima from list
- CharSequence[] colorValues = colorPreference.getEntryValues();
- CharSequence[] colorEntries = colorPreference.getEntries();
- CharSequence[] newColorValues = new CharSequence[colorValues.length - 1];
- CharSequence[] newColorEntries = new CharSequence[colorEntries.length - 1];
- for (int i = 0, j = 0; i < colorValues.length; i++) {
- if (!colorValues[i].equals(getResources().getString(R.string.settings_key_catima_theme))) {
- newColorValues[j] = colorValues[i];
- newColorEntries[j] = colorEntries[i];
- j++;
- }
- }
- colorPreference.setEntries(newColorEntries);
- colorPreference.setEntryValues(newColorValues);
+ colorPreference.setEntryValues(R.array.color_values_no_dynamic);
+ colorPreference.setEntries(R.array.color_value_strings_no_dynamic);
}
}
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index ed20d926c..a36d1b0b9 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -40,35 +40,6 @@
-
-
-