Skip to content

Instantly share code, notes, and snippets.

@n8ebel
Created January 25, 2018 04:35
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/d5ef06895b3fe3476cd4e48bc31879e3 to your computer and use it in GitHub Desktop.
Save n8ebel/d5ef06895b3fe3476cd4e48bc31879e3 to your computer and use it in GitHub Desktop.
Definition of ViewModel lifecycle states that are handled by our BaseActivity
// Lifecycle States
sealed class ViewModelLifecycleState
object Active : ViewModelLifecycleState()
object FinishedOk : ViewModelLifecycleState()
object Cancelled : ViewModelLifecycleState()
data class FinishedWithResult(
val result:Int,
val data:Intent = Intent()) : ViewModelLifecycleState()
data class StartActivity(
val target:Class<out BaseActivity>,
val data:Intent = Intent()) : ViewModelLifecycleState()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment