Created
June 14, 2018 11:19
-
-
Save marcinOz/5125b244e06fc296f85efd9e38e0ebb8 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
//MovieListViewModel | |
val movieDiscover = MutableLiveData<ResourceState<List<Movie>>>() | |
//View | |
private fun updateView(resourceState: ResourceState<List<Movie>>) = when(resourceState) { | |
is LoadingState -> showLoading(true) | |
is PopulatedState -> populate(resourceState.data) | |
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