Skip to content

Instantly share code, notes, and snippets.

@n8ebel
Created January 25, 2018 04:51
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 n8ebel/610848d820d7118d9c73941ed0549f61 to your computer and use it in GitHub Desktop.
Save n8ebel/610848d820d7118d9c73941ed0549f61 to your computer and use it in GitHub Desktop.
// Indicate the the screen should be closed
class ImageViewModel() : BaseViewModel() {
@BoundMethod
fun onExitFullscreenClicked() {
lifecycleState.set(FinishedOk)
}
}
// indicate that the screen should be finished and a result is returned
class LessonViewModel() : BaseViewModel() {
var currentlySelectedId = 0
...
@BoundMethod
fun onSelectClicked() {
lifecycleState.set(FinishedWithResult(
RESULT_LESSON_SELECTED,
Intent().apply { putExtra("selectedId", currentlySelectedId) }
))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment