Making material you default for devices that support it. For devices that dont, still setting purple as the main theme.

This commit is contained in:
LucasGGamerM 2022-12-16 12:07:29 -03:00
parent 390ecc48fb
commit bce2367cfc
2 changed files with 11 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import static org.joinmastodon.android.api.MastodonAPIController.gson;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
@ -56,7 +57,12 @@ public class GlobalUserPreferences{
voteButtonForSingleChoice=prefs.getBoolean("voteButtonForSingleChoice", true);
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
color=ColorPreference.values()[prefs.getInt("color", 1)];
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
color=ColorPreference.values()[prefs.getInt("color", 0)];
}else{
color=ColorPreference.values()[prefs.getInt("color", 1)];
}
}
public static void save(){
@ -78,13 +84,13 @@ public class GlobalUserPreferences{
}
public enum ColorPreference{
PINK,
MATERIAL3,
PURPLE,
PINK,
GREEN,
BLUE,
ORANGE,
YELLOW,
MATERIAL3
YELLOW
}
public enum ThemePreference{

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/purple_color" android:title="@string/sk_color_theme_purple"/>
<item android:id="@+id/pink_color" android:title="@string/sk_color_theme_pink"/>
<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/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/m3_color" android:title="@string/sk_color_theme_material3"/>
</menu>