Added reversed Material You themes

This commit is contained in:
M66B 2021-10-27 12:27:04 +02:00
parent 741d04948b
commit 8ce8fd05f5
2 changed files with 66 additions and 6 deletions

View File

@ -48,7 +48,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
checkedId == R.id.rbThemeYellowPurple); checkedId == R.id.rbThemeYellowPurple);
int optionId = rgThemeOptions.getCheckedRadioButtonId(); int optionId = rgThemeOptions.getCheckedRadioButtonId();
swReverse.setEnabled(colored && !grey && !solarized && !you); swReverse.setEnabled(colored && !grey && !solarized);
rgThemeOptions.setEnabled(colored); rgThemeOptions.setEnabled(colored);
for (int i = 0; i < rgThemeOptions.getChildCount(); i++) for (int i = 0; i < rgThemeOptions.getChildCount(); i++)
@ -126,7 +126,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
}); });
boolean reversed = boolean reversed =
(theme.startsWith("orange_blue") || (theme.contains("reversed") ||
theme.startsWith("orange_blue") ||
theme.startsWith("purple_yellow") || theme.startsWith("purple_yellow") ||
theme.startsWith("green_red")); theme.startsWith("green_red"));
boolean dark = theme.endsWith("dark"); boolean dark = theme.endsWith("dark");
@ -211,6 +212,11 @@ public class FragmentDialogTheme extends FragmentDialogBase {
case "you_black": case "you_black":
case "you_system": case "you_system":
case "you_system_black": case "you_system_black":
case "you_reversed_light":
case "you_reversed_dark":
case "you_reversed_black":
case "you_reversed_system":
case "you_reversed_system_black":
rgTheme.check(R.id.rbThemeYou); rgTheme.check(R.id.rbThemeYou);
break; break;
} }
@ -299,10 +305,12 @@ public class FragmentDialogTheme extends FragmentDialogBase {
editor.putString("theme", "black_and_white").apply(); editor.putString("theme", "black_and_white").apply();
} else if (checkedRadioButtonId == R.id.rbThemeYou) { } else if (checkedRadioButtonId == R.id.rbThemeYou) {
if (system) if (system)
editor.putString("theme", "you_system" + editor.putString("theme",
(reverse ? "you_reversed_system" : "you_system") +
(black ? "_black" : "")).apply(); (black ? "_black" : "")).apply();
else else
editor.putString("theme", "you" + editor.putString("theme",
(reverse ? "you_reversed" : "you") +
(black ? "_black" : dark ? "_dark" : "_light")).apply(); (black ? "_black" : dark ? "_dark" : "_light")).apply();
} }
@ -506,6 +514,22 @@ public class FragmentDialogTheme extends FragmentDialogBase {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouBlack : R.style.AppThemeYouLight); return (night ? R.style.AppThemeYouBlack : R.style.AppThemeYouLight);
case "you_reversed_light":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return R.style.AppThemeYouReversedLight;
case "you_reversed_dark":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouReversedLight : R.style.AppThemeYouReversedDark);
case "you_reversed_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouReversedLight : R.style.AppThemeYouReversedBlack);
case "you_reversed_system":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouReversedDark : R.style.AppThemeYouReversedLight);
case "you_reversed_system_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouReversedBlack : R.style.AppThemeYouReversedLight);
default: default:
Log.e("Unknown theme=" + theme); Log.e("Unknown theme=" + theme);
return R.style.AppThemeBlueOrangeLight; return R.style.AppThemeBlueOrangeLight;

View File

@ -36,4 +36,40 @@
<item name="android:windowBackground">@drawable/background_black</item> <item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item> <item name="colorDrawerBackground">@color/black</item>
</style> </style>
<style name="AppThemeYouReversedLight" parent="AppThemeBaseLight">
<item name="colorPrimary">@android:color/system_accent3_500</item>
<item name="colorPrimaryDark">@android:color/system_accent3_700</item>
<item name="colorAccent">@android:color/system_accent1_500</item>
<item name="colorUnreadHighlight">@android:color/system_accent1_700</item>
<item name="colorFabBackground">@android:color/system_accent1_500</item>
<item name="colorInfoForeground">@android:color/system_accent3_0</item>
<item name="colorInfoBackground">@android:color/system_accent3_500</item>
<item name="android:textColorLink">@android:color/system_accent1_700</item>
</style>
<style name="AppThemeYouReversedDark" parent="AppThemeBaseDark">
<item name="colorPrimary">@android:color/system_accent3_500</item>
<item name="colorPrimaryDark">@android:color/system_accent3_700</item>
<item name="colorAccent">@android:color/system_accent1_300</item>
<item name="colorUnreadHighlight">@android:color/system_accent1_300</item>
<item name="colorFabBackground">@android:color/system_accent1_500</item>
<item name="colorInfoForeground">@android:color/system_accent3_0</item>
<item name="colorInfoBackground">@android:color/system_accent3_500</item>
<item name="android:textColorLink">@android:color/system_accent1_300</item>
</style>
<style name="AppThemeYouReversedBlack" parent="AppThemeYouDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
</resources> </resources>