diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java
index 3d7f0b88..7f4101b6 100644
--- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java
+++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java
@@ -142,6 +142,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
private String slug;
private TimelinesVM.TimelineParams timelineParams;
private boolean canBeFederated;
+ private boolean rememberPosition;
@Override
public void onResume() {
@@ -272,8 +273,10 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
binding.loader.setVisibility(View.VISIBLE);
binding.recyclerView.setVisibility(View.GONE);
max_id = statusReport != null ? statusReport.id : null;
+
+ rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true);
//Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false
- if (max_id == null && !isViewInitialized) {
+ if (max_id == null && !isViewInitialized && rememberPosition) {
max_id = sharedpreferences.getString(getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null);
}
//Only fragment in main view pager should not have the view initialized
@@ -483,8 +486,8 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
}
}
});
- //For home (first tab) we fetch new messages
- if (timelineType == Timeline.TimeLineEnum.HOME) {
+ //For first tab we fetch new messages, if we keep position
+ if (slug.compareTo(Helper.getSlugOfFirstFragment(requireActivity(), currentUserID, currentInstance)) == 0 && rememberPosition) {
route(DIRECTION.FETCH_NEW, true);
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9c872089..f9a82293 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -929,6 +929,8 @@
SET_INNER_MARKER
SET_NOTIF_SILENT
+
+ SET_REMEMBER_POSITION
SET_EXPAND_CW
SET_DISPLAY_ALL_NOTIFICATIONS_TYPE
SET_EXCLUDED_NOTIFICATIONS_TYPE
@@ -1483,4 +1485,5 @@
Display counters
Will display a bubble counter in tab timelines for new messages
Open the original message
+ Remember position in timelines
diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml
index a5a3e94f..0f062750 100644
--- a/app/src/main/res/xml/pref_timelines.xml
+++ b/app/src/main/res/xml/pref_timelines.xml
@@ -1,6 +1,12 @@
+