From db09ca5d7976e10cc57d8dbde0363f27661d638d Mon Sep 17 00:00:00 2001 From: Ztiany Date: Sat, 14 Dec 2019 11:59:58 +0800 Subject: [PATCH] update utils-code --- .../com/android/base/app/ApplicationDelegate.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt b/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt index 87e3b42..f9610f3 100644 --- a/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt +++ b/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) + } }) }