add red theme

This commit is contained in:
sk 2022-12-16 14:41:53 +01:00
parent d63e5af8d0
commit e5da24a44d
6 changed files with 40 additions and 0 deletions

View File

@ -91,6 +91,7 @@ public class GlobalUserPreferences{
GREEN,
BLUE,
BROWN,
RED,
ORANGE,
YELLOW
}

View File

@ -253,6 +253,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
else if (id == R.id.green_color) pref = ColorPreference.GREEN;
else if (id == R.id.blue_color) pref = ColorPreference.BLUE;
else if (id == R.id.brown_color) pref = ColorPreference.BROWN;
else if (id == R.id.red_color) pref = ColorPreference.RED;
else if (id == R.id.yellow_color) pref = ColorPreference.YELLOW;
if (pref == null) return false;
@ -713,6 +714,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
case GREEN -> R.string.sk_color_theme_green;
case BLUE -> R.string.sk_color_theme_blue;
case BROWN -> R.string.sk_color_theme_brown;
case RED -> R.string.sk_color_theme_red;
case YELLOW -> R.string.sk_color_theme_yellow;
default -> throw new IllegalStateException("Unexpected value: "+GlobalUserPreferences.color);
});

View File

@ -708,6 +708,16 @@ public class UiUtils{
GlobalUserPreferences.trueBlackTheme ? R.style.Theme_Mastodon_Dark_TrueBlack_Brown : R.style.Theme_Mastodon_Dark_Brown;
});
break;
case RED:
context.setTheme(switch(GlobalUserPreferences.theme){
case AUTO ->
GlobalUserPreferences.trueBlackTheme ? R.style.Theme_Mastodon_AutoLightDark_TrueBlack_Red : R.style.Theme_Mastodon_AutoLightDark_Red;
case LIGHT ->
R.style.Theme_Mastodon_Light_Red;
case DARK ->
GlobalUserPreferences.trueBlackTheme ? R.style.Theme_Mastodon_Dark_TrueBlack_Red : R.style.Theme_Mastodon_Dark_Red;
});
break;
case YELLOW:
context.setTheme(switch(GlobalUserPreferences.theme){
case AUTO ->

View File

@ -6,5 +6,6 @@
<item android:id="@+id/green_color" android:title="@string/sk_color_theme_green"/>
<item android:id="@+id/blue_color" android:title="@string/sk_color_theme_blue"/>
<item android:id="@+id/brown_color" android:title="@string/sk_color_theme_brown"/>
<item android:id="@+id/red_color" android:title="@string/sk_color_theme_red"/>
<item android:id="@+id/yellow_color" android:title="@string/sk_color_theme_yellow"/>
</menu>

View File

@ -47,6 +47,7 @@
<string name="sk_color_theme_green">Green</string>
<string name="sk_color_theme_blue">Blue</string>
<string name="sk_color_theme_brown">Brown</string>
<string name="sk_color_theme_red">Red</string>
<string name="sk_color_theme_yellow">Yellow</string>
<string name="sk_poll_allow_multiple">Allow multiple choices</string>
<string name="sk_translate_post">Translate</string>

View File

@ -947,6 +947,31 @@
</style>
<style name="Theme.Mastodon.Dark.Red" parent="Theme.Mastodon.Dark">
<item name="android:colorAccent">@color/error_400</item>
<item name="colorPollMostVoted">@color/error_700</item>
<item name="colorAccentLight">@color/error_600</item>
<item name="colorAccentLightest">@color/error_800</item>
</style>
<style name="Theme.Mastodon.Dark.TrueBlack.Red" parent="Theme.Mastodon.Dark.TrueBlack">
<item name="android:colorAccent">@color/error_400</item>
<item name="colorPollMostVoted">@color/error_700</item>
<item name="colorAccentLight">@color/error_600</item>
<item name="colorAccentLightest">@color/error_800</item>
</style>
<style name="Theme.Mastodon.Light.Red" parent="Theme.Mastodon.Light">
<item name="android:colorAccent">@color/error_400</item>
<item name="colorPollMostVoted">@color/error_700</item>
<item name="colorAccentLight">@color/error_600</item>
<item name="colorAccentLightest">@color/error_800</item>
</style>
<style name="Theme.Mastodon.AutoLightDark.Red" parent="Theme.Mastodon.Light.Red"/>
<style name="Theme.Mastodon.AutoLightDark.TrueBlack.Red" parent="Theme.Mastodon.Light.Red"/>
<style name="Theme.Mastodon.Dark.Original" parent="Theme.Mastodon.Dark">
<item name="android:colorAccent">@color/original_primary_400</item>
<item name="colorPollMostVoted">@color/original_primary_700</item>