Adding an option for enabling/disabling the fab. Still missing an icon and text

This commit is contained in:
LucasGGamerM 2023-01-23 17:39:59 -03:00
parent 739d30c887
commit 6a84462b79
3 changed files with 9 additions and 1 deletions

View File

@ -33,6 +33,7 @@ public class GlobalUserPreferences{
public static boolean relocatePublishButton;
public static boolean reduceMotion;
public static boolean keepOnlyLatestNotification;
public static boolean disableFab;
public static String publishButtonText;
public static ThemePreference theme;
public static ColorPreference color;
@ -72,6 +73,7 @@ public class GlobalUserPreferences{
enableDeleteNotifications=prefs.getBoolean("enableDeleteNotifications", true);
reduceMotion=prefs.getBoolean("reduceMotion", false);
keepOnlyLatestNotification=prefs.getBoolean("keepOnlyLatestNotification", false);
disableFab=prefs.getBoolean("disableFab", false);
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
recentEmojis=fromJson(prefs.getString("recentEmojis", "{}"), recentEmojisType, new HashMap<>());
@ -108,6 +110,7 @@ public class GlobalUserPreferences{
.putBoolean("enableDeleteNotifications", enableDeleteNotifications)
.putBoolean("reduceMotion", reduceMotion)
.putBoolean("keepOnlyLatestNotification", keepOnlyLatestNotification)
.putBoolean("disableFab", disableFab)
.putString("publishButtonText", publishButtonText)
.putInt("theme", theme.ordinal())
.putString("color", color.name())

View File

@ -286,7 +286,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
if(currentPhotoViewer!=null)
currentPhotoViewer.offsetView(-dx, -dy);
if (fab!=null) {
if (fab!=null && !GlobalUserPreferences.disableFab) {
if (dy > 0 /*&& !isFirstLaunch*/) {
if (isScrollingUp /*&& !isFirstLaunch*/) {
fab.setVisibility(View.INVISIBLE);

View File

@ -211,6 +211,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
GlobalUserPreferences.save();
needAppRestart=true;
}));
items.add(new SwitchItem(R.string.sk_settings_reduce_motion, R.drawable.ic_fluent_star_emphasis_24_regular, GlobalUserPreferences.disableFab, i->{
GlobalUserPreferences.disableFab=i.checked;
GlobalUserPreferences.save();
needAppRestart=true;
}));
// items.add(new SwitchItem(R.string.sk_enable_delete_notifications, R.drawable.ic_fluent_delete_24_regular, GlobalUserPreferences.enableDeleteNotifications, i->{
// GlobalUserPreferences.enableDeleteNotifications=i.checked;
// GlobalUserPreferences.save();