diff --git a/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java b/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java index e803088d9..636e3a125 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java +++ b/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java @@ -23,6 +23,7 @@ public class GlobalUserPreferences{ public static boolean showReplies; public static boolean showBoosts; public static boolean loadNewPosts; + public static boolean showNewPostsButton; public static boolean showInteractionCounts; public static boolean alwaysExpandContentWarnings; public static boolean disableMarquee; @@ -69,6 +70,7 @@ public class GlobalUserPreferences{ showReplies=prefs.getBoolean("showReplies", true); showBoosts=prefs.getBoolean("showBoosts", true); loadNewPosts=prefs.getBoolean("loadNewPosts", true); + showNewPostsButton=prefs.getBoolean("showNewPostsButton", true); uniformNotificationIcon=prefs.getBoolean("uniformNotificationIcon", true); showInteractionCounts=prefs.getBoolean("showInteractionCounts", false); alwaysExpandContentWarnings=prefs.getBoolean("alwaysExpandContentWarnings", false); @@ -111,6 +113,7 @@ public class GlobalUserPreferences{ .putBoolean("showReplies", showReplies) .putBoolean("showBoosts", showBoosts) .putBoolean("loadNewPosts", loadNewPosts) + .putBoolean("showNewPostsButton", showNewPostsButton) .putBoolean("trueBlackTheme", trueBlackTheme) .putBoolean("showInteractionCounts", showInteractionCounts) .putBoolean("alwaysExpandContentWarnings", alwaysExpandContentWarnings) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java index e300d1ab5..fdd0baae7 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java @@ -150,7 +150,7 @@ public class HomeTimelineFragment extends FabStatusListFragment { toAdd=toAdd.stream().filter(filterPredicate).collect(Collectors.toList()); if(!toAdd.isEmpty()){ prependItems(toAdd, true); - if (parent != null) parent.showNewPostsButton(); + if (parent != null && GlobalUserPreferences.showNewPostsButton) parent.showNewPostsButton(); AccountSessionManager.getInstance().getAccount(accountID).getCacheController().putHomeTimeline(toAdd, false); } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index cb4d3be71..6cbac3c62 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -78,6 +78,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ private ArrayList items=new ArrayList<>(); private ThemeItem themeItem; private NotificationPolicyItem notificationPolicyItem; + private SwitchItem loadNewPostsItem, showNewPostsButtonItem; private String accountID; private boolean needUpdateNotificationSettings; private boolean needAppRestart; @@ -245,10 +246,21 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.showBoosts=i.checked; GlobalUserPreferences.save(); })); - items.add(new SwitchItem(R.string.sk_settings_load_new_posts, R.drawable.ic_fluent_arrow_up_24_regular, GlobalUserPreferences.loadNewPosts, i->{ + items.add(loadNewPostsItem = new SwitchItem(R.string.sk_settings_load_new_posts, R.drawable.ic_fluent_arrow_sync_24_regular, GlobalUserPreferences.loadNewPosts, i->{ GlobalUserPreferences.loadNewPosts=i.checked; + showNewPostsButtonItem.enabled = i.checked; + if (!i.checked) { + GlobalUserPreferences.showNewPostsButton = false; + showNewPostsButtonItem.checked = false; + } + if (list.findViewHolderForAdapterPosition(items.indexOf(showNewPostsButtonItem)) instanceof SwitchViewHolder svh) svh.rebind(); GlobalUserPreferences.save(); })); + items.add(showNewPostsButtonItem = new SwitchItem(R.string.sk_settings_show_new_posts_button, R.drawable.ic_fluent_arrow_up_24_regular, GlobalUserPreferences.showNewPostsButton, i->{ + GlobalUserPreferences.showNewPostsButton=i.checked; + GlobalUserPreferences.save(); + })); + showNewPostsButtonItem.enabled = GlobalUserPreferences.loadNewPosts; items.add(new HeaderItem(R.string.settings_notifications)); items.add(notificationPolicyItem=new NotificationPolicyItem()); diff --git a/mastodon/src/main/res/drawable/ic_fluent_arrow_sync_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_arrow_sync_24_regular.xml new file mode 100644 index 000000000..9c0cc31f0 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_arrow_sync_24_regular.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index a35d21c45..1378bef7a 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -235,4 +235,5 @@ Indicator for alt texts Indicator for missing alt texts Enable pre-releases + “Show new posts” button \ No newline at end of file