Created
January 4, 2017 17:45
-
-
Save exallium/1f3cea65564aec6b215024cab34e130b to your computer and use it in GitHub Desktop.
rxmvp
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
interface Model { | |
fun first10Users(): Observable<List<Data>> | |
} | |
interface View { | |
fun displayUserList(users: List<Data>) | |
fun backButtonClicks(): Observable<ClickEvent> | |
} | |
class Presenter { | |
@Inject | |
lateinit var model: Model | |
@Inject | |
lateinit var view: View | |
/* injection */ | |
fun setup() { | |
model.first10Users() | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe { view.displayUserList(it) } | |
view.backButtonClicks() | |
.debounce(1000) | |
.subscribe { dismiss() } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment