Created
August 11, 2019 08:06
-
-
Save drawers/7b5bb53e9018184db4973e66c50f081b to your computer and use it in GitHub Desktop.
A naive implementation using debounce
This file contains 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
override fun onStart() { | |
super.onStart() | |
source().viewStates() | |
.debounce { | |
when { | |
it.isLoading() -> Observable.timer(250, TimeUnit.MILLISECONDS) | |
else -> Observable.empty() | |
} | |
} | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe { data: PickupData -> | |
adapter.setData(data) | |
} | |
.addTo(disposables) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment