Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
Out
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xjl
Out
Commits
f8306a2f
Commit
f8306a2f
authored
Jan 03, 2024
by
shenpc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
fee49b99
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
131 additions
and
623 deletions
+131
-623
OutHelp.java
app/src/main/java/com/zl/sdk/OutHelp.java
+5
-63
AdManagerV2.java
app/src/main/java/com/zl/sdk/ad/AdManagerV2.java
+24
-25
AppOutSP.java
app/src/main/java/com/zl/sdk/out/AppOutSP.java
+1
-9
BaseOutShowManager.java
app/src/main/java/com/zl/sdk/out/BaseOutShowManager.java
+0
-1
CheckHelper.java
app/src/main/java/com/zl/sdk/out/CheckHelper.java
+30
-86
OutAdManager.java
app/src/main/java/com/zl/sdk/out/OutAdManager.java
+59
-290
DeepNight.java
...rc/main/java/com/zl/sdk/out/deepNightModle/DeepNight.java
+0
-68
DxActivity.java
app/src/main/java/com/zl/sdk/out/ui/DxActivity.java
+9
-80
AppOutUtils.java
app/src/main/java/com/zl/sdk/util/AppOutUtils.java
+3
-1
No files found.
app/src/main/java/com/zl/sdk/OutHelp.java
View file @
f8306a2f
...
...
@@ -16,21 +16,8 @@ import android.util.ArrayMap;
import
android.util.Log
;
import
android.widget.RemoteViews
;
import
com.anythink.expressad.reward.player.ATRewardVideoActivity
;
import
com.applovin.adview.AppLovinFullscreenActivity
;
import
com.applovin.sdk.AppLovinWebViewActivity
;
import
com.bytedance.sdk.openadsdk.activity.TTAppOpenAdActivity
;
import
com.bytedance.sdk.openadsdk.activity.TTFullScreenVideoActivity
;
import
com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity
;
import
com.bytedance.sdk.openadsdk.activity.TTRewardVideoActivity
;
import
com.mbridge.msdk.activity.MBCommonActivity
;
import
com.mbridge.msdk.out.LoadingActivity
;
import
com.mbridge.msdk.reward.player.MBRewardVideoActivity
;
import
com.vungle.ads.internal.ui.VungleActivity
;
import
com.zl.sdk.ad.topOn.TopOnAdManager
;
import
com.zl.sdk.bean.AdAppInfo
;
import
com.zl.sdk.data.DataManager
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.icon.IcOptManager
;
import
com.zl.sdk.icon.IconHelp
;
...
...
@@ -52,6 +39,9 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
cn.kw.lib.common.ALog
;
...
...
@@ -75,9 +65,6 @@ public final class OutHelp implements KPListener {
private
String
dexVersionCode
=
null
;
private
String
activityName
=
null
;
//是否第一次轮询
private
boolean
firstLx
=
true
;
private
long
lastShowTime
=
0
;
public
void
setLastShowTime
()
{
...
...
@@ -128,50 +115,23 @@ public final class OutHelp implements KPListener {
//初始化触发条件
initTriggerConditions
();
/* if (DataManager.get().checkOutOpen(mContext)) {
//第一次加载广告
} else {
Map<String, String> map = new HashMap<>();
map.put("position", "init");
Statistics.getInstance().dotEvent("out_close", map);
}*/
OutAdManager
.
get
().
checkNeedLoadAd
(
ActionFrom
.
ACTION_INIT_START
);
}
private
void
initTriggerConditions
()
{
initTimer
();
// initReceiver();
registerActivityLifecycle
();
registerAction
();
}
private
Timer
timer
;
private
void
initTimer
()
{
LogUtil
.
d
(
TAG
+
"初始化:initTimer"
);
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// if (!DataManager.get().checkOutOpen(mContext)) {
// Map<String, String> map = new HashMap<>();
// map.put("position", "time");
// Statistics.getInstance().dotEvent("out_close", map);
// LogUtil.d(TAG + "外展未开启,不轮询检测");
// return;
// }
Statistics
.
getInstance
().
dotEvent
(
"out_open"
);
LogUtil
.
d
(
TAG
,
"firstLx : "
+
firstLx
);
showOutAd
(
firstLx
);
//检测icon状态
IcOptManager
.
getInstance
().
cycleCheckHideIcon
();
if
(
firstLx
)
{
firstLx
=
false
;
}
LogUtil
.
d
(
TAG
+
", 定时触发 !"
);
showOutAd
(
ActionFrom
.
ACTION_TIMER
);
}
},
0
,
60
*
1000
);
}
...
...
@@ -243,13 +203,6 @@ public final class OutHelp implements KPListener {
* @param actionName 广播名称
*/
public
void
receiverAction
(
String
actionName
)
{
/* if (!DataManager.get().checkOutOpen(mContext)) {
Map<String, String> map = new HashMap<>();
map.put("position", "rc_app");
Statistics.getInstance().dotEvent("out_close", map);
LogUtil.d(TAG + "外展未开启,不接收广播");
return;
}*/
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"action"
,
actionName
);
...
...
@@ -308,17 +261,6 @@ public final class OutHelp implements KPListener {
}
/**
* 进入外展广告播放逻辑 (轮询)
*
* @param isFirst 是否第一次检查
*/
private
void
showOutAd
(
boolean
isFirst
)
{
LogUtil
.
d
(
TAG
+
"showOutAd(轮询) isFirst="
+
isFirst
);
OutAdManager
.
get
().
checkShowOutAd
();
}
public
Context
getContext
()
{
return
mContext
;
}
...
...
app/src/main/java/com/zl/sdk/ad/AdManagerV2.java
View file @
f8306a2f
package
com
.
zl
.
sdk
.
ad
;
import
android.app.Activity
;
import
android.util.Log
;
import
com.anythink.core.api.ATAdInfo
;
import
com.anythink.core.api.ATAdStatusInfo
;
...
...
@@ -13,11 +12,12 @@ import com.zl.sdk.event.AdsParamsInfo;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.ReportBean
;
import
com.zl.sdk.out.AppOutSP
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.Date
;
public
class
AdManagerV2
implements
ATInterstitialListener
{
private
ATInterstitial
atInterstitial
=
null
;
private
volatile
ATInterstitial
atInterstitial
=
null
;
private
int
reloadCount
=
3
;
...
...
@@ -37,7 +37,7 @@ public class AdManagerV2 implements ATInterstitialListener {
@Override
public
void
onInterstitialAdLoaded
()
{
Log
.
d
(
"OutShow"
,
"Topon: ad loaded"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad loaded"
);
reloadCount
=
3
;
if
(
atInterstitial
.
checkValidAdCaches
()
==
null
||
atInterstitial
.
checkValidAdCaches
().
isEmpty
())
{
...
...
@@ -51,7 +51,7 @@ public class AdManagerV2 implements ATInterstitialListener {
@Override
public
void
onInterstitialAdLoadFail
(
AdError
adError
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad load fail"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad load fail"
);
String
builder
=
"error info : code="
+
adError
.
getCode
()
+
" msg="
+
adError
.
getDesc
()
+
" all="
+
adError
.
getFullErrorInfo
();
...
...
@@ -71,18 +71,18 @@ public class AdManagerV2 implements ATInterstitialListener {
@Override
public
void
onInterstitialAdClicked
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad click"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad click"
);
EventUtils
.
statAdClick
(
getReportBean
(
atAdInfo
,
null
));
}
@Override
public
void
onInterstitialAdShow
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad show"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad show"
);
int
outInterstitialAdDayShowCount
=
AppOutSP
.
getOutInterstitialAdDayShowCount
()
+
1
;
AppOutSP
.
saveOutInterstitialAdDayShowCount
(
outInterstitialAdDayShowCount
);
Log
.
d
(
"OutShow"
,
"Topon: ad show times="
+
outInterstitialAdDayShowCount
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad show times="
+
outInterstitialAdDayShowCount
);
EventUtils
.
statAdExpose
(
getReportBean
(
atAdInfo
,
null
));
...
...
@@ -95,56 +95,55 @@ public class AdManagerV2 implements ATInterstitialListener {
@Override
public
void
onInterstitialAdClose
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad close"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad close"
);
EventUtils
.
statAdClose
(
getReportBean
(
atAdInfo
,
null
));
}
@Override
public
void
onInterstitialAdVideoStart
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video start"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad video start"
);
}
@Override
public
void
onInterstitialAdVideoEnd
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video end"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad video end"
);
}
@Override
public
void
onInterstitialAdVideoError
(
AdError
adError
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video error"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: ad video error"
);
}
public
void
loadAd
(
String
id
)
{
Log
.
d
(
"OutShow"
,
"Topon: loadAd : "
+
id
);
public
boolean
loadAd
(
String
id
)
{
Log
Util
.
d
(
"OutShow"
,
"Topon: loadAd : "
+
id
);
adId
=
id
;
if
(
atInterstitial
!=
null
)
{
ATAdStatusInfo
atAdStatusInfo
=
atInterstitial
.
checkAdStatus
();
if
(!
atAdStatusInfo
.
isReady
()
&&
!
atAdStatusInfo
.
isLoading
())
{
if
(
atAdStatusInfo
.
isReady
())
{
LogUtil
.
d
(
"OutShow"
,
"ad isReady!"
);
return
false
;
}
if
(!
atAdStatusInfo
.
isLoading
())
{
LogUtil
.
d
(
"OutShow"
,
"load ad !"
);
atInterstitial
.
load
();
requestTime
=
System
.
currentTimeMillis
();
EventUtils
.
statAdReport
(
getReportRequestBean
(
adId
));
}
else
{
LogUtil
.
d
(
"OutShow"
,
"ad is loading !"
);
}
}
else
{
LogUtil
.
d
(
"OutShow"
,
"new ad and load !"
);
atInterstitial
=
new
ATInterstitial
(
OutHelp
.
get
().
getContext
(),
adId
);
atInterstitial
.
setAdListener
(
this
);
atInterstitial
.
load
();
requestTime
=
System
.
currentTimeMillis
();
EventUtils
.
statAdReport
(
getReportRequestBean
(
adId
));
}
}
public
boolean
isAdReady
()
{
if
(
atInterstitial
!=
null
)
{
ATAdStatusInfo
atAdStatusInfo
=
atInterstitial
.
checkAdStatus
();
return
atAdStatusInfo
.
isReady
();
}
else
{
return
false
;
}
return
true
;
}
public
void
showAd
(
Activity
activity
)
{
Log
.
d
(
"OutShow"
,
"Topon: showAd"
);
Log
Util
.
d
(
"OutShow"
,
"Topon: showAd"
);
ATInterstitial
.
entryAdScenario
(
"111"
,
""
);
atInterstitial
.
show
(
activity
);
}
...
...
app/src/main/java/com/zl/sdk/out/AppOutSP.java
View file @
f8306a2f
...
...
@@ -30,7 +30,7 @@ public final class AppOutSP {
return
OutLastScreenOff
;
}
private
static
int
OutInterstitialAdDayShowCount
=
-
1
;
private
volatile
static
int
OutInterstitialAdDayShowCount
=
-
1
;
public
static
void
saveOutInterstitialAdDayShowCount
(
int
value
)
{
getAppOutPref
().
put
(
KEY_OUT_INTERSTITIAL_AD_DAY_SHOW_COUNT
,
value
);
...
...
@@ -85,12 +85,4 @@ public final class AppOutSP {
return
outPref
;
}
public
static
boolean
isAppFirstStart
()
{
return
getAppOutPref
().
getBoolean
(
KEY_IS_APP_FIRST_START
,
true
);
}
public
static
void
setIsAppFirstStart
(
boolean
firstStart
)
{
getAppOutPref
().
put
(
KEY_IS_APP_FIRST_START
,
firstStart
);
}
}
app/src/main/java/com/zl/sdk/out/BaseOutShowManager.java
View file @
f8306a2f
...
...
@@ -12,5 +12,4 @@ public abstract class BaseOutShowManager {
abstract
RemindersInfo
getReminderInfo
();
abstract
boolean
checkCanShowForRemindInfo
(
RemindersInfo
remindersInfo
);
abstract
boolean
checkCanShowForActionState
(
OutAdData
.
NormalAdData
adData
,
int
actionState
);
}
app/src/main/java/com/zl/sdk/out/CheckHelper.java
View file @
f8306a2f
...
...
@@ -7,17 +7,13 @@ import android.net.NetworkInfo;
import
android.text.format.DateUtils
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.ad.AdManagerV2
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.event.DialogFailReason
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.util.AppOutUtils
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
CheckHelper
{
private
static
final
String
TAG
=
"OutShow CheckHelper --> "
;
...
...
@@ -27,26 +23,9 @@ public class CheckHelper {
* 解锁/回到桌面 触发展示的外展广告
*/
public
static
boolean
checkAdCanShowByScene
(
int
actionState
,
String
scenes
)
{
// boolean isInit = OutHelp.get().isInit();
// if (!isInit) {
// LogUtil.d(TAG + "(场景检查)保活未初始化,不能展示");
// EventUtils.staDialogFail(DialogFailReason.NO_INIT, actionState, EventUtils.DIALOG_TYPE_AD);
// return false;
// }
// if (DxManager.get().existAppOutActivities()) {
// LogUtil.d(TAG + "(场景检查)存在外展弹窗,不能展示");
// EventUtils.staDialogFail(DialogFailReason.EXIST_OUT, actionState, EventUtils.DIALOG_TYPE_AD);
// return false;
// }
// if (!isNetworkAvailable(OutHelp.get().getContext())) {
// LogUtil.d(TAG + "(场景检查)网络未连接,不能展示");
// EventUtils.staDialogFail(DialogFailReason.NO_NET, actionState, scenes, EventUtils.DIALOG_TYPE_AD);
// return false;
// }
//
if
(
needCheckScreenOff
(
actionState
)
&&
!
AppOutUtils
.
isScreenOn
())
{
if
((
actionState
==
ActionFrom
.
ACTION_TIMER
.
getAction
()
||
actionState
==
ActionFrom
.
ACTION_BATTERY_CHANGED
.
getAction
())
&&
!
AppOutUtils
.
isScreenOn
())
{
LogUtil
.
d
(
TAG
+
"(场景检查)手机未亮屏,不能展示"
);
EventUtils
.
staDialogFail
(
DialogFailReason
.
SCREEN_OFF
,
actionState
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
return
false
;
...
...
@@ -64,12 +43,6 @@ public class CheckHelper {
return
false
;
}
// if (AppOutUtils.isScreenLock()) {
// LogUtil.d(TAG + "(场景检查)锁屏中,不能展示");
// EventUtils.staDialogFail(DialogFailReason.LOCK, actionState, scenes, EventUtils.DIALOG_TYPE_AD);
// return false;
// }
LogUtil
.
d
(
TAG
+
"(场景检查)能展示"
);
return
true
;
}
...
...
@@ -78,39 +51,8 @@ public class CheckHelper {
* 检查广告数据是否可以播放
*/
public
static
boolean
checkCanShowAdByTimesFromAdData
(
OutAdData
.
NormalAdData
data
,
int
actionState
,
String
scenes
)
{
if
(
data
==
null
)
{
LogUtil
.
d
(
TAG
+
"(次数检查)广告信息为空 不能播放"
);
EventUtils
.
staDialogFail
(
DialogFailReason
.
NO_DATA
,
actionState
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
return
false
;
}
long
curTime
=
System
.
currentTimeMillis
();
long
showIntervalTime
=
Math
.
abs
(
curTime
-
OutHelp
.
get
().
getLastShowTime
());
LogUtil
.
d
(
TAG
+
"(次数检查)上次展示时间="
+
OutHelp
.
get
().
getLastShowTime
());
long
spaceTime
;
if
(
OutHelp
.
get
().
iconIsHide
())
{
spaceTime
=
data
.
intervalHide
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"(次数检查)间隔时间(icon隐藏)="
+
spaceTime
);
}
else
{
spaceTime
=
data
.
interval
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"(次数检查)间隔时间(icon未隐藏)="
+
spaceTime
);
}
// //TODO
// if (DeepNight.checkDeepNightRunning()) {
// spaceTime = 60 * 1000L;
// }
if
(
showIntervalTime
<
spaceTime
)
{
LogUtil
.
d
(
TAG
+
"(次数检查)未到间隔时间 不能播放"
);
EventUtils
.
staDialogFail
(
DialogFailReason
.
INTERVAL_TIME
,
actionState
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
return
false
;
}
int
homeInterstitialAdDayShowCount
=
AppOutSP
.
getOutInterstitialAdDayShowCount
();
int
homeDayShowCount
=
homeInterstitialAdDayShowCount
;
...
...
@@ -161,6 +103,33 @@ public class CheckHelper {
return
true
;
}
public
static
boolean
checkCanShowAdByInterValFromAdData
(
OutAdData
.
NormalAdData
data
,
int
actionState
,
String
scenes
)
{
long
curTime
=
System
.
currentTimeMillis
();
long
showIntervalTime
=
Math
.
abs
(
curTime
-
OutHelp
.
get
().
getLastShowTime
());
LogUtil
.
d
(
TAG
+
"(次数检查)上次展示时间="
+
OutHelp
.
get
().
getLastShowTime
());
long
spaceTime
;
if
(
OutHelp
.
get
().
iconIsHide
())
{
spaceTime
=
data
.
intervalHide
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"(次数检查)间隔时间(icon隐藏)="
+
spaceTime
);
}
else
{
spaceTime
=
data
.
interval
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"(次数检查)间隔时间(icon未隐藏)="
+
spaceTime
);
}
if
(
showIntervalTime
<
spaceTime
)
{
LogUtil
.
d
(
TAG
+
"(次数检查)未到间隔时间 不能播放"
);
EventUtils
.
staDialogFail
(
DialogFailReason
.
INTERVAL_TIME
,
actionState
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
return
false
;
}
LogUtil
.
d
(
TAG
+
"(时间间隔检查)可播放"
);
return
true
;
}
public
static
boolean
isSameDay
(
long
time1
,
long
time2
)
{
Calendar
cal1
=
Calendar
.
getInstance
();
Calendar
cal2
=
Calendar
.
getInstance
();
...
...
@@ -171,31 +140,6 @@ public class CheckHelper {
}
/**
* 检查广告是否准备好
*/
public
static
boolean
checkAdReady
(
OutAdData
.
NormalAdData
data
,
String
scenes
)
{
if
(
data
==
null
)
{
return
false
;
}
try
{
// boolean ready = TopOnAdLoadManager.getInstance().isInterstitialReady(data.cpName, data.cpAdslot);
boolean
ready
=
AdManagerV2
.
get
().
isAdReady
();
LogUtil
.
d
(
TAG
+
"(缓存检查)是否有缓存:"
+
ready
);
if
(!
ready
)
{
EventUtils
.
staDialogFail
(
DialogFailReason
.
NOT_READY
,
-
1
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
}
return
ready
;
}
catch
(
Exception
e
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"reason"
,
e
.
getMessage
());
map
.
put
(
"scenes"
,
"check ready"
);
Statistics
.
getInstance
().
dotEvent
(
OutHelp
.
get
().
getContext
(),
"class error"
,
""
,
map
);
return
false
;
}
}
/**
* 是否在通话中
*/
...
...
app/src/main/java/com/zl/sdk/out/OutAdManager.java
View file @
f8306a2f
...
...
@@ -4,8 +4,7 @@ import android.content.ComponentName;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.format.DateUtils
;
import
android.os.HandlerThread
;
import
com.zl.sdk.Config
;
import
com.zl.sdk.OutHelp
;
...
...
@@ -14,14 +13,11 @@ import com.zl.sdk.ad.AdManagerV2;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.statistics.AdScenes
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.icon.IconHelp
;
import
com.zl.sdk.out.ui.DxActivity
;
import
com.zl.sdk.util.AppOutUtils
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -29,7 +25,14 @@ import cn.kuwo.show.mod.ACTD;
public
class
OutAdManager
extends
BaseOutShowManager
{
private
HandlerThread
handlerThread
;
private
Handler
workHandler
;
private
OutAdManager
()
{
handlerThread
=
new
HandlerThread
(
"ot_a"
);
handlerThread
.
start
();
workHandler
=
new
Handler
(
handlerThread
.
getLooper
());
}
private
static
final
OutAdManager
INSTANCE
=
new
OutAdManager
();
...
...
@@ -40,19 +43,6 @@ public class OutAdManager extends BaseOutShowManager {
private
static
final
String
TAG
=
"OutShow OutAdManager --> "
;
// 展示广告失败次数
// private int showAdFailTimes = 0;
// //是否重试了
// private volatile boolean hadStartAdDialogFail = false;
// //上次拉起外展弹窗时间
// private long lastStartAdDialogTime = 0L;
//限制不能重复拉起外展弹窗的时间
// private final long startAdDialogIntervalTime = 5 * 1000L;
// public void cleanLoadAdFailTime() {
// showAdFailTimes = 0;
// }
@Override
OutAdData
.
NormalAdData
getAdData
()
{
...
...
@@ -75,116 +65,8 @@ public class OutAdManager extends BaseOutShowManager {
return
false
;
}
@Override
boolean
checkCanShowForActionState
(
OutAdData
.
NormalAdData
adData
,
int
actionState
)
{
if
(
adData
==
null
)
{
LogUtil
.
d
(
TAG
+
"能否播放(广告信息) :广告信息为空 false"
);
return
false
;
}
LogUtil
.
d
(
TAG
+
"广告信息="
+
adData
);
boolean
canShowByScene
=
CheckHelper
.
checkAdCanShowByScene
(
actionState
,
EventUtils
.
SCENES_SHOW
);
boolean
adDataCanShow
=
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
adData
,
actionState
,
EventUtils
.
SCENES_SHOW
);
boolean
adReady
=
CheckHelper
.
checkAdReady
(
adData
,
EventUtils
.
SCENES_SHOW
);
LogUtil
.
d
(
TAG
+
"能否播放(场景检查) :"
+
canShowByScene
);
LogUtil
.
d
(
TAG
+
"能否播放(次数检查):"
+
adDataCanShow
);
LogUtil
.
d
(
TAG
+
"能否播放(缓存检查) :"
+
adReady
);
return
canShowByScene
&&
adDataCanShow
&&
adReady
;
}
/**
* 此设备是否是第一次播放外展
*
* @return
*/
private
boolean
isAppFirstStartInTheDevices
()
{
boolean
isAppFirstStartInTheDevices
=
AppOutSP
.
isAppFirstStart
();
if
(
isAppFirstStartInTheDevices
)
{
AppOutSP
.
setIsAppFirstStart
(
false
);
}
return
isAppFirstStartInTheDevices
;
}
/**
* 检查是否需要展示外展广告(轮询)
*/
public
void
checkShowOutAd
()
{
EventUtils
.
statTimeTriggle
();
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>轮询检查<<< 是否需要展示广告 =============>>> START"
);
LogUtil
.
d
(
TAG
+
">>>轮询检查<<< 是否需要展示广告 =============>>> START"
);
LogUtil
.
d
(
TAG
);
OutAdData
.
NormalAdData
adData
=
getAdData
();
if
(
adData
==
null
)
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>轮询检查<<< 是否需要展示广告 =============>>> END 广告信息为空 不播放"
);
LogUtil
.
d
(
TAG
);
return
;
}
long
lastShowTime
=
OutHelp
.
get
().
getLastShowTime
();
long
curTime
=
System
.
currentTimeMillis
();
long
showIntervalTime
=
Math
.
abs
(
curTime
-
lastShowTime
);
LogUtil
.
d
(
TAG
+
"检查是否需要展示广告 上次展示时间="
+
lastShowTime
);
long
spaceTime
;
if
(
OutHelp
.
get
().
iconIsHide
())
{
spaceTime
=
adData
.
intervalHide
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"检查是否需要展示广告 间隔时间(icon隐藏)="
+
spaceTime
);
}
else
{
spaceTime
=
adData
.
interval
*
DateUtils
.
SECOND_IN_MILLIS
;
LogUtil
.
d
(
TAG
+
"检查是否需要展示广告 间隔时间(icon未隐藏)="
+
spaceTime
);
}
LogUtil
.
d
(
TAG
+
"检查是否需要展示广告 播放间隔时间="
+
showIntervalTime
);
if
(
showIntervalTime
<
spaceTime
)
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>轮询检查<<< 是否需要展示广告 =============>>> END 未达到间隔时间 不播放"
);
LogUtil
.
d
(
TAG
);
Statistics
.
getInstance
().
dotEvent
(
"lx_fail"
);
}
else
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>轮询检查<<< 是否需要展示广告 =============>>> END 达到间隔时间 播放"
);
LogUtil
.
d
(
TAG
);
startShowOutAd
(
ActionFrom
.
ACTION_TIMER
);
Statistics
.
getInstance
().
dotEvent
(
"lx_success"
);
}
}
/**
* 广告播放失败时,检查重试次数,间隔重试时间再次播放
*/
public
void
showAdFail
()
{
// showAdFailTimes++;
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> START"
);
LogUtil
.
d
(
TAG
+
">>>重试检查<<< 配置 重试间隔时间:"
+
IconHelp
.
get
().
getRetryShowAdTime
()
+
"ms 重试次数:"
+
IconHelp
.
get
().
getRetryShowAdCount
());
// if (showAdFailTimes <= IconHelp.get().getRetryShowAdCount()) {
// LogUtil.d(TAG + ">>>重试检查<<< =============>>> END 需要重试 计时" + IconHelp.get().getRetryShowAdTime() + "ms后再次重试 当前重试次数:" + showAdFailTimes);
// new Handler(Looper.getMainLooper()).postDelayed(() -> {
// checkNeedLoadAd(ActionFrom.ACTION_UNKNOWN);
// LogUtil.d(TAG + ">>>重试检查<<< 计时完成,去重新加载广告");
// }, IconHelp.get().getRetryShowAdTime());
// } else {
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> END 重试超过次数 不再重试"
);
returnFailCallBack
(
"retry over time"
);
OutHelp
.
get
().
setLastShowTime
();
// cleanLoadAdFailTime();
// AppOutSP.saveHomeLastShowTime(System.currentTimeMillis());
// }
}
private
volatile
boolean
working
=
false
;
/**
* 开始进入广告逻辑
*
...
...
@@ -194,82 +76,72 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>广告逻辑开始<<< ===> START action="
+
actionFrom
);
LogUtil
.
d
(
TAG
);
doWork
(
actionFrom
,
true
);
if
(
working
)
{
LogUtil
.
d
(
TAG
+
">>>广告逻辑正在执行, 返回!"
);
return
;
}
workHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
doWork
(
actionFrom
);
}
});
}
private
long
lastDoWork
=
0L
;
/**
* 外展逻辑开始
*
* @param actionFrom
*/
public
void
doWork
(
ActionFrom
actionFrom
,
boolean
checkLastDoWorkTime
)
{
if
(
checkLastDoWorkTime
&&
System
.
currentTimeMillis
()
-
lastDoWork
<
500
)
{
Statistics
.
getInstance
().
dotEvent
(
EventUtils
.
OUT_AD_START_FAIL_INVERT_TIME
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< =============>>> END 触发太频繁"
);
return
;
}
lastDoWork
=
System
.
currentTimeMillis
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
String
.
valueOf
(
actionFrom
.
getAction
()));
Statistics
.
getInstance
().
dotEvent
(
OutHelp
.
get
().
getContext
(),
EventUtils
.
OUT_AD_START
,
""
,
map
);
OutAdData
.
NormalAdData
adData
=
getAdData
();
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< =============>>> start"
);
LogUtil
.
d
(
TAG
);
// TODO
// if (DeepNight.checkDeepNightRunning()) {
// OutHelp.get().wakeOn();
// }
// 场景检查
boolean
canShowByScene
=
CheckHelper
.
checkAdCanShowByScene
(
actionFrom
.
getAction
(),
EventUtils
.
SCENES_SHOW
);
//次数检查和时间间隔检查
boolean
adTimesNoExceed
=
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
adData
,
actionFrom
.
getAction
(),
EventUtils
.
SCENES_SHOW
);
//是否有缓存
boolean
adReady
=
CheckHelper
.
checkAdReady
(
adData
,
EventUtils
.
SCENES_SHOW
);
private
void
doWork
(
ActionFrom
actionFrom
)
{
try
{
working
=
true
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
String
.
valueOf
(
actionFrom
.
getAction
()));
Statistics
.
getInstance
().
dotEvent
(
OutHelp
.
get
().
getContext
(),
EventUtils
.
OUT_AD_START
,
""
,
map
);
//能否展示广告
boolean
adCanShow
=
canShowByScene
&&
adTimesNoExceed
&&
adReady
;
OutAdData
.
NormalAdData
adData
=
getAdData
();
if
(
adData
==
null
)
{
return
;
}
if
(
adCanShow
)
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< ============
>>> END 检查通过 开始启动SLK
"
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< ============
=>>> start
"
);
LogUtil
.
d
(
TAG
);
// hadStartAdDialogFail = false;
// OutHelp.get().setShowLock(true);
//次数检查
boolean
adTimesNoExceed
=
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
adData
,
actionFrom
.
getAction
(),
EventUtils
.
SCENES_SHOW
);
if
(!
adTimesNoExceed
)
{
LogUtil
.
d
(
TAG
+
"(次数检查)超过次数限制,返回"
);
return
;
}
// if (!AppOutUtils.isScreenOn()) {
// OutHelp.get().wakeOn();
// }
if
(
AdManagerV2
.
get
().
loadAd
(
adData
.
cpAdslot
))
{
LogUtil
.
d
(
TAG
+
" 预加载广告,返回"
);
return
;
}
//场景检查
boolean
canShowByScene
=
CheckHelper
.
checkAdCanShowByScene
(
actionFrom
.
getAction
(),
EventUtils
.
SCENES_SHOW
);
if
(!
canShowByScene
)
{
LogUtil
.
d
(
TAG
+
" 场景检查不通过,返回"
);
return
;
}
//时间间隔检查
boolean
adInterval
=
CheckHelper
.
checkCanShowAdByInterValFromAdData
(
adData
,
actionFrom
.
getAction
(),
EventUtils
.
SCENES_SHOW
);
if
(!
adInterval
)
{
LogUtil
.
d
(
TAG
+
" 时间间隔内,返回"
);
return
;
}
LogUtil
.
d
(
TAG
+
">>>播放广告<<< ============>>> END 检查通过 开始启动SLK"
);
startAdDialog
(
OutHelp
.
get
().
getContext
(),
actionFrom
,
getReminderInfo
(),
adData
);
return
;
}
catch
(
Exception
e
)
{
}
finally
{
working
=
false
;
}
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< =============>>> END 不能播放广告"
);
LogUtil
.
d
(
TAG
);
//能否预加载广告
boolean
adCanLoad
=
canShowByScene
&&
adTimesNoExceed
&&
!
adReady
;
if
(
adCanLoad
)
{
LogUtil
.
d
(
TAG
+
">>>播放广告<<< =============>>> END 不能播放广告 场景检测通过,去加载广告"
);
preloadByData
(
actionFrom
,
adData
);
}
else
{
LogUtil
.
d
(
TAG
+
">>>播放广告<<< =============>>> END 不能播放广告 场景检测不通过,不能加载广告"
);
returnFailCallBack
(
"scene check fail"
);
}
}
...
...
@@ -296,15 +168,6 @@ public class OutAdManager extends BaseOutShowManager {
* 去拉起外展弹窗 播放or加载广告
*/
private
void
startAdDialog
(
Context
context
,
ActionFrom
actionFrom
,
RemindersInfo
remindersInfo
,
OutAdData
.
NormalAdData
data
)
{
// if (System.currentTimeMillis() - lastStartAdDialogTime <= startAdDialogIntervalTime) {
// EventUtils.staDialogFail(DialogFailReason.INTERVAL_TIME_START_DIALOG, actionFrom.getAction(), EventUtils.SCENES_SHOW, EventUtils.DIALOG_TYPE_AD);
// LogUtil.d(TAG + "拉起外展弹窗失败 : 5秒内不能重复拉起");
// return;
// }
//
// lastStartAdDialogTime = System.currentTimeMillis();
try
{
Intent
intent
=
new
Intent
();
intent
.
setComponent
(
new
ComponentName
(
context
,
OutHelp
.
get
().
getActivityName
()));
...
...
@@ -319,8 +182,8 @@ public class OutAdManager extends BaseOutShowManager {
AppOutUtils
.
unlockSystem
();
}
DxManager
.
get
().
setOutRemindersInfo
(
remindersInfo
);
DxManager
.
get
().
setOutAdData
(
data
);
/*
DxManager.get().setOutRemindersInfo(remindersInfo);
DxManager.get().setOutAdData(data);
*/
EventUtils
.
statRemindOutFgSurpriseStart
(
EventUtils
.
SLK_START
,
""
,
true
,
actionFrom
.
getAction
());
...
...
@@ -379,100 +242,6 @@ public class OutAdManager extends BaseOutShowManager {
}
/**
* 不能进入广告播放逻辑
* 检查是否需要加载广告
* <p>
* 场景检查以通过
* 检查广告数据和缓存
* 再去加载广告
*/
public
void
checkNeedLoadAd
(
ActionFrom
actionFrom
)
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> start"
);
LogUtil
.
d
(
TAG
);
ArrayList
<
OutAdData
.
NormalAdData
>
list
=
AdDataManager
.
get
().
getOutAdData
(
OutAdData
.
POSITION_HOME
,
OutAdData
.
CP_AD_TOPON
);
int
size
=
list
.
size
();
if
(
size
==
0
)
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 外展广告数据为空"
);
LogUtil
.
d
(
TAG
);
OutAdData
.
NormalAdData
localData
=
getAdData
();
if
(
localData
!=
null
&&
CheckHelper
.
checkAdCanShowByScene
(
actionFrom
.
getAction
(),
EventUtils
.
SCENES_CHECK
)
&&
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
localData
,
-
1
,
EventUtils
.
SCENES_CHECK
)
&&
!
CheckHelper
.
checkAdReady
(
localData
,
EventUtils
.
SCENES_CHECK
))
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 加载广告(使用本地数据)"
);
LogUtil
.
d
(
TAG
);
preloadByData
(
actionFrom
,
localData
);
}
else
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 没有能加载的广告"
);
LogUtil
.
d
(
TAG
);
returnFailCallBack
(
"no ad data"
);
}
return
;
}
OutAdData
.
NormalAdData
preLoadData
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
preLoadData
=
list
.
get
(
i
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< index:"
+
i
+
" 检查广告能否加载:"
+
preLoadData
);
if
(
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
preLoadData
,
-
1
,
EventUtils
.
SCENES_CHECK
)
&&
!
CheckHelper
.
checkAdReady
(
preLoadData
,
EventUtils
.
SCENES_CHECK
))
{
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 加载广告"
);
LogUtil
.
d
(
TAG
);
preloadByData
(
actionFrom
,
preLoadData
);
return
;
}
}
returnFailCallBack
(
"no ad data"
);
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 没有能加载的广告"
);
LogUtil
.
d
(
TAG
);
}
/**
* 前置条件检查都已通过,直接去加载广告
*/
private
void
preloadByData
(
ActionFrom
actionFrom
,
OutAdData
.
NormalAdData
normalAdData
)
{
if
(
normalAdData
==
null
)
{
returnFailCallBack
(
"ad data is null"
);
return
;
}
LogUtil
.
d
(
TAG
+
"加载广告(插屏) adData :"
+
normalAdData
);
// hadStartAdDialogFail = false;
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 去加载广告"
);
try
{
// TopOnAdLoadManager.getInstance().loadInterstitialAd(normalAdData, AdScenes.AD_SCENES_PURE);
AdManagerV2
.
get
().
loadAd
(
normalAdData
.
cpAdslot
);
}
catch
(
Exception
e
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"reason"
,
e
.
getMessage
());
map
.
put
(
"scenes"
,
"load ad"
);
Statistics
.
getInstance
().
dotEvent
(
OutHelp
.
get
().
getContext
(),
"class error"
,
""
,
map
);
}
}
public
void
showAdSuccess
(
OutAdData
.
NormalAdData
adData
)
{
LogUtil
.
d
(
TAG
,
"showAdSuccess adData ="
+
adData
);
if
(
adData
==
null
)
{
...
...
app/src/main/java/com/zl/sdk/out/deepNightModle/DeepNight.java
deleted
100644 → 0
View file @
fee49b99
package
com
.
zl
.
sdk
.
out
.
deepNightModle
;
import
android.util.Log
;
import
com.zl.sdk.ad.AdDataManager
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.out.AppOutSP
;
import
com.zl.sdk.out.CheckHelper
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.Calendar
;
public
class
DeepNight
{
private
static
boolean
isOpen
=
true
;
private
static
int
start_time
=
2
;
private
static
int
end_time
=
5
;
private
static
boolean
deepNightRunning
=
false
;
/**
* 深夜模式是否开启
*
* @return
*/
public
static
boolean
deepNightIsOpen
()
{
return
isOpen
;
}
/**
* 深夜模式能否开始
*
* @return
*/
public
static
boolean
checkDeepNightRunning
()
{
// if (deepNightRunning) {
// deepNightRunning = checkTime() && checkAdTimes();
// } else {
// deepNightRunning = deepNightIsOpen() && checkTime() && checkAdTimes();
// }
return
deepNightIsOpen
()
&&
checkTime
();
}
/**
* 深夜模式 检查当前时间
*
* @return
*/
private
static
boolean
checkTime
()
{
int
curr_hour
=
Calendar
.
getInstance
().
get
(
Calendar
.
HOUR_OF_DAY
);
LogUtil
.
d
(
"OutShow curr_hour ="
+
curr_hour
);
return
start_time
<=
curr_hour
&&
curr_hour
<
end_time
;
}
/**
* 深夜模式 检查上次熄屏时间
*
* @return
*/
private
static
boolean
checkLastScreenOffTime
()
{
return
System
.
currentTimeMillis
()
-
AppOutSP
.
getLastScreenOffTime
()
>=
10
*
60
*
1000L
;
}
private
static
boolean
checkAdTimes
()
{
return
CheckHelper
.
checkCanShowAdByTimesFromAdData
(
AdDataManager
.
get
().
getShowAdData
(),
-
1
,
EventUtils
.
SCENES_SHOW
);
}
}
app/src/main/java/com/zl/sdk/out/ui/DxActivity.java
View file @
f8306a2f
...
...
@@ -10,15 +10,12 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.widget.FrameLayout
;
import
com.zl.sdk.Config
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.ad.AdManagerV2
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.icon.IconHelp
;
import
com.zl.sdk.
out.DxManager
;
import
com.zl.sdk.
util.AppOutUtils
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.HashMap
;
...
...
@@ -27,11 +24,6 @@ import java.util.Map;
public
class
DxActivity
extends
BaseActivity
{
private
static
final
String
TAG
=
"OutShow Dx ---> "
;
// private Intent intent = null;
// private RemindersInfo remindersInfo;
// private OutAdData.NormalAdData adData;
// private IView proxyView;
private
long
onceStayTime
;
private
boolean
hadStart
=
false
;
...
...
@@ -45,36 +37,31 @@ public class DxActivity extends BaseActivity {
@Override
public
void
onBeforeCreate
(
Bundle
bundle
)
{
// OutHelp.get().setShowLock(true);
hadStart
=
false
;
}
@Override
public
void
onAfterCreate
(
Bundle
bundle
)
{
LogUtil
.
d
(
TAG
+
"onCreate"
);
// DxManager.get().addActivity(this);
}
@Override
public
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
// LogUtil.d(TAG + "onNewIntent : " + hasExecuteInLifeCycle);
// if (!hasExecuteInLifeCycle) {
// execute();
// }
}
@Override
public
void
onStart
()
{
super
.
onStart
();
LogUtil
.
d
(
TAG
+
"onStart"
);
if
(
hadStart
)
{
close
();
return
;
}
LogUtil
.
d
(
TAG
+
"onStart"
);
mainHandler
.
removeCallbacksAndMessages
(
null
);
mainHandler
.
postDelayed
(
new
Runnable
()
{
@Override
...
...
@@ -89,18 +76,12 @@ public class DxActivity extends BaseActivity {
public
void
onResume
()
{
super
.
onResume
();
LogUtil
.
d
(
TAG
+
"onResume hashCode="
+
hashCode
());
// if (proxyView != null) {
// proxyView.onResume();
// }
}
@Override
public
void
onPause
()
{
super
.
onPause
();
LogUtil
.
d
(
TAG
+
"onPause hashCode="
+
hashCode
());
// if (proxyView != null) {
// proxyView.onPause();
// }
}
@Override
...
...
@@ -112,10 +93,6 @@ public class DxActivity extends BaseActivity {
@Override
public
void
onDestroy
()
{
LogUtil
.
d
(
TAG
+
"onDestroy hashCode="
+
hashCode
());
// if (proxyView != null) {
// proxyView.onDestroy();
// proxyView = null;
// }
mainHandler
.
removeCallbacksAndMessages
(
null
);
...
...
@@ -124,8 +101,6 @@ public class DxActivity extends BaseActivity {
map
.
put
(
"s_d_t"
,
String
.
valueOf
(
time
));
Statistics
.
getInstance
().
onEvent
(
OutHelp
.
get
().
getContext
(),
EventUtils
.
OUT_DIALOG_EXPOSE_ONCE_STAY_TIME
,
null
,
map
);
super
.
onDestroy
();
// DxManager.get().removeActivity(this);
}
@Override
...
...
@@ -134,10 +109,6 @@ public class DxActivity extends BaseActivity {
}
public
void
close
()
{
// if (proxyView != null) {
// proxyView.onDestroy();
// proxyView = null;
// }
activity
.
finish
();
}
...
...
@@ -152,47 +123,20 @@ public class DxActivity extends BaseActivity {
}
private
void
statSLKStart
(
RemindersInfo
remindersInfo
,
boolean
isHide
)
{
private
void
statSLKStart
(
boolean
isHide
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
type
=
""
;
// if (remindersInfo != null) {
// type = String.valueOf(remindersInfo.reminderType);
// }
map
.
put
(
"type"
,
type
);
map
.
put
(
"hide"
,
String
.
valueOf
(
isHide
));
map
.
put
(
"screen_state"
,
String
.
valueOf
(
AppOutUtils
.
isScreenOn
()));
map
.
put
(
"foreground"
,
OutHelp
.
get
().
isAppForeground
());
Statistics
.
getInstance
().
dotEvent
(
activity
,
"slk_start"
,
""
,
map
);
}
private
void
execute
()
{
// checkIntent();
startShowDialog
();
}
// private void checkIntent() {
// adData = null;
// remindersInfo = null;
//
// adData = (OutAdData.NormalAdData) DxManager.get().getOutAdData();
// LogUtil.d(TAG + "广告信息 =" + adData);
//
// remindersInfo = DxManager.get().getOutRemindersInfo();
// LogUtil.d(TAG + "弹窗信息 =" + remindersInfo);
// }
private
void
startShowDialog
()
{
statSLKStart
(
null
,
IconHelp
.
get
().
isIconHide
());
// if (remindersInfo == null) {
// LogUtil.d(TAG + "finish remindersInfo为空");
// close();
// return;
// }
//
// if (remindersInfo.reminderType != Config.REMINDER_TYPE_WEATHER_PURE_AD && IconHelp.get().isIconHide()) {
// LogUtil.d(TAG + "finish 不是纯广告并且隐藏了icon");
// close();
// return;
// }
statSLKStart
(
IconHelp
.
get
().
isIconHide
());
Window
window
=
activity
.
getWindow
();
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_SECURE
);
...
...
@@ -202,21 +146,6 @@ public class DxActivity extends BaseActivity {
onceStayTime
=
System
.
currentTimeMillis
();
if
(
AdManagerV2
.
get
().
isAdReady
())
{
AdManagerV2
.
get
().
showAd
(
activity
);
}
else
{
close
();
}
// LogUtil.d(TAG + "加载新的Dialog");
// proxyView = DialogFactory.createDialog(remindersInfo, adData);
//
// if (proxyView == null) {
// LogUtil.d(TAG + "finish 5 View=null");
// close();
// return;
// }
//
// proxyView.onCreate(activity, intent, rootView);
AdManagerV2
.
get
().
showAd
(
activity
);
}
}
app/src/main/java/com/zl/sdk/util/AppOutUtils.java
View file @
f8306a2f
...
...
@@ -51,7 +51,9 @@ public final class AppOutUtils {
public
static
boolean
isScreenOn
()
{
try
{
PowerManager
powerManager
=
(
PowerManager
)
OutHelp
.
get
().
getContext
().
getSystemService
(
Context
.
POWER_SERVICE
);
return
powerManager
.
isScreenOn
();
boolean
isScreenOn
=
powerManager
.
isInteractive
();
LogUtil
.
d
(
TAG
+
"isScreenOn="
+
isScreenOn
);
return
isScreenOn
;
}
catch
(
Exception
e
)
{
}
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment