Refactoring the enableHideFab option, and increasing the threshold for the fab popping up from 400 to 800

This commit is contained in:
LucasGGamerM 2023-01-26 20:15:50 -03:00
parent 51d4fd63db
commit 45832355a3
3 changed files with 7 additions and 7 deletions

View File

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

View File

@ -285,7 +285,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
if(currentPhotoViewer!=null)
currentPhotoViewer.offsetView(-dx, -dy);
if (fab!=null && GlobalUserPreferences.disableFabAutoHide) {
if (fab!=null && GlobalUserPreferences.enableFabAutoHide) {
if (dy > 0 && fab.getVisibility() == View.VISIBLE) {
TranslateAnimation animate = new TranslateAnimation(
0,
@ -298,7 +298,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
fab.setVisibility(View.INVISIBLE);
scrollDiff = 0;
} else if (dy < 0 && fab.getVisibility() != View.VISIBLE) {
if (scrollDiff > 400) {
if (scrollDiff > 800) {
fab.setVisibility(View.VISIBLE);
TranslateAnimation animate = new TranslateAnimation(
0,

View File

@ -210,8 +210,8 @@ public class SettingsFragment extends MastodonToolbarFragment{
GlobalUserPreferences.save();
needAppRestart=true;
}));
items.add(new SwitchItem(R.string.mo_hide_compose_button_while_scrolling_setting, R.drawable.ic_fluent_edit_24_regular, GlobalUserPreferences.disableFabAutoHide, i->{
GlobalUserPreferences.disableFabAutoHide =i.checked;
items.add(new SwitchItem(R.string.mo_hide_compose_button_while_scrolling_setting, R.drawable.ic_fluent_edit_24_regular, GlobalUserPreferences.enableFabAutoHide, i->{
GlobalUserPreferences.enableFabAutoHide =i.checked;
GlobalUserPreferences.save();
needAppRestart=true;
}));