Last active
December 17, 2017 22:05
-
-
Save ShaishavGandhi/d22e4d7f810db739c17125fcf96a9f4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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