update utils-code

androidx
Ztiany 5 years ago
parent ccb54e1814
commit db09ca5d79
  1. 15
      lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt

@ -1,5 +1,6 @@
package com.android.base.app
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.IntentFilter
@ -59,16 +60,16 @@ internal class ApplicationDelegate internal constructor(private val androidCompo
fun onLowMemory() {}
private fun listenActivityLifecycleCallbacks() {
AppUtils.registerAppStatusChangedListener(this, object : OnAppStatusChangedListener {
override fun onForeground() {
Timber.d("app进入前台")
appStatus.onNext(true)
}
override fun onBackground() {
AppUtils.registerAppStatusChangedListener(object : OnAppStatusChangedListener {
override fun onBackground(activity: Activity?) {
Timber.d("app进入后台")
appStatus.onNext(false)
}
override fun onForeground(activity: Activity?) {
Timber.d("app进入前台")
appStatus.onNext(true)
}
})
}

Loading…
Cancel
Save