abstractclassRxAppCompatActivity:AppCompatActivity(),LifecycleScopeProvider<ActivityLifecycleEvent>{privatevallifecycle=BehaviorSubject.create<ActivityLifecycleEvent>()overridefunonCreate(savedInstanceState:Bundle?){super.onCreate(savedInstanceState)lifecycle.onNext(ActivityLifecycleEvent.CREATE)}overridefunonStart(){super.onStart()lifecycle.onNext(ActivityLifecycleEvent.START)}overridefunonResume(){super.onResume()lifecycle.onNext(ActivityLifecycleEvent.RESUME)}overridefunonPause(){lifecycle.onNext(ActivityLifecycleEvent.PAUSE)super.onPause()}overridefunonStop(){lifecycle.onNext(ActivityLifecycleEvent.STOP)super.onStop()}overridefunonDestroy(){lifecycle.onNext(ActivityLifecycleEvent.DESTROY)super.onDestroy()}overridefunpeekLifecycle():ActivityLifecycleEvent?=if(lifecycle.hasValue())lifecycle.valueelsenulloverridefuncorrespondingEvents():Function<ActivityLifecycleEvent,ActivityLifecycleEvent>=Function{lifecycle->when(lifecycle){ActivityLifecycleEvent.CREATE->ActivityLifecycleEvent.DESTROYActivityLifecycleEvent.START->ActivityLifecycleEvent.STOPActivityLifecycleEvent.RESUME->ActivityLifecycleEvent.PAUSEActivityLifecycleEvent.PAUSE->ActivityLifecycleEvent.STOPActivityLifecycleEvent.STOP->ActivityLifecycleEvent.DESTROYActivityLifecycleEvent.DESTROY->throwOutsideLifecycleException("Cannot bind to Activity lifecycle when outside of it.")}}overridefunlifecycle():Observable<ActivityLifecycleEvent>=lifecycle}