Skip to content

Instantly share code, notes, and snippets.

@mrahimygk
Created June 17, 2020 08:52
Show Gist options
  • Save mrahimygk/ae2bc2d0a4b6978f42d81599ad65e7a9 to your computer and use it in GitHub Desktop.
Save mrahimygk/ae2bc2d0a4b6978f42d81599ad65e7a9 to your computer and use it in GitHub Desktop.
private fun bindParentObservables() {
viewModel.snackMessageCommand.observe(viewLifecycleOwner, EventObserver { command ->
when (command) {
is SnackCommand.StringResSnackCommand ->
view?.showSnackBar(
command.message,
duration = command.duration
)
is SnackCommand.StringSnackCommand ->
view?.showSnackBar(
command.message,
duration = command.duration
)
is SnackCommand.ActionedStringSnackCommand -> {
view?.showSnackBar(
command.message,
duration = command.duration,
action = command.action.paired()
)
}
is SnackCommand.ActionedStringResSnackCommand -> {
view?.showSnackBar(
command.message,
duration = command.duration,
action = command.action.paired()
)
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment