Last active
January 22, 2020 11:47
-
-
Save macsystems/ce7a0537b8a7085c24255bb8627aa8dc to your computer and use it in GitHub Desktop.
Using sealed class to change progressbar visibility
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
fun ProgressBar.handleState(resource: Resource<Any>) { | |
visibility = when (resource) { | |
is Loading -> View.VISIBLE | |
is Error -> View.GONE | |
is Success -> View.GONE | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment