Touch: fix loading-overlay #33

This commit is contained in:
Felix 2019-02-01 23:51:37 +01:00
parent 113e0eb397
commit 288c11481a

View file

@ -102,27 +102,28 @@ public class EventsListFragment extends BrowseFragment implements SearchView.OnQ
binding.list.setAdapter(eventAdapter); binding.list.setAdapter(eventAdapter);
Observer<List<Event>> listObserver = persistentEvents -> { Observer<List<Event>> listObserver = persistentEvents -> {
setLoadingOverlayVisibility(false);
if (persistentEvents != null) { if (persistentEvents != null) {
setEvents(persistentEvents); setEvents(persistentEvents);
if (persistentEvents.size() > 0) {
setLoadingOverlayVisibility(false);
}
} }
}; };
if (type == TYPE_BOOKMARKS) { if (type == TYPE_BOOKMARKS) {
setupToolbar(binding.incToolbar.toolbar, R.string.bookmarks); setupToolbar(binding.incToolbar.toolbar, R.string.bookmarks);
getViewModel().getBookmarkedEvents().observe(this, listObserver); getViewModel().getBookmarkedEvents().observe(this, listObserver);
setLoadingOverlayVisibility(false);
} else if (type == TYPE_IN_PROGRESS) { } else if (type == TYPE_IN_PROGRESS) {
setupToolbar(binding.incToolbar.toolbar, R.string.continue_watching); setupToolbar(binding.incToolbar.toolbar, R.string.continue_watching);
getViewModel().getInProgressEvents().observe(this, listObserver); getViewModel().getInProgressEvents().observe(this, listObserver);
setLoadingOverlayVisibility(false);
} else if (type == TYPE_EVENTS) { } else if (type == TYPE_EVENTS) {
{ {
setupToolbar(binding.incToolbar.toolbar, conference.getTitle(), false); setupToolbar(binding.incToolbar.toolbar, conference.getTitle(), false);
eventAdapter.setShowTags(conference.getTagsUsefull()); 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 -> { getViewModel().updateEventsForConference(conference).observe(this, state -> {
Downloader.DownloaderState downloaderState = state.getState(); Downloader.DownloaderState downloaderState = state.getState();
switch (downloaderState) { switch (downloaderState) {