Fixed empty list not receiving updates

This commit is contained in:
ByteHamster 2019-04-30 18:57:09 +02:00
parent a4dc3d9e96
commit 9b91a51df8
2 changed files with 17 additions and 4 deletions

View File

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

View File

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