Created
January 25, 2018 04:40
-
-
Save n8ebel/aa7cfbe7413b8b4657d9aea06115493c 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.lifecycleStatePub.subscribe { state -> | |
when (state) { | |
is Active -> {} | |
is FinishedOk, Cancelled -> finish() | |
is FinishedWithResult -> { | |
setResult(state.result, state.data) | |
finish() | |
} | |
is StartActivity -> { | |
val intent = Intent(this, state.target).apply { | |
putExtras(state.data) | |
} | |
startActivity(intent) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment