use of de.danoeh.antennapod.core.storage.NavDrawerData in project AntennaPod by AntennaPod.
the class SubscriptionFragment method loadSubscriptions.
private void loadSubscriptions() {
if (disposable != null) {
disposable.dispose();
}
emptyView.hide();
disposable = Observable.fromCallable(() -> {
NavDrawerData data = DBReader.getNavDrawerData();
List<NavDrawerData.DrawerItem> items = data.items;
for (NavDrawerData.DrawerItem item : items) {
if (item.type == NavDrawerData.DrawerItem.Type.TAG && item.getTitle().equals(displayedFolder)) {
return ((NavDrawerData.TagDrawerItem) item).children;
}
}
return items;
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(result -> {
if (listItems != null && listItems.size() > result.size()) {
// We have fewer items. This can result in items being selected that are no longer visible.
subscriptionAdapter.endSelectMode();
}
listItems = result;
subscriptionAdapter.setItems(result);
subscriptionAdapter.notifyDataSetChanged();
emptyView.updateVisibility();
// Keep hidden to avoid flickering while refreshing
progressBar.setVisibility(View.GONE);
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
progressBar.setVisibility(View.GONE);
});
if (UserPreferences.getSubscriptionsFilter().isEnabled()) {
feedsFilteredMsg.setText("{md-info-outline} " + getString(R.string.subscriptions_are_filtered));
Iconify.addIcons(feedsFilteredMsg);
feedsFilteredMsg.setVisibility(View.VISIBLE);
} else {
feedsFilteredMsg.setVisibility(View.GONE);
}
}
Aggregations