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

Loading…
Cancel
Save