mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix remember position
This commit is contained in:
parent
aeb45f0bcf
commit
68b2c72414
1 changed files with 22 additions and 22 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue