Merge branch 'settings/load-new-posts' into fork

This commit is contained in:
sk
2022-11-09 10:31:30 +01:00
6 changed files with 13 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ public class GlobalUserPreferences{
public static boolean trueBlackTheme; public static boolean trueBlackTheme;
public static boolean showReplies; public static boolean showReplies;
public static boolean showBoosts; public static boolean showBoosts;
public static boolean loadNewPosts;
public static ThemePreference theme; public static ThemePreference theme;
private static SharedPreferences getPrefs(){ private static SharedPreferences getPrefs(){
@@ -22,6 +23,7 @@ public class GlobalUserPreferences{
trueBlackTheme=prefs.getBoolean("trueBlackTheme", false); trueBlackTheme=prefs.getBoolean("trueBlackTheme", false);
showReplies=prefs.getBoolean("showReplies", true); showReplies=prefs.getBoolean("showReplies", true);
showBoosts=prefs.getBoolean("showBoosts", true); showBoosts=prefs.getBoolean("showBoosts", true);
loadNewPosts=prefs.getBoolean("loadNewPosts", true);
theme=ThemePreference.values()[prefs.getInt("theme", 0)]; theme=ThemePreference.values()[prefs.getInt("theme", 0)];
} }
@@ -31,6 +33,7 @@ public class GlobalUserPreferences{
.putBoolean("useCustomTabs", useCustomTabs) .putBoolean("useCustomTabs", useCustomTabs)
.putBoolean("showReplies", showReplies) .putBoolean("showReplies", showReplies)
.putBoolean("showBoosts", showBoosts) .putBoolean("showBoosts", showBoosts)
.putBoolean("loadNewPosts", loadNewPosts)
.putBoolean("trueBlackTheme", trueBlackTheme) .putBoolean("trueBlackTheme", trueBlackTheme)
.putInt("theme", theme.ordinal()) .putInt("theme", theme.ordinal())
.apply(); .apply();

View File

@@ -162,6 +162,7 @@ public class HomeTimelineFragment extends StatusListFragment{
} }
private void loadNewPosts(){ private void loadNewPosts(){
if (!GlobalUserPreferences.loadNewPosts) return;
dataLoading=true; dataLoading=true;
// The idea here is that we request the timeline such that if there are fewer than `limit` posts, // The idea here is that we request the timeline such that if there are fewer than `limit` posts,
// we'll get the currently topmost post as last in the response. This way we know there's no gap // we'll get the currently topmost post as last in the response. This way we know there's no gap

View File

@@ -104,6 +104,10 @@ public class SettingsFragment extends MastodonToolbarFragment{
GlobalUserPreferences.useCustomTabs=i.checked; GlobalUserPreferences.useCustomTabs=i.checked;
GlobalUserPreferences.save(); GlobalUserPreferences.save();
})); }));
items.add(new SwitchItem(R.string.settings_load_new_posts, R.drawable.ic_fluent_arrow_up_24_regular, GlobalUserPreferences.loadNewPosts, i->{
GlobalUserPreferences.loadNewPosts=i.checked;
GlobalUserPreferences.save();
}));
items.add(new HeaderItem(R.string.home_timeline)); items.add(new HeaderItem(R.string.home_timeline));
items.add(new SwitchItem(R.string.settings_show_replies, R.drawable.ic_fluent_chat_multiple_24_regular, GlobalUserPreferences.showReplies, i->{ items.add(new SwitchItem(R.string.settings_show_replies, R.drawable.ic_fluent_chat_multiple_24_regular, GlobalUserPreferences.showReplies, i->{

View File

@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:pathData="M4.209 10.733c-0.286 0.3-0.274 0.774 0.026 1.06 0.3 0.286 0.774 0.274 1.06-0.026l5.954-6.251V20.25c0 0.414 0.336 0.75 0.75 0.75 0.415 0 0.75-0.336 0.75-0.75V5.516l5.955 6.251c0.286 0.3 0.76 0.312 1.06 0.026 0.3-0.286 0.312-0.76 0.027-1.06l-7.067-7.42c-0.161-0.168-0.367-0.268-0.58-0.3C12.097 3.006 12.049 3 11.999 3c-0.05 0-0.098 0.005-0.145 0.014-0.213 0.031-0.418 0.131-0.578 0.3l-7.067 7.419z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -254,6 +254,7 @@
<string name="settings_behavior">App-Verhalten</string> <string name="settings_behavior">App-Verhalten</string>
<string name="settings_show_replies">Antworten anzeigen</string> <string name="settings_show_replies">Antworten anzeigen</string>
<string name="settings_show_boosts">Geteilte Beiträge anzeigen</string> <string name="settings_show_boosts">Geteilte Beiträge anzeigen</string>
<string name="settings_load_new_posts">Automatisch neue Beiträge laden</string>
<string name="settings_gif">Spiele animierte GIFs, Avatare und Emojis ab</string> <string name="settings_gif">Spiele animierte GIFs, Avatare und Emojis ab</string>
<string name="settings_custom_tabs">In-App-Browser verwenden</string> <string name="settings_custom_tabs">In-App-Browser verwenden</string>
<string name="settings_notifications">Benachrichtigungen</string> <string name="settings_notifications">Benachrichtigungen</string>

View File

@@ -258,6 +258,7 @@
<string name="settings_behavior">Behavior</string> <string name="settings_behavior">Behavior</string>
<string name="settings_show_replies">Show replies</string> <string name="settings_show_replies">Show replies</string>
<string name="settings_show_boosts">Show boosts</string> <string name="settings_show_boosts">Show boosts</string>
<string name="settings_load_new_posts">Automatically load new posts</string>
<string name="settings_gif">Play animated avatars and emoji</string> <string name="settings_gif">Play animated avatars and emoji</string>
<string name="settings_custom_tabs">Use in-app browser</string> <string name="settings_custom_tabs">Use in-app browser</string>
<string name="settings_notifications">Notifications</string> <string name="settings_notifications">Notifications</string>