diff --git a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java index 01222a88d..c70008f6c 100644 --- a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java @@ -242,6 +242,7 @@ public class PinnedTimelineHelper { } } List pinnedTimelineVisibleList = new ArrayList<>(); + List 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; diff --git a/app/src/main/java/app/fedilab/android/ui/pageadapter/FedilabPageAdapter.java b/app/src/main/java/app/fedilab/android/ui/pageadapter/FedilabPageAdapter.java index ae534cf8c..76e296c22 100644 --- a/app/src/main/java/app/fedilab/android/ui/pageadapter/FedilabPageAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/pageadapter/FedilabPageAdapter.java @@ -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) {