From 288c11481a19928f442eddba9264d8b771bb4042 Mon Sep 17 00:00:00 2001 From: Felix Date: Fri, 1 Feb 2019 23:51:37 +0100 Subject: [PATCH] Touch: fix loading-overlay #33 --- .../touch/browse/eventslist/EventsListFragment.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/browse/eventslist/EventsListFragment.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/browse/eventslist/EventsListFragment.java index 247ff889..c1327762 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/browse/eventslist/EventsListFragment.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/browse/eventslist/EventsListFragment.java @@ -102,27 +102,28 @@ public class EventsListFragment extends BrowseFragment implements SearchView.OnQ binding.list.setAdapter(eventAdapter); Observer> listObserver = persistentEvents -> { + setLoadingOverlayVisibility(false); if (persistentEvents != null) { setEvents(persistentEvents); - if (persistentEvents.size() > 0) { - setLoadingOverlayVisibility(false); - } } }; if (type == TYPE_BOOKMARKS) { setupToolbar(binding.incToolbar.toolbar, R.string.bookmarks); getViewModel().getBookmarkedEvents().observe(this, listObserver); - setLoadingOverlayVisibility(false); } else if (type == TYPE_IN_PROGRESS) { setupToolbar(binding.incToolbar.toolbar, R.string.continue_watching); getViewModel().getInProgressEvents().observe(this, listObserver); - setLoadingOverlayVisibility(false); } else if (type == TYPE_EVENTS) { { setupToolbar(binding.incToolbar.toolbar, conference.getTitle(), false); eventAdapter.setShowTags(conference.getTagsUsefull()); - getViewModel().getEventsforConference(conference).observe(this, listObserver); + getViewModel().getEventsforConference(conference).observe(this, events -> { + if(events != null){ + setEvents(events); + setLoadingOverlayVisibility(false); + } + }); getViewModel().updateEventsForConference(conference).observe(this, state -> { Downloader.DownloaderState downloaderState = state.getState(); switch (downloaderState) {