Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Last active August 6, 2019 16:10
Show Gist options
  • Save SeongUgJung/1489fe1d43c819ad348adadc4bb8375f to your computer and use it in GitHub Desktop.
Save SeongUgJung/1489fe1d43c819ad348adadc4bb8375f to your computer and use it in GitHub Desktop.
class MainActivity : Activity() {
private val lifecycleController = LifecycleController()
fun onCreated() {
MainViewModel(controller)
}
}
// Controller 는 Activity 에서 주입됩니다.
class MainViewModel(private val controller : LifecycleController) {
init {
controller.addObserver(RxLifecycle().apply { onInit = /* () -> disposable */ })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment