set material3 theme as default

This commit is contained in:
sk
2022-12-16 02:02:48 +01:00
parent acbf27f025
commit ef421dd5dd
4 changed files with 7 additions and 12 deletions

View File

@@ -77,14 +77,14 @@ public class GlobalUserPreferences{
}
public enum ColorPreference{
MATERIAL3,
PINK,
PURPLE,
GREEN,
BLUE,
BROWN,
ORANGE,
YELLOW,
MATERIAL3
YELLOW
}
public enum ThemePreference{

View File

@@ -247,19 +247,15 @@ public class SettingsFragment extends MastodonToolbarFragment{
ColorPreference pref = null;
int id = item.getItemId();
if (id == R.id.pink_color) pref = ColorPreference.PINK;
if (id == R.id.m3_color) pref = ColorPreference.MATERIAL3;
else if (id == R.id.pink_color) pref = ColorPreference.PINK;
else if (id == R.id.purple_color) pref = ColorPreference.PURPLE;
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.yellow_color) pref = ColorPreference.YELLOW;
else if (id == R.id.m3_color) pref = ColorPreference.MATERIAL3;
if (pref == null) return false;
if (pref == ColorPreference.MATERIAL3 && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
Toast.makeText(getActivity(), R.string.sk_unsupported, Toast.LENGTH_LONG).show();
return false;
}
GlobalUserPreferences.color=pref;
GlobalUserPreferences.save();
@@ -711,13 +707,13 @@ public class SettingsFragment extends MastodonToolbarFragment{
public void onBind(ColorPicker item){
icon.setImageResource(R.drawable.ic_fluent_color_24_regular);
button.setText(switch(GlobalUserPreferences.color){
case MATERIAL3 -> R.string.sk_color_theme_material3;
case PINK -> R.string.sk_color_theme_pink;
case PURPLE -> R.string.sk_color_theme_purple;
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 YELLOW -> R.string.sk_color_theme_yellow;
case MATERIAL3 -> R.string.sk_color_theme_material_you;
default -> throw new IllegalStateException("Unexpected value: "+GlobalUserPreferences.color);
});
}

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/m3_color" android:title="@string/sk_color_theme_material3"/>
<item android:id="@+id/pink_color" android:title="@string/sk_color_theme_pink"/>
<item android:id="@+id/purple_color" android:title="@string/sk_color_theme_purple"/>
<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/yellow_color" android:title="@string/sk_color_theme_yellow"/>
<item android:id="@+id/m3_color" android:title="@string/sk_color_theme_material_you"/>
</menu>

View File

@@ -41,14 +41,13 @@
<string name="sk_notification_type_status">Posts</string>
<string name="sk_notify_posts">Post notifications</string>
<string name="sk_settings_color_picker">Color theme</string>
<string name="sk_color_theme_material3">System</string>
<string name="sk_color_theme_pink">Pink</string>
<string name="sk_color_theme_purple">Purple</string>
<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_yellow">Yellow</string>
<string name="sk_color_theme_material_you">Material You</string>
<string name="sk_unsupported">Not supported on your device</string>
<string name="sk_poll_allow_multiple">Allow multiple choices</string>
<string name="sk_translate_post">Translate</string>
<string name="sk_translate_show_original">Show original</string>