MyLifecycleObserver.kt 972 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.suyghur.dolin.simple
  2. import androidx.lifecycle.Lifecycle
  3. import androidx.lifecycle.LifecycleObserver
  4. import androidx.lifecycle.OnLifecycleEvent
  5. import com.suyghur.dolin.zap.Zap
  6. /**
  7. * @author #Suyghur.
  8. * Created on 4/8/21
  9. */
  10. class MyLifecycleObserver : LifecycleObserver {
  11. @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
  12. fun onCreate() {
  13. Zap.d("Application onCreate")
  14. }
  15. @OnLifecycleEvent(Lifecycle.Event.ON_START)
  16. fun onStart() {
  17. Zap.d("Application onStart")
  18. }
  19. @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
  20. fun onResume() {
  21. Zap.d("Application onResume")
  22. }
  23. @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
  24. fun onPause() {
  25. Zap.d("Application onPause")
  26. }
  27. @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
  28. fun onStop() {
  29. Zap.d("Application onStop")
  30. }
  31. @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
  32. fun onDestroy() {
  33. Zap.d("Application onDestroy")
  34. }
  35. }