Created
June 14, 2018 11:04
-
-
Save marcinOz/c086a4306439b4b9033543556f6e761e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
movieDiscover.observe(activity, Observer { it?.apply { updateView(this) }}) | |
private fun updateView(resourceState: ResourceState) = when(resourceState) { | |
is LoadingState -> showLoading(true) | |
is PopulatedState<*> -> populate(resourceState.data as List<Movie>) | |
is EmptyState -> showEmptyMessage() | |
is ErrorState -> showError(resourceState.message) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment