Commit 1956304d authored by mengcuiguang's avatar mengcuiguang
parents a3de034a 99d1a81d
......@@ -85,6 +85,7 @@ public class VideoAdingManager {
// APP下载回调广播
private BroadcastReceiver mReceiverBroadcastReceiver = null;
private boolean receiverFlag=false;// 广播是否注册
private void registerBroad() {
// 是否是超级翻倍标识 false-返回
......@@ -121,6 +122,8 @@ public class VideoAdingManager {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(AppInstallService.APP_INSTALL_ACTION);
activity.registerReceiver(this.mReceiverBroadcastReceiver, intentFilter);
receiverFlag=true;
}
/**
......@@ -429,7 +432,7 @@ public class VideoAdingManager {
csjGroMoreVideoAdManager = null;
}
if (mReceiverBroadcastReceiver != null) {
if (mReceiverBroadcastReceiver != null&&receiverFlag) {
activity.stopService(new Intent(activity, AppInstallService.class));
activity.unregisterReceiver(mReceiverBroadcastReceiver);
mReceiverBroadcastReceiver = null;
......
......@@ -58,6 +58,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private var superTaskStatus = 0
private var mCurrentPkg: String? = null
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
private var receiverFlag=false// 广播是否注册
override fun getContentViewLayoutID() = R.layout.activity_award
......@@ -429,7 +430,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestroy()
if (mReceiverBroadcastReceiver != null) {
if(ivRootAwardAd!=null){
Glide.with(applicationContext).clear(ivRootAwardAd)
}
if (mReceiverBroadcastReceiver != null&&receiverFlag) {
mContext.stopService(Intent(context, AppInstallService::class.java))
mContext.unregisterReceiver(mReceiverBroadcastReceiver)
mReceiverBroadcastReceiver = null
......@@ -704,7 +709,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
if (flAwardAd.height > 0 && flAwardAd.width > 0) {
ivRootAwardAd.visibility = View.VISIBLE
Glide.with(context).asGif().load(R.drawable.bg_award_effect).into(ivRootAwardAd)
if(!AwardActivity@this.isFinishing){
Glide.with(applicationContext).asGif().load(R.drawable.bg_award_effect).into(ivRootAwardAd)
}
}
// }
// }
......@@ -824,5 +831,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
val intentFilter = IntentFilter()
intentFilter.addAction(AppInstallService.APP_INSTALL_ACTION)
mContext.registerReceiver(this.mReceiverBroadcastReceiver, intentFilter)
receiverFlag=true
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
private volatile boolean isYlhSplash = false;
private Intent ylhIntent;
private Intent groIntent;
private static boolean isForeground=false;
//获取当前最上层的activity
private static WeakReference<Activity> app_activity;
......@@ -37,7 +38,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
* @return true-前台
*/
public static boolean isForeground() {
return count == 0 ? true : false;
return isForeground;
}
public static ForegroundOrBackground init(Application application) {
......@@ -111,6 +112,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
// }
// activity.startActivity(groIntent);
// }
isForeground=true;
}
count++;
}
......@@ -120,6 +122,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
count--;
if (count == 0) {
isForeground=false;
leaveTime = System.currentTimeMillis();
TrackManager.getInstance().offline();
}
......
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