Skip to content

Instantly share code, notes, and snippets.

@kmshack
Created April 12, 2017 16:03
Show Gist options
  • Save kmshack/76bc28a2a81a7f9040599e6a41d57fd8 to your computer and use it in GitHub Desktop.
Save kmshack/76bc28a2a81a7f9040599e6a41d57fd8 to your computer and use it in GitHub Desktop.
public void loadTodayPosts() {
mMvpView.showProgressIndicator(true);
mSubscription = mDataManager.loadTodayPosts().toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Subscriber<List<Post>>() {
@Override
public void onCompleted() {
mMvpView.showProgressIndicator(false);
}
@Override
public void onError(Throwable e) {
mMvpView.showProgressIndicator(false);
mMvpView.showError();
}
@Override
public void onNext(List<Post> postsList) {
mMvpView.showPosts(postsList);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment