use of butter.droid.ui.main.pager.NavInfo in project butter-android by butterproject.
the class MainPresenterImpl method displayProviderData.
private void displayProviderData(final int providerId) {
this.selectedProviderId = providerId;
final ProviderWrapper provider = providerManager.getProvider(providerId);
final MediaProvider mediaProvider = provider.getMediaProvider();
unsubscribeProviderId(providerId);
Observable.concat(mediaProvider.genres().filter(genres -> genres != null && genres.size() > 0).map(g -> new NavInfo(R.id.nav_item_genre, 0, R.string.genres, providerId)).toObservable(), mediaProvider.navigation().flatMapObservable(Observable::fromIterable).map(item -> new NavInfo(item, providerId))).toList().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<List<NavInfo>>() {
@Override
public void onSubscribe(final Disposable d) {
providerDataDisposable.add(providerId, d);
}
@Override
public void onSuccess(final List<NavInfo> value) {
// TODO: 8/5/17 Do we need this
// boolean hasGenres = value.first != null && value.first.size() > 0;
view.displayProvider(provider.getDisplayName(), value);
}
@Override
public void onError(final Throwable e) {
// TODO: 8/5/17 Display error
}
});
}
Aggregations