Fix issue #299 - Crashes with pinned timelines

This commit is contained in:
Thomas 2022-09-07 17:42:10 +02:00
parent b7d966a873
commit 2180da64b7
2 changed files with 4 additions and 14 deletions

View file

@ -577,9 +577,7 @@ public class PinnedTimelineHelper {
} }
fragTransaction1.detach(fragmentMastodonTimeline).commit(); fragTransaction1.detach(fragmentMastodonTimeline).commit();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(offSetPosition));
bundle.putString("instanceType", remoteInstance.type.getValue());
bundle.putString("timelineId", remoteInstance.id);
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction(); FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
@ -623,10 +621,7 @@ public class PinnedTimelineHelper {
currentFilter[0] = remoteInstance.filteredWith; currentFilter[0] = remoteInstance.filteredWith;
fragTransaction1.detach(fragmentMastodonTimeline).commit(); fragTransaction1.detach(fragmentMastodonTimeline).commit();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(offSetPosition));
bundle.putString("instanceType", remoteInstance.type.getValue());
bundle.putString("timelineId", remoteInstance.id);
bundle.putString("currentfilter", remoteInstance.filteredWith);
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction(); FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
@ -698,12 +693,7 @@ public class PinnedTimelineHelper {
return; return;
fragTransaction1.detach(fragmentMastodonTimeline).commit(); fragTransaction1.detach(fragmentMastodonTimeline).commit();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(offSetPosition));
bundle.putString("instanceType", remoteInstance.type.getValue());
bundle.putString("timelineId", remoteInstance.id);
if (currentFilter[0] != null) {
bundle.putString("currentfilter", remoteInstance.filteredWith);
}
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction(); FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();

View file

@ -108,7 +108,7 @@ public class FedilabPageAdapter extends FragmentStatePagerAdapter {
} else if (pinnedTimeline.type == Timeline.TimeLineEnum.TAG) { } else if (pinnedTimeline.type == Timeline.TimeLineEnum.TAG) {
bundle.putSerializable(Helper.ARG_TAG_TIMELINE, pinnedTimeline.tagTimeline); bundle.putSerializable(Helper.ARG_TAG_TIMELINE, pinnedTimeline.tagTimeline);
} else if (pinnedTimeline.type == Timeline.TimeLineEnum.REMOTE) { } else if (pinnedTimeline.type == Timeline.TimeLineEnum.REMOTE) {
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline);
} }
} }