Logic side done for the red theme.

This commit is contained in:
LucasGGamerM 2022-12-18 12:54:17 -03:00
parent 2fbf172729
commit 0cafbe9f91
4 changed files with 18 additions and 1 deletions

View File

@ -90,7 +90,8 @@ public class GlobalUserPreferences{
GREEN, GREEN,
BLUE, BLUE,
ORANGE, ORANGE,
YELLOW YELLOW,
RED
} }
public enum ThemePreference{ public enum ThemePreference{

View File

@ -712,6 +712,10 @@ public class SettingsFragment extends MastodonToolbarFragment{
pref = GlobalUserPreferences.ColorPreference.YELLOW; pref = GlobalUserPreferences.ColorPreference.YELLOW;
onColorPreferenceClick(pref); onColorPreferenceClick(pref);
} }
else if(id==R.id.red_color) {
pref = GlobalUserPreferences.ColorPreference.RED;
onColorPreferenceClick(pref);
}
else if(id==R.id.m3_color) { else if(id==R.id.m3_color) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
pref = GlobalUserPreferences.ColorPreference.MATERIAL3; pref = GlobalUserPreferences.ColorPreference.MATERIAL3;
@ -741,6 +745,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
case BLUE -> R.string.sk_color_theme_blue; case BLUE -> R.string.sk_color_theme_blue;
case ORANGE -> R.string.sk_color_theme_brown; case ORANGE -> R.string.sk_color_theme_brown;
case YELLOW -> R.string.sk_color_theme_yellow; case YELLOW -> R.string.sk_color_theme_yellow;
case RED -> R.string.sk_color_theme_red;
case MATERIAL3 -> R.string.sk_color_theme_material3; case MATERIAL3 -> R.string.sk_color_theme_material3;
}); });
} }

View File

@ -718,6 +718,16 @@ public class UiUtils{
GlobalUserPreferences.trueBlackTheme ? R.style.Theme_Mastodon_Dark_TrueBlack_Yellow : R.style.Theme_Mastodon_Dark_Yellow; GlobalUserPreferences.trueBlackTheme ? R.style.Theme_Mastodon_Dark_TrueBlack_Yellow : R.style.Theme_Mastodon_Dark_Yellow;
}); });
break; 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 MATERIAL3: case MATERIAL3:
context.setTheme(switch(GlobalUserPreferences.theme){ context.setTheme(switch(GlobalUserPreferences.theme){
case AUTO -> case AUTO ->

View File

@ -7,4 +7,5 @@
<item android:id="@+id/blue_color" android:title="@string/sk_color_theme_blue"/> <item android:id="@+id/blue_color" android:title="@string/sk_color_theme_blue"/>
<item android:id="@+id/orange_color" android:title="@string/sk_color_theme_brown"/> <item android:id="@+id/orange_color" android:title="@string/sk_color_theme_brown"/>
<item android:id="@+id/yellow_color" android:title="@string/sk_color_theme_yellow"/> <item android:id="@+id/yellow_color" android:title="@string/sk_color_theme_yellow"/>
<item android:id="@+id/red_color" android:title="@string/sk_color_theme_red"/>
</menu> </menu>