mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix issue #361 - Allow to turn off remember position in settings
This commit is contained in:
parent
f3422871bc
commit
23ce0c4b06
3 changed files with 15 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -929,6 +929,8 @@
|
|||
<string name="SET_INNER_MARKER" translatable="false">SET_INNER_MARKER</string>
|
||||
|
||||
<string name="SET_NOTIF_SILENT" translatable="false">SET_NOTIF_SILENT</string>
|
||||
|
||||
<string name="SET_REMEMBER_POSITION" translatable="false">SET_REMEMBER_POSITION</string>
|
||||
<string name="SET_EXPAND_CW" translatable="false">SET_EXPAND_CW</string>
|
||||
<string name="SET_DISPLAY_ALL_NOTIFICATIONS_TYPE" translatable="false">SET_DISPLAY_ALL_NOTIFICATIONS_TYPE</string>
|
||||
<string name="SET_EXCLUDED_NOTIFICATIONS_TYPE" translatable="false">SET_EXCLUDED_NOTIFICATIONS_TYPE</string>
|
||||
|
@ -1483,4 +1485,5 @@
|
|||
<string name="set_display_counters">Display counters</string>
|
||||
<string name="set_display_counters_description">Will display a bubble counter in tab timelines for new messages</string>
|
||||
<string name="view_the_original_message">Open the original message</string>
|
||||
<string name="remember_position">Remember position in timelines</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_REMEMBER_POSITION"
|
||||
app:singleLineTitle="false"
|
||||
app:title="@string/remember_position" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
app:iconSpaceReserved="false"
|
||||
|
|
Loading…
Reference in a new issue