1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-21 22:27:29 +00:00
This commit is contained in:
Ammar Githam 2021-04-18 16:46:36 +09:00
parent 42e4580209
commit 627b1bfe76
3 changed files with 17 additions and 4 deletions

5
.codebeatsettings Normal file
View File

@ -0,0 +1,5 @@
{
"JAVA": {
"TOO_MANY_IVARS": [8, 10, 20, 30]
}
}

View File

@ -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>>() {

View File

@ -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() {