Allow more system themes

This commit is contained in:
M66B 2019-12-28 14:45:10 +01:00
parent 53f6baed77
commit 895474940f
2 changed files with 31 additions and 9 deletions

View File

@ -140,12 +140,26 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
case "black":
setTheme(R.style.AppThemeBlack);
break;
case "system":
case "blue_orange_system":
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeBlueOrangeDark);
else
setTheme(R.style.AppThemeBlueOrangeLight);
break;
case "yellow_purple_system":
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeYellowPurpleDark);
else
setTheme(R.style.AppThemeYellowPurpleLight);
break;
case "red_green_system":
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeRedGreenDark);
else
setTheme(R.style.AppThemeRedGreenLight);
break;
case "grey_system":
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeGreySteelBlueDark);

View File

@ -673,8 +673,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen ||
checkedId == R.id.rbThemeGrey);
swSystem.setEnabled(checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeGrey);
swSystem.setEnabled(swDark.isEnabled());
boolean reverse = (swReverse.isEnabled() && swReverse.isChecked());
boolean dark = (swDark.isEnabled() && swDark.isChecked());
@ -735,18 +734,21 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "light":
case "dark":
case "system":
case "blue_orange_system":
case "blue_orange_light":
case "blue_orange_dark":
case "orange_blue_light":
case "orange_blue_dark":
rgTheme.check(R.id.rbThemeBlueOrange);
break;
case "yellow_purple_system":
case "yellow_purple_light":
case "yellow_purple_dark":
case "purple_yellow_light":
case "purple_yellow_dark":
rgTheme.check(R.id.rbThemeYellowPurple);
break;
case "red_green_system":
case "red_green_light":
case "red_green_dark":
case "green_red_light":
@ -779,21 +781,27 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
switch (rgTheme.getCheckedRadioButtonId()) {
case R.id.rbThemeBlueOrange:
if (system)
prefs.edit().putString("theme", "system").apply();
prefs.edit().putString("theme", "blue_orange_system").apply();
else
prefs.edit().putString("theme",
(reverse ? "orange_blue" : "blue_orange") +
(dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeYellowPurple:
prefs.edit().putString("theme",
(reverse ? "purple_yellow" : "yellow_purple") +
(dark ? "_dark" : "_light")).apply();
if (system)
prefs.edit().putString("theme", "yellow_purple_system").apply();
else
prefs.edit().putString("theme",
(reverse ? "purple_yellow" : "yellow_purple") +
(dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeRedGreen:
prefs.edit().putString("theme",
(reverse ? "green_red" : "red_green") +
(dark ? "_dark" : "_light")).apply();
if (system)
prefs.edit().putString("theme", "red_green_system").apply();
else
prefs.edit().putString("theme",
(reverse ? "green_red" : "red_green") +
(dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeGrey:
if (system)