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);
int optionId = rgThemeOptions.getCheckedRadioButtonId();
swReverse.setEnabled(colored && !grey && !solarized && !you);
swReverse.setEnabled(colored && !grey && !solarized);
rgThemeOptions.setEnabled(colored);
for (int i = 0; i < rgThemeOptions.getChildCount(); i++)
@ -126,7 +126,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
});
boolean reversed =
(theme.startsWith("orange_blue") ||
(theme.contains("reversed") ||
theme.startsWith("orange_blue") ||
theme.startsWith("purple_yellow") ||
theme.startsWith("green_red"));
boolean dark = theme.endsWith("dark");
@ -211,6 +212,11 @@ public class FragmentDialogTheme extends FragmentDialogBase {
case "you_black":
case "you_system":
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);
break;
}
@ -299,11 +305,13 @@ public class FragmentDialogTheme extends FragmentDialogBase {
editor.putString("theme", "black_and_white").apply();
} else if (checkedRadioButtonId == R.id.rbThemeYou) {
if (system)
editor.putString("theme", "you_system" +
(black ? "_black" : "")).apply();
editor.putString("theme",
(reverse ? "you_reversed_system" : "you_system") +
(black ? "_black" : "")).apply();
else
editor.putString("theme", "you" +
(black ? "_black" : dark ? "_dark" : "_light")).apply();
editor.putString("theme",
(reverse ? "you_reversed" : "you") +
(black ? "_black" : dark ? "_dark" : "_light")).apply();
}
editor.putBoolean("default_light", swHtmlLight.isChecked());
@ -506,6 +514,22 @@ public class FragmentDialogTheme extends FragmentDialogBase {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
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:
Log.e("Unknown theme=" + theme);
return R.style.AppThemeBlueOrangeLight;

View File

@ -36,4 +36,40 @@
<item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item>
</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>