mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-21 14:17:29 +00:00
Null check and fragment manager check. Fixes https://github.com/austinhuang0131/barinsta/issues/1116
This commit is contained in:
parent
42e4580209
commit
627b1bfe76
5
.codebeatsettings
Normal file
5
.codebeatsettings
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"JAVA": {
|
||||||
|
"TOO_MANY_IVARS": [8, 10, 20, 30]
|
||||||
|
}
|
||||||
|
}
|
@ -51,12 +51,15 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
|
|||||||
private AppCompatActivity fragmentActivity;
|
private AppCompatActivity fragmentActivity;
|
||||||
private FragmentStoryListViewerBinding binding;
|
private FragmentStoryListViewerBinding binding;
|
||||||
private SwipeRefreshLayout root;
|
private SwipeRefreshLayout root;
|
||||||
private boolean shouldRefresh = true, firstRefresh = true;
|
private boolean shouldRefresh = true;
|
||||||
|
private boolean firstRefresh = true;
|
||||||
private FeedStoriesViewModel feedStoriesViewModel;
|
private FeedStoriesViewModel feedStoriesViewModel;
|
||||||
private ArchivesViewModel archivesViewModel;
|
private ArchivesViewModel archivesViewModel;
|
||||||
private StoriesService storiesService;
|
private StoriesService storiesService;
|
||||||
private Context context;
|
private Context context;
|
||||||
private String type, currentQuery, endCursor = null;
|
private String type;
|
||||||
|
private String currentQuery;
|
||||||
|
private String endCursor = null;
|
||||||
private FeedStoriesListAdapter adapter;
|
private FeedStoriesListAdapter adapter;
|
||||||
private MenuItem menuSearch;
|
private MenuItem menuSearch;
|
||||||
|
|
||||||
@ -226,7 +229,10 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
|
|||||||
binding.swipeRefreshLayout.setRefreshing(true);
|
binding.swipeRefreshLayout.setRefreshing(true);
|
||||||
if (type.equals("feed") && firstRefresh) {
|
if (type.equals("feed") && firstRefresh) {
|
||||||
binding.swipeRefreshLayout.setRefreshing(false);
|
binding.swipeRefreshLayout.setRefreshing(false);
|
||||||
adapter.submitList(feedStoriesViewModel.getList().getValue());
|
final List<FeedStoryModel> value = feedStoriesViewModel.getList().getValue();
|
||||||
|
if (value != null) {
|
||||||
|
adapter.submitList(value);
|
||||||
|
}
|
||||||
firstRefresh = false;
|
firstRefresh = false;
|
||||||
} else if (type.equals("feed")) {
|
} else if (type.equals("feed")) {
|
||||||
storiesService.getFeedStories(new ServiceCallback<List<FeedStoryModel>>() {
|
storiesService.getFeedStories(new ServiceCallback<List<FeedStoryModel>>() {
|
||||||
|
@ -264,7 +264,9 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
postViewV2Fragment.dismiss();
|
postViewV2Fragment.dismiss();
|
||||||
binding.postsRecyclerView.refresh();
|
binding.postsRecyclerView.refresh();
|
||||||
});
|
});
|
||||||
postViewV2Fragment.show(getChildFragmentManager(), "post_view");
|
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||||
|
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) return;
|
||||||
|
postViewV2Fragment.show(fragmentManager, "post_view");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() {
|
private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() {
|
||||||
|
Loading…
Reference in New Issue
Block a user