Commit bcbee770 authored by wanglei's avatar wanglei

...

parent 0a81c9ad
......@@ -27,7 +27,8 @@
<activity
android:name=".ui.activity.MainActivity"
android:exported="true">
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
package com.base.browserwhite
import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.base.browserwhite.utils.ActivityManagerUtils
class MyApplication : Application() {
companion object {
lateinit var context: MyApplication
}
override fun onCreate() {
super.onCreate()
context = this
initLifeListener()
}
private fun initLifeListener() {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
private var count = 0
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
ActivityManagerUtils.getInstance().addActivity(activity)
}
override fun onActivityStarted(activity: Activity) {
// LogEx.logDebug(TAG, "onActivityStarted")
// count++
// lastTimeResume = System.currentTimeMillis()
// if (count == 1 && isHotLaunch()) {
//
// val topActivity: Activity? = ActivityManagerUtils.getInstance().topActivity
//
// var flag = if (topActivity == null) {
// true
// } else {
// com.base.filerecoveryblack.ConfigHelper.noLoadingActivities.all {
// !topActivity.localClassName.contains(it, true)
// }
// }
//
// if (activity.localClassName.contains("AppLovinFullscreenActivity")) {
// flag = false
// }
// LogEx.logDebug(TAG, "flag=$flag" + " activity:" + activity.localClassName)
//
// if (flag && !isInterOpenShowing) {
// if (AdmobMaxHelper.isOpenAdLoaded()) {
// var loaded: Boolean = true
// AdmobMaxHelper.admobMaxShowOpenAd(activity, {
// loaded = it
// }, {
// val sp = AppPreferences.getInstance().getString("splashShowInter", "0").toInt()
// if (sp == 1 && !loaded) {
// AdmobMaxHelper.admobMaxShowInterstitialAd(activity)
// }
// })
// } else {
// topActivity?.startActivity(
// Intent(
// topActivity,
// SplashActivity::class.java
// ).apply {
// putExtra("isHotLaunch", true)
// putExtra("type", -1)
// })
// }
// }
// }
// lastTimeResume = 0
}
override fun onActivityResumed(activity: Activity) {
// LogEx.logDebug(TAG, "onActivityResumed")
// PAUSED_VALUE = 1
}
override fun onActivityPaused(activity: Activity) {
// LogEx.logDebug(TAG, "onActivityPaused")
// PAUSED_VALUE = 2
// lastTimePause = System.currentTimeMillis()
}
override fun onActivityStopped(activity: Activity) {
count--
}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
override fun onActivityDestroyed(activity: Activity) {
ActivityManagerUtils.getInstance().removeActivity(activity)
}
})
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment