1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00
This commit is contained in:
Ammar Githam 2021-04-09 19:54:38 +09:00
parent f570ea6146
commit 1c1e5f0654

View File

@ -24,6 +24,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import awais.instagrabber.R; import awais.instagrabber.R;
@ -98,8 +99,7 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
final Context context = getContext(); final Context context = getContext();
Toast.makeText(context, R.string.empty_list, Toast.LENGTH_SHORT).show(); Toast.makeText(context, R.string.empty_list, Toast.LENGTH_SHORT).show();
} catch (Exception ignored) {} } catch (Exception ignored) {}
} } else {
else {
endCursor = result.getNextCursor(); endCursor = result.getNextCursor();
final List<HighlightModel> models = archivesViewModel.getList().getValue(); final List<HighlightModel> models = archivesViewModel.getList().getValue();
final List<HighlightModel> modelsCopy = models == null ? new ArrayList<>() : new ArrayList<>(models); final List<HighlightModel> modelsCopy = models == null ? new ArrayList<>() : new ArrayList<>(models);
@ -198,7 +198,13 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
adapter = new FeedStoriesListAdapter(clickListener); adapter = new FeedStoriesListAdapter(clickListener);
binding.rvStories.setLayoutManager(layoutManager); binding.rvStories.setLayoutManager(layoutManager);
binding.rvStories.setAdapter(adapter); binding.rvStories.setAdapter(adapter);
feedStoriesViewModel.getList().observe(getViewLifecycleOwner(), adapter::submitList); feedStoriesViewModel.getList().observe(getViewLifecycleOwner(), list -> {
if (list == null) {
adapter.submitList(Collections.emptyList());
return;
}
adapter.submitList(list);
});
} else { } else {
if (actionBar != null) actionBar.setTitle(R.string.action_archive); if (actionBar != null) actionBar.setTitle(R.string.action_archive);
final RecyclerLazyLoader lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> { final RecyclerLazyLoader lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {