Allow reversed themes to follow system

pull/178/head
M66B 5 years ago
parent e58f801ec6
commit d138357319

@ -178,14 +178,26 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setTheme(night setTheme(night
? R.style.AppThemeBlueOrangeDark : R.style.AppThemeBlueOrangeLight); ? R.style.AppThemeBlueOrangeDark : R.style.AppThemeBlueOrangeLight);
break; break;
case "orange_blue_system":
setTheme(night
? R.style.AppThemeOrangeBlueDark : R.style.AppThemeOrangeBlueLight);
break;
case "yellow_purple_system": case "yellow_purple_system":
setTheme(night setTheme(night
? R.style.AppThemeYellowPurpleDark : R.style.AppThemeYellowPurpleLight); ? R.style.AppThemeYellowPurpleDark : R.style.AppThemeYellowPurpleLight);
break; break;
case "purple_yellow_system":
setTheme(night
? R.style.AppThemePurpleYellowDark : R.style.AppThemePurpleYellowLight);
break;
case "red_green_system": case "red_green_system":
setTheme(night setTheme(night
? R.style.AppThemeRedGreenDark : R.style.AppThemeRedGreenLight); ? R.style.AppThemeRedGreenDark : R.style.AppThemeRedGreenLight);
break; break;
case "green_red_system":
setTheme(night
? R.style.AppThemeGreenRedDark : R.style.AppThemeGreenRedLight);
break;
case "grey_system": case "grey_system":
setTheme(night setTheme(night
? R.style.AppThemeGreySteelBlueDark : R.style.AppThemeGreySteelBlueLight); ? R.style.AppThemeGreySteelBlueDark : R.style.AppThemeGreySteelBlueLight);

@ -826,27 +826,21 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private void eval() { private void eval() {
int checkedId = rgTheme.getCheckedRadioButtonId(); int checkedId = rgTheme.getCheckedRadioButtonId();
swReverse.setEnabled(checkedId == R.id.rbThemeBlueOrange || boolean reverse = (checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeYellowPurple || checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen); checkedId == R.id.rbThemeRedGreen);
swDark.setEnabled(checkedId == R.id.rbThemeBlueOrange || boolean dark = (checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeYellowPurple || checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen || checkedId == R.id.rbThemeRedGreen ||
checkedId == R.id.rbThemeGrey); checkedId == R.id.rbThemeGrey);
swBlack.setEnabled(checkedId == R.id.rbThemeBlueOrange || boolean black = (checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeYellowPurple || checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen); checkedId == R.id.rbThemeRedGreen);
swSystem.setEnabled(swDark.isEnabled());
boolean reverse = (swReverse.isEnabled() && swReverse.isChecked()); swReverse.setEnabled(reverse);
boolean dark = (swDark.isEnabled() && swDark.isChecked()); swDark.setEnabled(dark);
boolean black = (swBlack.isEnabled() && swBlack.isChecked()); swBlack.setEnabled(black && swDark.isChecked());
boolean system = (swSystem.isEnabled() && swSystem.isChecked()); swSystem.setEnabled(dark && !swDark.isChecked());
swReverse.setEnabled(swReverse.isEnabled() && !system);
swDark.setEnabled(swDark.isEnabled() && !system);
swBlack.setEnabled(swBlack.isEnabled() && dark);
swSystem.setEnabled(swSystem.isEnabled() && !reverse && !dark && !black);
} }
@NonNull @NonNull
@ -927,6 +921,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "blue_orange_light": case "blue_orange_light":
case "blue_orange_dark": case "blue_orange_dark":
case "blue_orange_black": case "blue_orange_black":
case "orange_blue_system":
case "orange_blue_light": case "orange_blue_light":
case "orange_blue_dark": case "orange_blue_dark":
case "orange_blue_black": case "orange_blue_black":
@ -936,6 +931,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "yellow_purple_light": case "yellow_purple_light":
case "yellow_purple_dark": case "yellow_purple_dark":
case "yellow_purple_black": case "yellow_purple_black":
case "purple_yellow_system":
case "purple_yellow_light": case "purple_yellow_light":
case "purple_yellow_dark": case "purple_yellow_dark":
case "purple_yellow_black": case "purple_yellow_black":
@ -945,6 +941,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "red_green_light": case "red_green_light":
case "red_green_dark": case "red_green_dark":
case "red_green_black": case "red_green_black":
case "green_red_system":
case "green_red_light": case "green_red_light":
case "green_red_dark": case "green_red_dark":
case "green_red_black": case "green_red_black":
@ -978,7 +975,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
switch (rgTheme.getCheckedRadioButtonId()) { switch (rgTheme.getCheckedRadioButtonId()) {
case R.id.rbThemeBlueOrange: case R.id.rbThemeBlueOrange:
if (system) if (system)
prefs.edit().putString("theme", "blue_orange_system").apply(); prefs.edit().putString("theme",
reverse ? "orange_blue_system" : "blue_orange_system").apply();
else else
prefs.edit().putString("theme", prefs.edit().putString("theme",
(reverse ? "orange_blue" : "blue_orange") + (reverse ? "orange_blue" : "blue_orange") +
@ -986,7 +984,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
break; break;
case R.id.rbThemeYellowPurple: case R.id.rbThemeYellowPurple:
if (system) if (system)
prefs.edit().putString("theme", "yellow_purple_system").apply(); prefs.edit().putString("theme",
reverse ? "purple_yellow_system" : "yellow_purple_system").apply();
else else
prefs.edit().putString("theme", prefs.edit().putString("theme",
(reverse ? "purple_yellow" : "yellow_purple") + (reverse ? "purple_yellow" : "yellow_purple") +
@ -994,7 +993,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
break; break;
case R.id.rbThemeRedGreen: case R.id.rbThemeRedGreen:
if (system) if (system)
prefs.edit().putString("theme", "red_green_system").apply(); prefs.edit().putString("theme",
reverse ? "green_red_system" : "red_green_system").apply();
else else
prefs.edit().putString("theme", prefs.edit().putString("theme",
(reverse ? "green_red" : "red_green") + (reverse ? "green_red" : "red_green") +

Loading…
Cancel
Save