summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas <tschneider.ac@gmail.com>2024-01-13 16:27:35 +0100
committerThomas <tschneider.ac@gmail.com>2024-01-13 16:27:35 +0100
commit68b2c72414d2d04be65903ec220934f656309fd7 (patch)
tree5d3e956fda7477ce0ab892d40e225f7ec11ef30b
parentaeb45f0bcf31d3806d576903f5c51b54484fc3ba (diff)
Fix remember position
-rw-r--r--app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java44
1 files changed, 22 insertions, 22 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java
index b7720b94b..20232c4e8 100644
--- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java
+++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java
@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -426,28 +427,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
statusReport = (Status) bundle.getSerializable(Helper.ARG_STATUS_REPORT);
initialStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
-
- timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class);
- accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class);
- initialStatuses = null;
- lockForResumeCall = 0;
-
- canBeFederated = true;
- retry_for_home_done = false;
- SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
- boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
- binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
- max_id = statusReport != null ? statusReport.id : null;
- offset = 0;
- 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 && 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
- //AND Only the first fragment will initialize its view
- flagLoading = false;
-
//When visiting a profile without being authenticated
if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@");
@@ -484,6 +463,27 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
slug = timelineType != Timeline.TimeLineEnum.ART ? timelineType.getValue() + (ident != null ? "|" + ident : "") : Timeline.TimeLineEnum.TAG.getValue() + (ident != null ? "|" + ident : "");
}
+ timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class);
+ accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class);
+ initialStatuses = null;
+ lockForResumeCall = 0;
+
+ canBeFederated = true;
+ retry_for_home_done = false;
+ SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
+ boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
+ binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
+ max_id = statusReport != null ? statusReport.id : null;
+ offset = 0;
+ 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 && 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
+ //AND Only the first fragment will initialize its view
+ flagLoading = false;
+
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
}