Skip to content

Instantly share code, notes, and snippets.

@ShaishavGandhi
Last active December 17, 2017 22:05
Show Gist options
  • Save ShaishavGandhi/d22e4d7f810db739c17125fcf96a9f4c to your computer and use it in GitHub Desktop.
Save ShaishavGandhi/d22e4d7f810db739c17125fcf96a9f4c to your computer and use it in GitHub Desktop.
class BlogPresenter(val blogRepository: BlogRepository, val view : BlogView) {
fun blogs() {
val disposable = blogRepository.blogs()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(object : DisposableObserver<List<Blog>>() {
override fun onComplete() {
}
override fun onNext(blogs: List<Blog>) {
blogView.setBlogs(blogs)
}
override fun onError(e: Throwable) {
}
})
compositeDisposable.add(disposable)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment