Skip to content

Instantly share code, notes, and snippets.

@Laimiux
Last active September 24, 2019 18:43
Show Gist options
  • Save Laimiux/cc27248df063d73b833c95f4024fd041 to your computer and use it in GitHub Desktop.
Save Laimiux/cc27248df063d73b833c95f4024fd041 to your computer and use it in GitHub Desktop.
class StopwatchRenderView(root: ViewGroup): RenderView<StopwatchRenderModel> {
private val timePassed: TextView = root.findViewById(R.id.time_passed_text_view)
private val startStopButton: Button = root.findViewById(R.id.start_stop_button)
private val resetButton: Button = root.findViewById(R.id.reset_button)
override val renderer: Renderer<StopwatchRenderModel> = Renderer.create { model ->
timePassed.text = model.timePassed
startStopButton.text = model.startStopButton.text
startStopButton.setOnClickListener {
model.startStopButton.onSelected()
}
resetButton.text = model.resetButton.text
resetButton.setOnClickListener {
model.resetButton.onSelected()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment