package Ġcom . id is fk j . awesome . basic . lifecycle Ċ Ċ import Ġandroidx . lifecycle . Lifecycle Ċ import Ġandroidx . lifecycle . Lifecycle Observer Ċ import Ġandroidx . lifecycle . Lifecycle Registry Ċ import Ġandroidx . lifecycle . On Lifecycle Event Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġid is fk j Ġon Ġ 2 0 1 9 - 1 2 - 0 5 . Ċ Ġ* ĠEmail Ġ: Ġid is fk j @ gmail . com . Ċ Ġ*/ Ċ class ĠV HL ifecycle Observer ( ĊĠĠĠ Ġprivate Ġval Ġouter Lifecycle : ĠLifecycle , ĊĠĠĠ Ġprivate Ġval Ġlifecycle Registry : ĠLifecycle Registry Ċ ) Ġ: ĠLifecycle Observer Ġ{ ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ CREATE ) ĊĠĠĠ Ġfun Ġcreate () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( outer Lifecycle . currentState Ġ== ĠLifecycle . State . CREATED ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . CREATED ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ START ) ĊĠĠĠ Ġfun Ġstart () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( outer Lifecycle . currentState Ġ== ĠLifecycle . State . STARTED ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . STARTED ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ RE SU ME ) ĊĠĠĠ Ġfun Ġresume () Ġ{ ĊĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . RE SU MED ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ PAUSE ) ĊĠĠĠ Ġfun Ġpause () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( outer Lifecycle . currentState . is At Least ( Lifecycle . State . STARTED )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . STARTED ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ STOP ) ĊĠĠĠ Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( outer Lifecycle . currentState . is At Least ( Lifecycle . State . CREATED )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . CREATED ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ DESTROY ) ĊĠĠĠ Ġfun Ġdestroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġlifecycle Registry . currentState Ġ= ĠLifecycle . State . DESTROY ED ĊĠĠĠ Ġ} Ċ }