Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Last active March 1, 2021 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulh82vlc/1e410bd07974f4e27cd61eb88dd535a0 to your computer and use it in GitHub Desktop.
Save raulh82vlc/1e410bd07974f4e27cd61eb88dd535a0 to your computer and use it in GitHub Desktop.
StateUIValue with all other UI states
@Composable
fun StateUIValue(uiState: TweetsUIState) {
when (uiState) {
is TweetsUIState.ListResultsUIState -> TweetList(tweets = uiState.tweets)
is TweetsUIState.LoadingUIState -> CenteredText(msg = stringResource(R.string.loading_feed))
is TweetsUIState.EmptyUIState -> CenteredText(msg = stringResource(R.string.query, uiState.query))
is TweetsUIState.ErrorUIState -> CenteredText(msg = ”Error happened: $uiState.msg”)
is TweetsUIState.InitialIdleUIState -> TopText()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment