Slide 12
Slide 12 text
abstract class RxActivity : AppCompatActivity(),
LifecycleScopeProvider {
private val lifecycle = BehaviorSubject.create()
private lateinit var currentEvent: ActivityLifeCycle
override fun lifecycle(): Observable = lifecycle
override fun correspondingEvents(): Function {
return Function { lastEvent: ActivityLifeCycle ->
when (lastEvent) {
CREATE -> DESTROY
else -> throw OutsideLifecycleException("Activity was destroyed")
}
}
}
override fun peekLifecycle() = currentEvent
}
AutoDispose