From 9b91a51df81e90c7578df12adc6b7e2197348b28 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 30 Apr 2019 18:57:09 +0200 Subject: [PATCH] Fixed empty list not receiving updates --- .../antennapod/fragment/AllEpisodesFragment.java | 11 +++++++++-- .../de/danoeh/antennapod/fragment/QueueFragment.java | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index ec06f081a..5dca2aa84 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -431,7 +431,10 @@ public class AllEpisodesFragment extends Fragment { public void onEventMainThread(FeedItemEvent event) { Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); - if (episodes == null || listAdapter == null) { + if (episodes == null) { + return; + } else if (listAdapter == null) { + loadItems(); return; } for (FeedItem item : event.items) { @@ -459,7 +462,11 @@ public class AllEpisodesFragment extends Fragment { if (isMenuInvalidationAllowed && isUpdatingFeeds != update.feedIds.length > 0) { getActivity().supportInvalidateOptionsMenu(); } - if(listAdapter != null && update.mediaIds.length > 0) { + if (listAdapter == null) { + loadItems(); + return; + } + if (update.mediaIds.length > 0) { for(long mediaId : update.mediaIds) { int pos = FeedItemUtil.indexOfItemWithMediaId(episodes, mediaId); if(pos >= 0) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index d19a9b2f3..58bfa3e08 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -125,7 +125,10 @@ public class QueueFragment extends Fragment { public void onEventMainThread(QueueEvent event) { Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); - if(queue == null || recyclerAdapter == null) { + if (queue == null) { + return; + } else if (recyclerAdapter == null) { + loadItems(true); return; } switch(event.action) { @@ -160,7 +163,10 @@ public class QueueFragment extends Fragment { public void onEventMainThread(FeedItemEvent event) { Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); - if(queue == null || recyclerAdapter == null) { + if (queue == null) { + return; + } else if (recyclerAdapter == null) { + loadItems(true); return; } for(int i=0, size = event.items.size(); i < size; i++) {