Allow black system theme

This commit is contained in:
M66B 2020-09-14 08:46:36 +02:00
parent 205b51e228
commit 138baa4d78
2 changed files with 38 additions and 5 deletions

View File

@ -184,26 +184,50 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setTheme(night
? R.style.AppThemeBlueOrangeDark : R.style.AppThemeBlueOrangeLight);
break;
case "blue_orange_system_black":
setTheme(night
? R.style.AppThemeBlueOrangeBlack : R.style.AppThemeBlueOrangeLight);
break;
case "orange_blue_system":
setTheme(night
? R.style.AppThemeOrangeBlueDark : R.style.AppThemeOrangeBlueLight);
break;
case "orange_blue_system_black":
setTheme(night
? R.style.AppThemeOrangeBlueBlack : R.style.AppThemeOrangeBlueLight);
break;
case "yellow_purple_system":
setTheme(night
? R.style.AppThemeYellowPurpleDark : R.style.AppThemeYellowPurpleLight);
break;
case "yellow_purple_system_black":
setTheme(night
? R.style.AppThemeYellowPurpleBlack : R.style.AppThemeYellowPurpleLight);
break;
case "purple_yellow_system":
setTheme(night
? R.style.AppThemePurpleYellowDark : R.style.AppThemePurpleYellowLight);
break;
case "purple_yellow_system_black":
setTheme(night
? R.style.AppThemePurpleYellowBlack : R.style.AppThemePurpleYellowLight);
break;
case "red_green_system":
setTheme(night
? R.style.AppThemeRedGreenDark : R.style.AppThemeRedGreenLight);
break;
case "red_green_system_black":
setTheme(night
? R.style.AppThemeRedGreenBlack : R.style.AppThemeRedGreenLight);
break;
case "green_red_system":
setTheme(night
? R.style.AppThemeGreenRedDark : R.style.AppThemeGreenRedLight);
break;
case "green_red_system_black":
setTheme(night
? R.style.AppThemeGreenRedBlack : R.style.AppThemeGreenRedLight);
break;
case "grey_system":
setTheme(night
? R.style.AppThemeGreySteelBlueDark : R.style.AppThemeGreySteelBlueLight);

View File

@ -970,7 +970,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swReverse.setEnabled(colored);
swDark.setEnabled(dark);
swBlack.setEnabled(colored && swDark.isChecked());
swSystem.setEnabled(dark && !swDark.isChecked());
swSystem.setEnabled(dark && (!swDark.isChecked() || (swBlack.isEnabled() && swBlack.isChecked())));
tvSystem.setEnabled(swSystem.isEnabled() && swSystem.isChecked());
}
@ -1038,7 +1038,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
theme.startsWith("green_red"));
boolean dark = theme.endsWith("dark");
boolean black = (!"black".equals(theme) && theme.endsWith("black"));
boolean system = theme.endsWith("system");
boolean system = (theme.endsWith("system") || theme.endsWith("system_black"));
swReverse.setChecked(colored);
swDark.setChecked(dark || black);
@ -1050,30 +1050,36 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "dark":
case "system":
case "blue_orange_system":
case "blue_orange_system_black":
case "blue_orange_light":
case "blue_orange_dark":
case "blue_orange_black":
case "orange_blue_system":
case "orange_blue_system_black":
case "orange_blue_light":
case "orange_blue_dark":
case "orange_blue_black":
rgTheme.check(R.id.rbThemeBlueOrange);
break;
case "yellow_purple_system":
case "yellow_purple_system_black":
case "yellow_purple_light":
case "yellow_purple_dark":
case "yellow_purple_black":
case "purple_yellow_system":
case "purple_yellow_system_black":
case "purple_yellow_light":
case "purple_yellow_dark":
case "purple_yellow_black":
rgTheme.check(R.id.rbThemeYellowPurple);
break;
case "red_green_system":
case "red_green_system_black":
case "red_green_light":
case "red_green_dark":
case "red_green_black":
case "green_red_system":
case "green_red_system_black":
case "green_red_light":
case "green_red_dark":
case "green_red_black":
@ -1111,7 +1117,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case R.id.rbThemeBlueOrange:
if (system)
prefs.edit().putString("theme",
reverse ? "orange_blue_system" : "blue_orange_system").apply();
(reverse ? "orange_blue_system" : "blue_orange_system") +
(black ? "_black" : "")).apply();
else
prefs.edit().putString("theme",
(reverse ? "orange_blue" : "blue_orange") +
@ -1120,7 +1127,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case R.id.rbThemeYellowPurple:
if (system)
prefs.edit().putString("theme",
reverse ? "purple_yellow_system" : "yellow_purple_system").apply();
(reverse ? "purple_yellow_system" : "yellow_purple_system") +
(black ? "_black" : "")).apply();
else
prefs.edit().putString("theme",
(reverse ? "purple_yellow" : "yellow_purple") +
@ -1129,7 +1137,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case R.id.rbThemeRedGreen:
if (system)
prefs.edit().putString("theme",
reverse ? "green_red_system" : "red_green_system").apply();
(reverse ? "green_red_system" : "red_green_system") +
(black ? "_black" : "")).apply();
else
prefs.edit().putString("theme",
(reverse ? "green_red" : "red_green") +