Last active
September 25, 2019 22:32
-
-
Save Laimiux/46bfa060108ebb25a6cea33b84d5f0a8 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
override fun evaluate( | |
input: Unit, | |
state: State, | |
context: FormulaContext<State> | |
): Evaluation<StopwatchRenderModel> { | |
return Evaluation( | |
renderModel = ..., | |
updates = context.updates { | |
if (state.isRunning) { | |
val incrementTimePassedEvents = RxStream.fromObservable { | |
Observable | |
.interval(1, TimeUnit.MILLISECONDS) | |
.observeOn(AndroidSchedulers.mainThread()) | |
} | |
events(incrementTimePassedEvents) { | |
transition(state.copy( | |
timePassedInMillis = state.timePassedInMillis + 1 | |
)) | |
} | |
} | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment