Skip to content

Instantly share code, notes, and snippets.

@motorro
Created July 31, 2022 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motorro/c3bd6a80b6a2ad359161a813c3ee59ff to your computer and use it in GitHub Desktop.
Save motorro/c3bd6a80b6a2ad359161a813c3ee59ff to your computer and use it in GitHub Desktop.
Item contents state
class ContentState(private val contents: String) : CommonMachineState<LceGesture, LceUiState>() {
override fun doStart() {
setUiState(LceUiState.Item(contents))
}
override fun doProcess(gesture: LceGesture) = when (gesture) {
LceGesture.Back -> onBack()
else -> Timber.d("Unhandled gesture: %s", gesture)
}
private fun onBack() {
setMachineState(ItemListState())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment