Files
moshidon/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java
LucasGGamerM e274b7e6d5 Implement a color picker (#124)
* Proper implementation on the color picker.
* Disabling the icons for the color picker menu
* Adding a green theme
* Making the green theme more readable
* More polishes over the green theme
* Adding blue theme and refactoring styles.xml
* Make badged settings icon follow accent colors
* Adding an icon to the color picker setting
* Fix readability issue on the light blue theme
* Adding orange theme, tweaking the blue and green theme
* Adding yellow theme
* Making it so that the fab follows the theme
* Fixing the TrueBlack themes for everything
* Make it so that the publish button also follows the theme
* Editing some drawable files to make them also follow the theme
* Making it so that the boost icon is also following the theme when clicked
* Make follow requests icon badge follow the color scheme and also make it that the profile top bar menu also follows the theme. This should be it

Co-authored-by: sk <sk22@mailbox.org>
2022-12-07 18:13:13 +01:00

75 lines
2.5 KiB
Java

package org.joinmastodon.android;
import android.content.Context;
import android.content.SharedPreferences;
public class GlobalUserPreferences{
public static boolean playGifs;
public static boolean useCustomTabs;
public static boolean trueBlackTheme;
public static boolean showReplies;
public static boolean showBoosts;
public static boolean loadNewPosts;
public static boolean showFederatedTimeline;
public static boolean showInteractionCounts;
public static boolean alwaysExpandContentWarnings;
public static boolean disableMarquee;
public static boolean voteButtonForSingleChoice;
public static ThemePreference theme;
public static ColorPreference color;
private static SharedPreferences getPrefs(){
return MastodonApp.context.getSharedPreferences("global", Context.MODE_PRIVATE);
}
public static void load(){
SharedPreferences prefs=getPrefs();
playGifs=prefs.getBoolean("playGifs", true);
useCustomTabs=prefs.getBoolean("useCustomTabs", true);
trueBlackTheme=prefs.getBoolean("trueBlackTheme", false);
showReplies=prefs.getBoolean("showReplies", true);
showBoosts=prefs.getBoolean("showBoosts", true);
loadNewPosts=prefs.getBoolean("loadNewPosts", true);
showFederatedTimeline=prefs.getBoolean("showFederatedTimeline", !BuildConfig.BUILD_TYPE.equals("playRelease"));
showInteractionCounts=prefs.getBoolean("showInteractionCounts", false);
alwaysExpandContentWarnings=prefs.getBoolean("alwaysExpandContentWarnings", false);
disableMarquee=prefs.getBoolean("disableMarquee", false);
voteButtonForSingleChoice=prefs.getBoolean("voteButtonForSingleChoice", true);
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
color=ColorPreference.values()[prefs.getInt("color", 0)];
}
public static void save(){
getPrefs().edit()
.putBoolean("playGifs", playGifs)
.putBoolean("useCustomTabs", useCustomTabs)
.putBoolean("showReplies", showReplies)
.putBoolean("showBoosts", showBoosts)
.putBoolean("loadNewPosts", loadNewPosts)
.putBoolean("showFederatedTimeline", showFederatedTimeline)
.putBoolean("trueBlackTheme", trueBlackTheme)
.putBoolean("showInteractionCounts", showInteractionCounts)
.putBoolean("alwaysExpandContentWarnings", alwaysExpandContentWarnings)
.putBoolean("disableMarquee", disableMarquee)
.putInt("theme", theme.ordinal())
.putInt("color", color.ordinal())
.apply();
}
public enum ColorPreference{
PINK,
PURPLE,
GREEN,
BLUE,
BROWN,
YELLOW
}
public enum ThemePreference{
AUTO,
LIGHT,
DARK
}
}