Merge pull request #3147 from ByteHamster/fix-empty-list

Fixed empty list not receiving updates
This commit is contained in:
Martin Fietz 2019-04-30 20:55:12 +02:00 committed by GitHub
commit 954cf87eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) { public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
if (episodes == null || listAdapter == null) { if (episodes == null) {
return;
} else if (listAdapter == null) {
loadItems();
return; return;
} }
for (FeedItem item : event.items) { for (FeedItem item : event.items) {
@ -459,7 +462,11 @@ public class AllEpisodesFragment extends Fragment {
if (isMenuInvalidationAllowed && isUpdatingFeeds != update.feedIds.length > 0) { if (isMenuInvalidationAllowed && isUpdatingFeeds != update.feedIds.length > 0) {
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();
} }
if(listAdapter != null && update.mediaIds.length > 0) { if (listAdapter == null) {
loadItems();
return;
}
if (update.mediaIds.length > 0) {
for(long mediaId : update.mediaIds) { for(long mediaId : update.mediaIds) {
int pos = FeedItemUtil.indexOfItemWithMediaId(episodes, mediaId); int pos = FeedItemUtil.indexOfItemWithMediaId(episodes, mediaId);
if(pos >= 0) { if(pos >= 0) {

View File

@ -125,7 +125,10 @@ public class QueueFragment extends Fragment {
public void onEventMainThread(QueueEvent event) { public void onEventMainThread(QueueEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + 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; return;
} }
switch(event.action) { switch(event.action) {
@ -160,7 +163,10 @@ public class QueueFragment extends Fragment {
public void onEventMainThread(FeedItemEvent event) { public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + 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; return;
} }
for(int i=0, size = event.items.size(); i < size; i++) { for(int i=0, size = event.items.size(); i < size; i++) {