Fix offset with pinned

This commit is contained in:
Thomas 2022-09-14 11:27:27 +02:00
parent 9f6ca2270d
commit a658d17e2c
2 changed files with 6 additions and 3 deletions

View File

@ -242,6 +242,7 @@ public class PinnedTimelineHelper {
}
}
List<PinnedTimeline> pinnedTimelineVisibleList = new ArrayList<>();
List<PinnedTimeline> pinnedToRemove = new ArrayList<>();
for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
//Default timelines are not added if we are not in the single bar mode
if (!singleBar) {
@ -251,6 +252,7 @@ public class PinnedTimelineHelper {
case PUBLIC:
case NOTIFICATION:
case DIRECT:
pinnedToRemove.add(pinnedTimeline);
continue;
}
}
@ -328,7 +330,7 @@ public class PinnedTimelineHelper {
pinnedTimelineVisibleList.add(pinnedTimeline);
}
}
pinned.pinnedTimelines.removeAll(pinnedToRemove);
Pinned finalPinned = pinned;
int finalToRemove1 = toRemove;

View File

@ -45,13 +45,14 @@ public class FedilabPageAdapter extends FragmentStatePagerAdapter {
private final BottomMenu bottomMenu;
private final int toRemove;
private Fragment mCurrentFragment;
private final boolean singleBar;
public FedilabPageAdapter(BaseMainActivity activity, FragmentManager fm, Pinned pinned, BottomMenu bottomMenu) {
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
this.pinned = pinned;
this.bottomMenu = bottomMenu;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
boolean singleBar = sharedpreferences.getBoolean(activity.getString(R.string.SET_USE_SINGLE_TOPBAR), false);
singleBar = sharedpreferences.getBoolean(activity.getString(R.string.SET_USE_SINGLE_TOPBAR), false);
if (!singleBar) {
toRemove = PinnedTimelineHelper.itemToRemoveInBottomMenu(activity);
} else {
@ -87,7 +88,7 @@ public class FedilabPageAdapter extends FragmentStatePagerAdapter {
FragmentMastodonTimeline fragment = new FragmentMastodonTimeline();
Bundle bundle = new Bundle();
//Position 3 is for notifications
if (position < (BOTTOM_TIMELINE_COUNT - toRemove)) {
if (position < (BOTTOM_TIMELINE_COUNT - toRemove) && !singleBar) {
if (bottomMenu != null) {
BottomMenu.ItemMenuType type = BottomMenu.getType(bottomMenu, position);
if (type == null) {