put custom theme variants in some array

This commit is contained in:
Helium314 2023-07-30 10:39:58 +02:00
parent 0a7946e248
commit d9ebf2866c
2 changed files with 3 additions and 2 deletions

View file

@ -360,7 +360,9 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
public static final String THEME_DARKER = "darker";
public static final String THEME_BLACK = "black";
public static final String THEME_USER = "user";
public static final String[] CUSTOM_THEME_VARIANTS = new String[] { THEME_LIGHT, THEME_DARK, THEME_DARKER, THEME_BLACK, THEME_USER };
// todo (later): material you, system accent, ...
// todo: copies of original themes might need adjustments, though maybe it's only Colors that needs to be adjusted
public static Colors getCustomTheme(String theme, Context context, SharedPreferences prefs) {
switch (theme) {

View file

@ -131,9 +131,8 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
// check whether night mode is active using context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK
// this is needed so the auto-theme can be replaced
// idea: add a "dark theme variant" preference when auto-switch is on
// todo (later): material you, system accent, ...
// todo (idea): re-work setting to actually see preview of theme colors... but that's a lot of work
val variants = arrayOf(KeyboardTheme.THEME_LIGHT, KeyboardTheme.THEME_DARK, KeyboardTheme.THEME_DARKER, KeyboardTheme.THEME_BLACK, KeyboardTheme.THEME_USER)
val variants = KeyboardTheme.CUSTOM_THEME_VARIANTS
entries = variants.map {
val resId = resources.getIdentifier("theme_name_$it", "string", activity.packageName)
if (resId == 0) it else getString(resId)