Created
July 13, 2020 01:46
-
-
Save sberoch/c65f1bdcf5fd2f96618abf7c543b62ff 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
viewModel.characters.observe(viewLifecycleOwner, Observer { | |
when (it.status) { | |
Resource.Status.SUCCESS -> { | |
progress_bar.visibility = View.GONE | |
if (!it.data.isNullOrEmpty()) adapter.setItems(ArrayList(it.data)) | |
} | |
Resource.Status.ERROR -> | |
Toast.makeText(activity, it.message, Toast.LENGTH_SHORT).show() | |
Resource.Status.LOADING -> | |
progress_bar.visibility = View.VISIBLE | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment