Commit 56c62360 authored by jyx's avatar jyx

信息流预加载逻辑修改

parent 4969f74e
......@@ -38,8 +38,6 @@ import com.mints.flowbox.ui.activitys.keepalive.TriggerActivity;
import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.LogUtil;
import com.mints.flowbox.utils.SystemUtils;
import com.mints.flowbox.utils.keepalive.IntentUtils;
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils;
import com.module.legacy.oreo.RegisterJobUtils;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
......@@ -225,15 +223,15 @@ public class MintsApplication extends BaseApp {
BatteryWatch.getInstance(this).begin(new BatteryWatch.BatteryStateListener() {
@Override
public void onCharging() {
if (IntentUtils.isRunningForeground(MintsApplication.getContext())) {
return;
}
if (ScreenLockerUtils.INSTANCE.canShowScreenLocker(mContext)) {
return;
}
if (WifiDataManager.INSTANCE.getBatteryOn()) {
OutAppRouter.INSTANCE.showScreenActivity();
}
// if (IntentUtils.isRunningForeground(MintsApplication.getContext())) {
// return;
// }
// if (ScreenLockerUtils.INSTANCE.canShowScreenLocker(mContext)) {
// return;
// }
// if (WifiDataManager.INSTANCE.getBatteryOn()) {
// OutAppRouter.INSTANCE.showScreenActivity();
// }
}
@Override
......
package com.mints.flowbox.ad
import android.widget.FrameLayout
/**
*
* @author jyx
* @date 2021/7/29
* @des
*/
interface ExpressAdCallback {
fun loadSuccess(adView: FrameLayout?)
// fun loadingFail()
}
\ No newline at end of file
......@@ -314,9 +314,8 @@ public class PreCsjGroMoreVideoAdManager extends BaseVideoAd {
LogUtil.d(TAG, "广告关闭:onRewardedAdShow adcode=" + adcode + " ecpm=" + ecpm + " adSource=" + adSource);
// 数据重置
adcode ="";
adcode = "";
ecpm = "";
adSource = 0;
......
......@@ -5,7 +5,8 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.AppOutScreenGroMoreCarrierExpressManager
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ui.activitys.keepalive.ApkActivity
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity
import com.mints.flowbox.ui.activitys.keepalive.TransPlaceActivity
......@@ -35,7 +36,7 @@ object OutAppRouter {
}
// 预加载信息流
ExpressManager.loadAppOutExpress()
AppOutSimpleGroMoreCarrierExpressManager.instance.loadADFrameLayout()
// 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2()) {
......@@ -52,7 +53,8 @@ object OutAppRouter {
* 展示锁屏页面
*/
fun showScreenActivity() {
ExpressManager.loadAppOutExpress(true)
// 预加载信息流
AppOutScreenGroMoreCarrierExpressManager.instance.loadADFrameLayout()
val intent = Intent(MintsApplication.getContext(), ScreenActivity::class.java)
if (!PhoneBrandUtils.isOppo()) {
......@@ -100,7 +102,7 @@ object OutAppRouter {
}
// 预加载信息流
ExpressManager.loadAppOutExpress()
AppOutSimpleGroMoreCarrierExpressManager.instance.loadADFrameLayout()
val intent = Intent(MintsApplication.getContext(), TriggerActivity::class.java)
intent.putExtra(TriggerActivity.TRIGGER_TYPE, currentType)
......@@ -120,7 +122,7 @@ object OutAppRouter {
}
// 预加载信息流
ExpressManager.loadAppOutExpress()
AppOutSimpleGroMoreCarrierExpressManager.instance.loadADFrameLayout()
var realType = currentType
......
......@@ -18,10 +18,10 @@ import com.activityutil.ContextLike
import com.external.OutAppActivity
import com.main.ScreenMonitor
import com.mints.flowbox.BuildConfig
import com.mints.flowbox.ad.AppOutScreenGroMoreCarrierExpressManager
import com.mints.flowbox.manager.wifi.WifiDataManager
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity
import com.mints.flowbox.utils.ForegroundOrBackground
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.keepalive.IntentUtils
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.module.account.daemon.ScreenStatusMonitor
......@@ -170,6 +170,8 @@ class ScreenLockerObserver(private val context: Context) {
// )
if (!WifiDataManager.getLockOn()) return
AppOutScreenGroMoreCarrierExpressManager.instance.loadADFrameLayout()
when (intent?.action) {
ScreenMonitor.MY_SCREEN_OFF, Intent.ACTION_SCREEN_OFF,
ACTION_SCREENCHECKER_OFF,
......@@ -261,7 +263,7 @@ class ScreenLockerObserver(private val context: Context) {
}
private fun onHandleScreenOff(context: Context, isPowerDisconnected: Boolean = false) {
if (IntentUtils.isRunningForeground(context) && ForegroundOrBackground.getApp_activity() != null) {
if (IntentUtils.isRunningForeground(context) && ForegroundOrBackground.getApp_activity() != null && ForegroundOrBackground.getApp_activity() !is ScreenActivity) {
ForegroundOrBackground.getApp_activity().moveTaskToBack(true)
}
......@@ -373,7 +375,6 @@ class ScreenLockerObserver(private val context: Context) {
filter.addAction(Intent.ACTION_POWER_CONNECTED)
filter.addAction(Intent.ACTION_POWER_DISCONNECTED)
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenConstant.EVENT_SCREEN_LOCKER_INIT,
......
......@@ -3,10 +3,14 @@ package com.mints.flowbox.ui.activitys.keepalive
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.AppOutScreenGroMoreCarrierExpressManager
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ad.ExpressAdCallback
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.CleanActivity
......@@ -19,6 +23,7 @@ import kotlinx.android.synthetic.main.activity_apk.btnClean
import kotlinx.android.synthetic.main.activity_apk.fl_ad
import kotlinx.android.synthetic.main.activity_apk.iv_close
import kotlinx.android.synthetic.main.activity_apk.tvInfo
import kotlinx.android.synthetic.main.activity_screen.*
import kotlin.random.Random
/**
......@@ -116,12 +121,22 @@ class ApkActivity : BaseActivity() {
*/
private fun initExpress() {
try {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
ExpressManager.loadAppOutExpress(false, fl_ad)
}
AppOutScreenGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
}
override fun loadingFail() {
}
})
// if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
// fl_ad.removeAllViews()
// fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
// } else {
// ExpressManager.loadAppOutExpress(false, fl_ad)
// }
} catch (e: Exception) {
e.printStackTrace()
}
......@@ -130,6 +145,8 @@ class ApkActivity : BaseActivity() {
override fun onDestroy() {
rope?.stop()
rope = null
AppOutSimpleGroMoreCarrierExpressManager.instance.resetLoadStatus()
super.onDestroy()
}
......
......@@ -6,7 +6,10 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View
import android.widget.FrameLayout
import com.mints.flowbox.R
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ad.ExpressAdCallback
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.wifi.AppOutWifiAdManager
import com.mints.flowbox.utils.StatusBarUtil
......@@ -130,18 +133,33 @@ class BoostFastActivity : Activity() {
/**初始化信息iyc*/
private fun initExpress() {
try {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout(), ExpressManager.lp)
} else {
fl_ad.removeAllViews()
ExpressManager.loadAppOutExpress(false, fl_ad)
}
AppOutSimpleGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
}
override fun loadingFail() {
}
})
// if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
// fl_ad.removeAllViews()
// fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout(), ExpressManager.lp)
// } else {
// fl_ad.removeAllViews()
// ExpressManager.loadAppOutExpress(false, fl_ad)
// }
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() {
AppOutSimpleGroMoreCarrierExpressManager.instance.resetLoadStatus()
super.onDestroy()
}
override fun onBackPressed() {
// super.onBackPressed()
}
......
......@@ -4,12 +4,14 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View
import android.widget.FrameLayout
import com.mints.flowbox.R
import com.mints.flowbox.ad.AppOutScreenGroMoreCarrierExpressManager
import com.mints.flowbox.ad.ExpressAdCallback
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ui.activitys.IncreasespeedActivity
import com.mints.flowbox.ui.activitys.base.OutAppActivity
import com.mints.flowbox.utils.ForegroundOrBackground
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.TimeRender
import com.mints.flowbox.utils.ToolUtil
import com.mints.library.utils.nodoubleclick.AntiShake
......@@ -30,10 +32,6 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
)
}, 500)
ExpressManager.loadAppOutExpress(true)
LogUtil.d(TAG_LOG, "ScreenActivity -> onCreate ")
// val thread = TimeThread(tvDate, tvTime)
// thread.start()
......@@ -49,13 +47,6 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
override fun onResume() {
super.onResume()
resetTime()
LogUtil.d(TAG_LOG, "ScreenActivity -> onResume ")
}
override fun onStop() {
super.onStop()
LogUtil.d(TAG_LOG, "ScreenActivity -> onStop ")
}
private fun resetTime() {
......@@ -107,17 +98,24 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
/**初始化信息iyc*/
private fun initExpress() {
try {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout(), ExpressManager.lp)
} else {
ExpressManager.loadAppOutExpress(true, fl_ad)
}
AppOutScreenGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
}
override fun loadingFail() {}
})
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() {
super.onDestroy()
AppOutScreenGroMoreCarrierExpressManager.instance.resetLoadStatus()
}
override fun getContentViewLayoutID() = R.layout.activity_screen
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.mints.flowbox.ui.activitys.keepalive
import android.app.Activity
import android.os.Bundle
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ad.wifi.AppOutWifiAdManager
import com.mints.flowbox.utils.StatusBarUtil
......@@ -47,8 +47,10 @@ class TransparentActivity : Activity() {
*/
private fun loadAd() {
AppOutWifiAdManager.instance.loadWifiAd(this, mType)
// 预加载信息流
ExpressManager.loadAppOutExpress()
AppOutSimpleGroMoreCarrierExpressManager.instance.loadADFrameLayout()
finish()
}
......
......@@ -2,12 +2,14 @@ package com.mints.flowbox.ui.activitys.keepalive
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ad.ExpressAdCallback
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.wifi.WifiAdManager
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.keepalive.OutAppRouter
......@@ -19,6 +21,7 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.SystemUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_boost_fast.*
import kotlinx.android.synthetic.main.activity_screen.*
import kotlinx.android.synthetic.main.activity_timing.*
import kotlinx.android.synthetic.main.activity_timing.fl_ad
......@@ -231,13 +234,23 @@ class TriggerActivity : BaseActivity() {
/**初始化信息iyc*/
private fun initExpress() {
try {
if (ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout(), ExpressManager.lp)
} else {
fl_ad.removeAllViews()
ExpressManager.loadAppOutExpress(false, fl_ad)
}
AppOutSimpleGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
}
override fun loadingFail() {
}
})
// if (ExpressManager.getAppOutExpressFrameLayout() != null) {
// fl_ad.removeAllViews()
// fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout(), ExpressManager.lp)
// } else {
// fl_ad.removeAllViews()
// ExpressManager.loadAppOutExpress(false, fl_ad)
// }
} catch (e: Exception) {
e.printStackTrace()
}
......@@ -261,6 +274,7 @@ class TriggerActivity : BaseActivity() {
override fun onDestroy() {
rope?.stop()
rope = null
AppOutSimpleGroMoreCarrierExpressManager.instance.resetLoadStatus()
super.onDestroy()
}
......
......@@ -13,7 +13,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mints.flowbox.R;
import com.mints.flowbox.utils.LogUtil;
import com.mints.library.utils.nodoubleclick.AntiShake;
public class WifiView extends FrameLayout implements View.OnClickListener {
......@@ -137,7 +136,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
}
public void wifiOn() {
if (mCount == 0 || mAllIsComplete) {
if (mAllIsComplete) {
wifiOnAndNoBonus();
return;
}
......
......@@ -8,11 +8,6 @@ import android.provider.Settings;
import com.activityutil.ActivityManagerProxy;
import com.activityutil.BringToFrontListener;
import com.activityutil.ContextLike;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity;
import com.mints.flowbox.utils.LogUtil;
import net.phone.PhoneBrandUtils;
import org.jetbrains.annotations.NotNull;
......
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