Skip to content

Instantly share code, notes, and snippets.

@ValeryPonomarenko
Last active June 13, 2019 23:51
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 ValeryPonomarenko/8161f039a0708074c6396ba30f56da12 to your computer and use it in GitHub Desktop.
Save ValeryPonomarenko/8161f039a0708074c6396ba30f56da12 to your computer and use it in GitHub Desktop.
Rendering a Screen Based On Its ViewState
viewModel.viewState.observe(this) {
when (it) {
is SearchViewState.Entering -> {
text_destination_from.text = it.from.name
text_small_from.text = it.from.shortName
text_destination_to.text = it.to.name
text_small_to.text = it.to.shortName
}
is SearchViewState.Loaded -> {
adapter.flights = it.flights
adapter.notifyDataSetChanged()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment