Refresh home sections when resuming

This commit is contained in:
ByteHamster 2022-11-27 12:28:24 +01:00
parent 3973f450be
commit 6c1bf9db05
5 changed files with 30 additions and 7 deletions

View File

@ -63,11 +63,15 @@ public class DownloadsSection extends HomeSection {
SwipeActions swipeActions = new SwipeActions(this, CompletedDownloadsFragment.TAG); SwipeActions swipeActions = new SwipeActions(this, CompletedDownloadsFragment.TAG);
swipeActions.attachTo(viewBinding.recyclerView); swipeActions.attachTo(viewBinding.recyclerView);
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.DOWNLOADED)); swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.DOWNLOADED));
loadItems();
return view; return view;
} }
@Override
public void onStart() {
super.onStart();
loadItems();
}
@Override @Override
protected void handleMoreClick() { protected void handleMoreClick() {
((MainActivity) requireActivity()).loadChildFragment(new CompletedDownloadsFragment()); ((MainActivity) requireActivity()).loadChildFragment(new CompletedDownloadsFragment());

View File

@ -68,10 +68,15 @@ public class EpisodesSurpriseSection extends HomeSection {
if (seed == 0) { if (seed == 0) {
seed = new Random().nextInt(); seed = new Random().nextInt();
} }
loadItems();
return view; return view;
} }
@Override
public void onStart() {
super.onStart();
loadItems();
}
@Override @Override
protected void handleMoreClick() { protected void handleMoreClick() {
((MainActivity) requireActivity()).loadChildFragment(new AllEpisodesFragment()); ((MainActivity) requireActivity()).loadChildFragment(new AllEpisodesFragment());

View File

@ -65,11 +65,15 @@ public class InboxSection extends HomeSection {
SwipeActions swipeActions = new SwipeActions(this, InboxFragment.TAG); SwipeActions swipeActions = new SwipeActions(this, InboxFragment.TAG);
swipeActions.attachTo(viewBinding.recyclerView); swipeActions.attachTo(viewBinding.recyclerView);
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.NEW)); swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.NEW));
loadItems();
return view; return view;
} }
@Override
public void onStart() {
super.onStart();
loadItems();
}
@Override @Override
protected void handleMoreClick() { protected void handleMoreClick() {
((MainActivity) requireActivity()).loadChildFragment(new InboxFragment()); ((MainActivity) requireActivity()).loadChildFragment(new InboxFragment());

View File

@ -58,10 +58,15 @@ public class QueueSection extends HomeSection {
viewBinding.recyclerView.setLayoutManager( viewBinding.recyclerView.setLayoutManager(
new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false)); new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false));
viewBinding.recyclerView.setAdapter(listAdapter); viewBinding.recyclerView.setAdapter(listAdapter);
loadItems();
return view; return view;
} }
@Override
public void onStart() {
super.onStart();
loadItems();
}
@Override @Override
protected void handleMoreClick() { protected void handleMoreClick() {
((MainActivity) requireActivity()).loadChildFragment(new QueueFragment()); ((MainActivity) requireActivity()).loadChildFragment(new QueueFragment());

View File

@ -44,10 +44,15 @@ public class SubscriptionsSection extends HomeSection {
listAdapter = new HorizontalFeedListAdapter((MainActivity) getActivity()); listAdapter = new HorizontalFeedListAdapter((MainActivity) getActivity());
listAdapter.setDummyViews(NUM_FEEDS); listAdapter.setDummyViews(NUM_FEEDS);
viewBinding.recyclerView.setAdapter(listAdapter); viewBinding.recyclerView.setAdapter(listAdapter);
loadItems();
return view; return view;
} }
@Override
public void onStart() {
super.onStart();
loadItems();
}
@Override @Override
protected void handleMoreClick() { protected void handleMoreClick() {
((MainActivity) requireActivity()).loadChildFragment(new SubscriptionFragment()); ((MainActivity) requireActivity()).loadChildFragment(new SubscriptionFragment());