Last active
April 4, 2018 11:21
-
-
Save micer/93b02625bd078e52c5258eabaaea4449 to your computer and use it in GitHub Desktop.
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
int delay = 25; | |
observableRemainingTime.setValue(TIME_FOR_ANSWER); | |
timerDisposable = Observable.timer(delay, TimeUnit.MILLISECONDS, Schedulers.computation()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.repeatUntil(() -> time <= 0) | |
.subscribe(tick -> { | |
time = time - delay; | |
observableRemainingTime.setValue(time); | |
}, | |
Throwable::printStackTrace, | |
() -> onOptionSelected(null) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment