Last active
November 6, 2018 14:26
-
-
Save sanogueralorenzo/a71c009504ac8bbece4c497e28d57350 to your computer and use it in GitHub Desktop.
This file contains 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
private fun updateUsers(resource: Resource<List<Users>>?) { | |
resource?.let { | |
when (it.state) { | |
ResourceState.LOADING -> loading.visible() | |
ResourceState.SUCCESS -> loading.gone() | |
ResourceState.ERROR -> loading.gone() | |
} | |
it.data?.let { adapter.addItems(it) } | |
it.message?.let { snackBar.show() } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment