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
25ca2809
Commit
25ca2809
authored
Jan 03, 2024
by
xujialang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新版广告管理类
取消自动亮屏 增加亮屏条件判断
parent
3c413ef3
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1050 additions
and
855 deletions
+1050
-855
OutHelp.java
app/src/main/java/com/zl/sdk/OutHelp.java
+11
-10
AdManagerV2.java
app/src/main/java/com/zl/sdk/ad/AdManagerV2.java
+173
-0
TopOnAdLoadManager.java
app/src/main/java/com/zl/sdk/ad/TopOnAdLoadManager.java
+526
-526
CheckHelper.java
app/src/main/java/com/zl/sdk/out/CheckHelper.java
+9
-7
OutAdManager.java
app/src/main/java/com/zl/sdk/out/OutAdManager.java
+36
-33
DialogFactory.java
app/src/main/java/com/zl/sdk/out/ui/DialogFactory.java
+2
-1
DxActivity.java
app/src/main/java/com/zl/sdk/out/ui/DxActivity.java
+72
-56
PureAdDialog.java
app/src/main/java/com/zl/sdk/out/ui/PureAdDialog.java
+221
-222
No files found.
app/src/main/java/com/zl/sdk/OutHelp.java
View file @
25ca2809
...
@@ -140,7 +140,7 @@ public final class OutHelp implements KPListener {
...
@@ -140,7 +140,7 @@ public final class OutHelp implements KPListener {
}
}
private
void
initTriggerConditions
()
{
private
void
initTriggerConditions
()
{
//
initTimer();
initTimer
();
// initReceiver();
// initReceiver();
registerActivityLifecycle
();
registerActivityLifecycle
();
registerAction
();
registerAction
();
...
@@ -154,13 +154,14 @@ public final class OutHelp implements KPListener {
...
@@ -154,13 +154,14 @@ public final class OutHelp implements KPListener {
timer
.
schedule
(
new
TimerTask
()
{
timer
.
schedule
(
new
TimerTask
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
/* if (!DataManager.get().checkOutOpen(mContext)) {
// if (!DataManager.get().checkOutOpen(mContext)) {
Map<String, String> map = new HashMap<>();
// Map<String, String> map = new HashMap<>();
map.put("position", "time");
// map.put("position", "time");
Statistics.getInstance().dotEvent("out_close", map);
// Statistics.getInstance().dotEvent("out_close", map);
LogUtil.d(TAG + "外展未开启,不轮询检测");
// LogUtil.d(TAG + "外展未开启,不轮询检测");
return;
// return;
}*/
// }
Statistics
.
getInstance
().
dotEvent
(
"out_open"
);
Statistics
.
getInstance
().
dotEvent
(
"out_open"
);
LogUtil
.
d
(
TAG
,
"firstLx : "
+
firstLx
);
LogUtil
.
d
(
TAG
,
"firstLx : "
+
firstLx
);
showOutAd
(
firstLx
);
showOutAd
(
firstLx
);
...
@@ -486,7 +487,7 @@ public final class OutHelp implements KPListener {
...
@@ -486,7 +487,7 @@ public final class OutHelp implements KPListener {
// new StartCallbackProxy(callObj, callback)
// new StartCallbackProxy(callObj, callback)
// );
// );
surpriseMethod
.
invoke
(
null
,
mContext
,
intent
,
""
,
true
,
null
,
n
otificationConfig
);
surpriseMethod
.
invoke
(
null
,
mContext
,
intent
,
""
,
true
,
null
,
n
ull
);
}
catch
(
ClassNotFoundException
|
InvocationTargetException
|
NoSuchMethodException
|
}
catch
(
ClassNotFoundException
|
InvocationTargetException
|
NoSuchMethodException
|
IllegalAccessException
|
InstantiationException
e
)
{
IllegalAccessException
|
InstantiationException
e
)
{
...
@@ -503,7 +504,7 @@ public final class OutHelp implements KPListener {
...
@@ -503,7 +504,7 @@ public final class OutHelp implements KPListener {
try
{
try
{
PowerManager
pm
=
(
PowerManager
)
mContext
.
getSystemService
(
POWER_SERVICE
);
PowerManager
pm
=
(
PowerManager
)
mContext
.
getSystemService
(
POWER_SERVICE
);
mWakelock
=
pm
.
newWakeLock
(
PowerManager
.
ACQUIRE_CAUSES_WAKEUP
|
PowerManager
.
SCREEN_DIM_WAKE_LOCK
,
"target"
);
mWakelock
=
pm
.
newWakeLock
(
PowerManager
.
ACQUIRE_CAUSES_WAKEUP
|
PowerManager
.
SCREEN_DIM_WAKE_LOCK
,
"target"
);
mWakelock
.
acquire
(
6
0
*
1000L
);
mWakelock
.
acquire
(
3
0
*
1000L
);
}
catch
(
Exception
ignored
)
{
}
catch
(
Exception
ignored
)
{
if
(
mWakelock
!=
null
)
{
if
(
mWakelock
!=
null
)
{
mWakelock
.
release
();
mWakelock
.
release
();
...
...
app/src/main/java/com/zl/sdk/ad/AdManagerV2.java
0 → 100644
View file @
25ca2809
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
;
import
com.anythink.core.api.AdError
;
import
com.anythink.interstitial.api.ATInterstitial
;
import
com.anythink.interstitial.api.ATInterstitialListener
;
import
com.zl.sdk.OutHelp
;
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
java.util.Date
;
public
class
AdManagerV2
implements
ATInterstitialListener
{
private
ATInterstitial
atInterstitial
=
null
;
private
int
reloadCount
=
3
;
private
String
adId
=
""
;
private
long
requestTime
=
0L
;
private
static
final
AdManagerV2
mgr
=
new
AdManagerV2
();
private
AdManagerV2
()
{
}
public
static
AdManagerV2
get
()
{
return
mgr
;
}
@Override
public
void
onInterstitialAdLoaded
()
{
Log
.
d
(
"OutShow"
,
"Topon: ad loaded"
);
reloadCount
=
3
;
if
(
atInterstitial
.
checkValidAdCaches
()
==
null
||
atInterstitial
.
checkValidAdCaches
().
isEmpty
())
{
EventUtils
.
statAdLoaded
(
getReportBean
(
null
,
null
),
requestTime
);
}
else
{
EventUtils
.
statAdLoaded
(
getReportBean
(
atInterstitial
.
checkValidAdCaches
().
get
(
0
),
null
),
requestTime
);
}
//记录广告返回的时间,供上报缓存时间和价格
requestTime
=
System
.
currentTimeMillis
();
}
@Override
public
void
onInterstitialAdLoadFail
(
AdError
adError
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad load fail"
);
String
builder
=
"error info : code="
+
adError
.
getCode
()
+
" msg="
+
adError
.
getDesc
()
+
" all="
+
adError
.
getFullErrorInfo
();
EventUtils
.
statAdLoadFail
(
getReportBean
(
null
,
builder
),
requestTime
);
reloadCount
--;
if
(
reloadCount
>
0
)
{
atInterstitial
=
new
ATInterstitial
(
OutHelp
.
get
().
getContext
(),
adId
);
atInterstitial
.
setAdListener
(
this
);
atInterstitial
.
load
();
requestTime
=
System
.
currentTimeMillis
();
EventUtils
.
statAdReport
(
getReportRequestBean
(
adId
));
}
else
{
reloadCount
=
3
;
}
}
@Override
public
void
onInterstitialAdClicked
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad click"
);
EventUtils
.
statAdClick
(
getReportBean
(
atAdInfo
,
null
));
}
@Override
public
void
onInterstitialAdShow
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad show"
);
int
outInterstitialAdDayShowCount
=
AppOutSP
.
getOutInterstitialAdDayShowCount
()
+
1
;
AppOutSP
.
saveOutInterstitialAdDayShowCount
(
outInterstitialAdDayShowCount
);
Log
.
d
(
"OutShow"
,
"Topon: ad show times="
+
outInterstitialAdDayShowCount
);
EventUtils
.
statAdExpose
(
getReportBean
(
atAdInfo
,
null
));
atInterstitial
=
new
ATInterstitial
(
OutHelp
.
get
().
getContext
(),
adId
);
atInterstitial
.
setAdListener
(
this
);
atInterstitial
.
load
();
requestTime
=
System
.
currentTimeMillis
();
EventUtils
.
statAdReport
(
getReportRequestBean
(
adId
));
}
@Override
public
void
onInterstitialAdClose
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad close"
);
EventUtils
.
statAdClose
(
getReportBean
(
atAdInfo
,
null
));
}
@Override
public
void
onInterstitialAdVideoStart
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video start"
);
}
@Override
public
void
onInterstitialAdVideoEnd
(
ATAdInfo
atAdInfo
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video end"
);
}
@Override
public
void
onInterstitialAdVideoError
(
AdError
adError
)
{
Log
.
d
(
"OutShow"
,
"Topon: ad video error"
);
}
public
void
loadAd
(
String
id
)
{
Log
.
d
(
"OutShow"
,
"Topon: loadAd : "
+
id
);
adId
=
id
;
if
(
atInterstitial
!=
null
)
{
ATAdStatusInfo
atAdStatusInfo
=
atInterstitial
.
checkAdStatus
();
if
(!
atAdStatusInfo
.
isReady
()
&&
!
atAdStatusInfo
.
isLoading
())
{
atInterstitial
.
load
();
requestTime
=
System
.
currentTimeMillis
();
EventUtils
.
statAdReport
(
getReportRequestBean
(
adId
));
}
}
else
{
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
;
}
}
public
void
showAd
(
Activity
activity
)
{
Log
.
d
(
"OutShow"
,
"Topon: showAd"
);
ATInterstitial
.
entryAdScenario
(
"111"
,
""
);
atInterstitial
.
show
(
activity
);
}
private
ReportBean
getReportBean
(
ATAdInfo
adInfo
,
String
errorMsg
)
{
ReportBean
bean
=
new
ReportBean
();
bean
.
adtype
=
AdsParamsInfo
.
INTERSTITIAL
;
bean
.
adUnitId
=
adId
;
if
(
null
!=
adInfo
)
{
bean
.
platform
=
adInfo
.
getNetworkPlacementId
();
bean
.
source
=
adInfo
.
getAdNetworkType
();
}
bean
.
ad_msg_error
=
errorMsg
;
bean
.
time
=
(
new
Date
()).
getTime
();
return
bean
;
}
private
ReportBean
getReportRequestBean
(
String
adId
)
{
ReportBean
bean
=
new
ReportBean
();
bean
.
eventid
=
AdsParamsInfo
.
F_REQUEST
;
bean
.
adtype
=
AdsParamsInfo
.
INTERSTITIAL
;
bean
.
adUnitId
=
adId
;
return
bean
;
}
}
app/src/main/java/com/zl/sdk/ad/TopOnAdLoadManager.java
View file @
25ca2809
This diff is collapsed.
Click to expand it.
app/src/main/java/com/zl/sdk/out/CheckHelper.java
View file @
25ca2809
...
@@ -7,11 +7,12 @@ import android.net.NetworkInfo;
...
@@ -7,11 +7,12 @@ import android.net.NetworkInfo;
import
android.text.format.DateUtils
;
import
android.text.format.DateUtils
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.ad.
TopOnAdLoadManager
;
import
com.zl.sdk.ad.
AdManagerV2
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.event.DialogFailReason
;
import
com.zl.sdk.event.DialogFailReason
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.event.statistics.Statistics
;
import
com.zl.sdk.util.AppOutUtils
;
import
com.zl.sdk.util.LogUtil
;
import
com.zl.sdk.util.LogUtil
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -45,11 +46,11 @@ public class CheckHelper {
...
@@ -45,11 +46,11 @@ public class CheckHelper {
// return false;
// return false;
// }
// }
//
//
//
if (needCheckScreenOff(actionState) && !AppOutUtils.isScreenOn()) {
if
(
needCheckScreenOff
(
actionState
)
&&
!
AppOutUtils
.
isScreenOn
())
{
//
LogUtil.d(TAG + "(场景检查)手机未亮屏,不能展示");
LogUtil
.
d
(
TAG
+
"(场景检查)手机未亮屏,不能展示"
);
//
EventUtils.staDialogFail(DialogFailReason.SCREEN_OFF, actionState, scenes, EventUtils.DIALOG_TYPE_AD);
EventUtils
.
staDialogFail
(
DialogFailReason
.
SCREEN_OFF
,
actionState
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
//
return false;
return
false
;
//
}
}
if
(
actionState
!=
ActionFrom
.
ACTION_INIT_START
.
getAction
()
&&
isTelephonyCalling
())
{
if
(
actionState
!=
ActionFrom
.
ACTION_INIT_START
.
getAction
()
&&
isTelephonyCalling
())
{
LogUtil
.
d
(
TAG
+
"(场景检查)通话中,不能展示"
);
LogUtil
.
d
(
TAG
+
"(场景检查)通话中,不能展示"
);
...
@@ -240,7 +241,8 @@ public class CheckHelper {
...
@@ -240,7 +241,8 @@ public class CheckHelper {
return
false
;
return
false
;
}
}
try
{
try
{
boolean
ready
=
TopOnAdLoadManager
.
getInstance
().
isInterstitialReady
(
data
.
cpName
,
data
.
cpAdslot
);
// boolean ready = TopOnAdLoadManager.getInstance().isInterstitialReady(data.cpName, data.cpAdslot);
boolean
ready
=
AdManagerV2
.
get
().
isAdReady
();
LogUtil
.
d
(
TAG
+
"(缓存检查)是否有缓存:"
+
ready
);
LogUtil
.
d
(
TAG
+
"(缓存检查)是否有缓存:"
+
ready
);
if
(!
ready
)
{
if
(!
ready
)
{
EventUtils
.
staDialogFail
(
DialogFailReason
.
NOT_READY
,
-
1
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
EventUtils
.
staDialogFail
(
DialogFailReason
.
NOT_READY
,
-
1
,
scenes
,
EventUtils
.
DIALOG_TYPE_AD
);
...
...
app/src/main/java/com/zl/sdk/out/OutAdManager.java
View file @
25ca2809
...
@@ -10,7 +10,7 @@ import android.text.format.DateUtils;
...
@@ -10,7 +10,7 @@ import android.text.format.DateUtils;
import
com.zl.sdk.Config
;
import
com.zl.sdk.Config
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.ad.AdDataManager
;
import
com.zl.sdk.ad.AdDataManager
;
import
com.zl.sdk.ad.
TopOnAdLoadManager
;
import
com.zl.sdk.ad.
AdManagerV2
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.EventUtils
;
...
@@ -40,18 +40,19 @@ public class OutAdManager extends BaseOutShowManager {
...
@@ -40,18 +40,19 @@ public class OutAdManager extends BaseOutShowManager {
private
static
final
String
TAG
=
"OutShow OutAdManager --> "
;
private
static
final
String
TAG
=
"OutShow OutAdManager --> "
;
//展示广告失败次数
// 展示广告失败次数
private
int
showAdFailTimes
=
0
;
// private int showAdFailTimes = 0;
//是否重试了
private
volatile
boolean
hadStartAdDialogFail
=
false
;
// //是否重试了
//上次拉起外展弹窗时间
// private volatile boolean hadStartAdDialogFail = false;
private
long
lastStartAdDialogTime
=
0L
;
// //上次拉起外展弹窗时间
// private long lastStartAdDialogTime = 0L;
//限制不能重复拉起外展弹窗的时间
//限制不能重复拉起外展弹窗的时间
// private final long startAdDialogIntervalTime = 5 * 1000L;
// private final long startAdDialogIntervalTime = 5 * 1000L;
public
void
cleanLoadAdFailTime
()
{
//
public void cleanLoadAdFailTime() {
showAdFailTimes
=
0
;
//
showAdFailTimes = 0;
}
//
}
@Override
@Override
OutAdData
.
NormalAdData
getAdData
()
{
OutAdData
.
NormalAdData
getAdData
()
{
...
@@ -166,25 +167,22 @@ public class OutAdManager extends BaseOutShowManager {
...
@@ -166,25 +167,22 @@ public class OutAdManager extends BaseOutShowManager {
* 广告播放失败时,检查重试次数,间隔重试时间再次播放
* 广告播放失败时,检查重试次数,间隔重试时间再次播放
*/
*/
public
void
showAdFail
()
{
public
void
showAdFail
()
{
showAdFailTimes
++;
//
showAdFailTimes++;
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> START"
);
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> START"
);
LogUtil
.
d
(
TAG
+
">>>重试检查<<< 配置 重试间隔时间:"
+
IconHelp
.
get
().
getRetryShowAdTime
()
+
"ms 重试次数:"
+
IconHelp
.
get
().
getRetryShowAdCount
());
LogUtil
.
d
(
TAG
+
">>>重试检查<<< 配置 重试间隔时间:"
+
IconHelp
.
get
().
getRetryShowAdTime
()
+
"ms 重试次数:"
+
IconHelp
.
get
().
getRetryShowAdCount
());
if
(
showAdFailTimes
<=
IconHelp
.
get
().
getRetryShowAdCount
())
{
// if (showAdFailTimes <= IconHelp.get().getRetryShowAdCount()) {
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> END 需要重试 计时"
+
IconHelp
.
get
().
getRetryShowAdTime
()
+
"ms后再次重试 当前重试次数:"
+
showAdFailTimes
);
// LogUtil.d(TAG + ">>>重试检查<<< =============>>> END 需要重试 计时" + IconHelp.get().getRetryShowAdTime() + "ms后再次重试 当前重试次数:" + showAdFailTimes);
new
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(()
->
{
// new Handler(Looper.getMainLooper()).postDelayed(() -> {
checkNeedLoadAd
(
ActionFrom
.
ACTION_UNKNOWN
);
// checkNeedLoadAd(ActionFrom.ACTION_UNKNOWN);
LogUtil
.
d
(
TAG
+
">>>重试检查<<< 计时完成,去重新加载广告"
);
// LogUtil.d(TAG + ">>>重试检查<<< 计时完成,去重新加载广告");
},
IconHelp
.
get
().
getRetryShowAdTime
());
// }, IconHelp.get().getRetryShowAdTime());
}
else
{
// } else {
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> END 重试超过次数 不再重试"
);
LogUtil
.
d
(
TAG
+
">>>重试检查<<< =============>>> END 重试超过次数 不再重试"
);
returnFailCallBack
(
"retry over time"
);
returnFailCallBack
(
"retry over time"
);
OutHelp
.
get
().
setLastShowTime
();
// cleanLoadAdFailTime();
cleanLoadAdFailTime
();
OutHelp
.
get
().
setLastShowTime
();
// AppOutSP.saveHomeLastShowTime(System.currentTimeMillis());
// AppOutSP.saveHomeLastShowTime(System.currentTimeMillis());
}
//
}
}
}
/**
/**
...
@@ -247,11 +245,13 @@ public class OutAdManager extends BaseOutShowManager {
...
@@ -247,11 +245,13 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil
.
d
(
TAG
+
">>>播放广告<<< ============>>> END 检查通过 开始启动SLK"
);
LogUtil
.
d
(
TAG
+
">>>播放广告<<< ============>>> END 检查通过 开始启动SLK"
);
LogUtil
.
d
(
TAG
);
LogUtil
.
d
(
TAG
);
hadStartAdDialogFail
=
false
;
// hadStartAdDialogFail = false;
// OutHelp.get().setShowLock(true);
// if (!AppOutUtils.isScreenOn()) {
// OutHelp.get().wakeOn();
// }
if
(!
AppOutUtils
.
isScreenOn
())
{
OutHelp
.
get
().
wakeOn
();
}
startAdDialog
(
OutHelp
.
get
().
getContext
(),
actionFrom
,
getReminderInfo
(),
adData
);
startAdDialog
(
OutHelp
.
get
().
getContext
(),
actionFrom
,
getReminderInfo
(),
adData
);
return
;
return
;
...
@@ -330,6 +330,8 @@ public class OutAdManager extends BaseOutShowManager {
...
@@ -330,6 +330,8 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil
.
d
(
TAG
+
"拉起广告弹窗 :"
+
OutHelp
.
get
().
getSdkName
());
LogUtil
.
d
(
TAG
+
"拉起广告弹窗 :"
+
OutHelp
.
get
().
getSdkName
());
OutHelp
.
get
().
setLastShowTime
();
OutHelp
.
get
().
startOutDialog
(
intent
,
new
DialogShowStatusCallback
()
{
OutHelp
.
get
().
startOutDialog
(
intent
,
new
DialogShowStatusCallback
()
{
@Override
@Override
public
void
success
()
{
public
void
success
()
{
...
@@ -457,11 +459,12 @@ public class OutAdManager extends BaseOutShowManager {
...
@@ -457,11 +459,12 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil
.
d
(
TAG
+
"加载广告(插屏) adData :"
+
normalAdData
);
LogUtil
.
d
(
TAG
+
"加载广告(插屏) adData :"
+
normalAdData
);
hadStartAdDialogFail
=
false
;
//
hadStartAdDialogFail = false;
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 去加载广告"
);
LogUtil
.
d
(
TAG
+
">>>加载广告<<< =============>>> END 去加载广告"
);
try
{
try
{
TopOnAdLoadManager
.
getInstance
().
loadInterstitialAd
(
normalAdData
,
AdScenes
.
AD_SCENES_PURE
);
// TopOnAdLoadManager.getInstance().loadInterstitialAd(normalAdData, AdScenes.AD_SCENES_PURE);
}
catch
(
Exception
e
){
AdManagerV2
.
get
().
loadAd
(
normalAdData
.
cpAdslot
);
}
catch
(
Exception
e
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"reason"
,
e
.
getMessage
());
map
.
put
(
"reason"
,
e
.
getMessage
());
map
.
put
(
"scenes"
,
"load ad"
);
map
.
put
(
"scenes"
,
"load ad"
);
...
...
app/src/main/java/com/zl/sdk/out/ui/DialogFactory.java
View file @
25ca2809
...
@@ -8,6 +8,7 @@ public final class DialogFactory {
...
@@ -8,6 +8,7 @@ public final class DialogFactory {
if
(
remindersInfo
==
null
)
{
if
(
remindersInfo
==
null
)
{
return
null
;
return
null
;
}
}
return
new
PureAdDialog
(
remindersInfo
,
data
);
return
null
;
// return new PureAdDialog(remindersInfo, data);
}
}
}
}
app/src/main/java/com/zl/sdk/out/ui/DxActivity.java
View file @
25ca2809
...
@@ -12,6 +12,7 @@ import android.widget.FrameLayout;
...
@@ -12,6 +12,7 @@ import android.widget.FrameLayout;
import
com.zl.sdk.Config
;
import
com.zl.sdk.Config
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.OutHelp
;
import
com.zl.sdk.ad.AdManagerV2
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.OutAdData
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.event.EventUtils
;
...
@@ -26,14 +27,15 @@ import java.util.Map;
...
@@ -26,14 +27,15 @@ import java.util.Map;
public
class
DxActivity
extends
BaseActivity
{
public
class
DxActivity
extends
BaseActivity
{
private
static
final
String
TAG
=
"OutShow Dx ---> "
;
private
static
final
String
TAG
=
"OutShow Dx ---> "
;
private
Intent
intent
=
null
;
// private Intent intent = null;
private
RemindersInfo
remindersInfo
;
// private RemindersInfo remindersInfo;
private
OutAdData
.
NormalAdData
adData
;
// private OutAdData.NormalAdData adData;
// private IView proxyView;
private
IView
proxyView
;
private
long
onceStayTime
;
private
long
onceStayTime
;
private
boolean
hadStart
=
false
;
private
Handler
mainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
private
Handler
mainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
...
@@ -43,13 +45,14 @@ public class DxActivity extends BaseActivity {
...
@@ -43,13 +45,14 @@ public class DxActivity extends BaseActivity {
@Override
@Override
public
void
onBeforeCreate
(
Bundle
bundle
)
{
public
void
onBeforeCreate
(
Bundle
bundle
)
{
OutHelp
.
get
().
setShowLock
(
true
);
// OutHelp.get().setShowLock(true);
hadStart
=
false
;
}
}
@Override
@Override
public
void
onAfterCreate
(
Bundle
bundle
)
{
public
void
onAfterCreate
(
Bundle
bundle
)
{
LogUtil
.
d
(
TAG
+
"onCreate"
);
LogUtil
.
d
(
TAG
+
"onCreate"
);
DxManager
.
get
().
addActivity
(
this
);
//
DxManager.get().addActivity(this);
}
}
...
@@ -62,35 +65,42 @@ public class DxActivity extends BaseActivity {
...
@@ -62,35 +65,42 @@ public class DxActivity extends BaseActivity {
// }
// }
}
}
@Override
@Override
public
void
onStart
()
{
public
void
onStart
()
{
super
.
onStart
();
super
.
onStart
();
if
(
hadStart
)
{
close
();
return
;
}
LogUtil
.
d
(
TAG
+
"onStart"
);
LogUtil
.
d
(
TAG
+
"onStart"
);
mainHandler
.
removeCallbacksAndMessages
(
null
);
mainHandler
.
removeCallbacksAndMessages
(
null
);
mainHandler
.
postDelayed
(
new
Runnable
()
{
mainHandler
.
postDelayed
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
execute
();
execute
();
hadStart
=
true
;
}
}
},
200
);
},
200
);
}
}
@Override
@Override
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
LogUtil
.
d
(
TAG
+
"onResume hashCode="
+
hashCode
());
LogUtil
.
d
(
TAG
+
"onResume hashCode="
+
hashCode
());
if
(
proxyView
!=
null
)
{
//
if (proxyView != null) {
proxyView
.
onResume
();
//
proxyView.onResume();
}
//
}
}
}
@Override
@Override
public
void
onPause
()
{
public
void
onPause
()
{
super
.
onPause
();
super
.
onPause
();
LogUtil
.
d
(
TAG
+
"onPause hashCode="
+
hashCode
());
LogUtil
.
d
(
TAG
+
"onPause hashCode="
+
hashCode
());
if
(
proxyView
!=
null
)
{
//
if (proxyView != null) {
proxyView
.
onPause
();
//
proxyView.onPause();
}
//
}
}
}
@Override
@Override
...
@@ -102,10 +112,10 @@ public class DxActivity extends BaseActivity {
...
@@ -102,10 +112,10 @@ public class DxActivity extends BaseActivity {
@Override
@Override
public
void
onDestroy
()
{
public
void
onDestroy
()
{
LogUtil
.
d
(
TAG
+
"onDestroy hashCode="
+
hashCode
());
LogUtil
.
d
(
TAG
+
"onDestroy hashCode="
+
hashCode
());
if
(
proxyView
!=
null
)
{
//
if (proxyView != null) {
proxyView
.
onDestroy
();
//
proxyView.onDestroy();
proxyView
=
null
;
//
proxyView = null;
}
//
}
mainHandler
.
removeCallbacksAndMessages
(
null
);
mainHandler
.
removeCallbacksAndMessages
(
null
);
...
@@ -115,7 +125,7 @@ public class DxActivity extends BaseActivity {
...
@@ -115,7 +125,7 @@ public class DxActivity extends BaseActivity {
Statistics
.
getInstance
().
onEvent
(
OutHelp
.
get
().
getContext
(),
EventUtils
.
OUT_DIALOG_EXPOSE_ONCE_STAY_TIME
,
null
,
map
);
Statistics
.
getInstance
().
onEvent
(
OutHelp
.
get
().
getContext
(),
EventUtils
.
OUT_DIALOG_EXPOSE_ONCE_STAY_TIME
,
null
,
map
);
super
.
onDestroy
();
super
.
onDestroy
();
DxManager
.
get
().
removeActivity
(
this
);
//
DxManager.get().removeActivity(this);
}
}
@Override
@Override
...
@@ -124,10 +134,10 @@ public class DxActivity extends BaseActivity {
...
@@ -124,10 +134,10 @@ public class DxActivity extends BaseActivity {
}
}
public
void
close
()
{
public
void
close
()
{
if
(
proxyView
!=
null
)
{
//
if (proxyView != null) {
proxyView
.
onDestroy
();
//
proxyView.onDestroy();
proxyView
=
null
;
//
proxyView = null;
}
//
}
activity
.
finish
();
activity
.
finish
();
}
}
...
@@ -145,44 +155,44 @@ public class DxActivity extends BaseActivity {
...
@@ -145,44 +155,44 @@ public class DxActivity extends BaseActivity {
private
void
statSLKStart
(
RemindersInfo
remindersInfo
,
boolean
isHide
)
{
private
void
statSLKStart
(
RemindersInfo
remindersInfo
,
boolean
isHide
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
type
=
""
;
String
type
=
""
;
if
(
remindersInfo
!=
null
)
{
//
if (remindersInfo != null) {
type
=
String
.
valueOf
(
remindersInfo
.
reminderType
);
//
type = String.valueOf(remindersInfo.reminderType);
}
//
}
map
.
put
(
"type"
,
type
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"hide"
,
String
.
valueOf
(
isHide
));
map
.
put
(
"hide"
,
String
.
valueOf
(
isHide
));
Statistics
.
getInstance
().
dotEvent
(
activity
,
"slk_start"
,
""
,
map
);
Statistics
.
getInstance
().
dotEvent
(
activity
,
"slk_start"
,
""
,
map
);
}
}
private
void
execute
()
{
private
void
execute
()
{
checkIntent
();
//
checkIntent();
startShowDialog
();
startShowDialog
();
}
}
private
void
checkIntent
()
{
//
private void checkIntent() {
adData
=
null
;
//
adData = null;
remindersInfo
=
null
;
//
remindersInfo = null;
//
adData
=
(
OutAdData
.
NormalAdData
)
DxManager
.
get
().
getOutAdData
();
//
adData = (OutAdData.NormalAdData) DxManager.get().getOutAdData();
LogUtil
.
d
(
TAG
+
"广告信息 ="
+
adData
);
//
LogUtil.d(TAG + "广告信息 =" + adData);
//
remindersInfo
=
DxManager
.
get
().
getOutRemindersInfo
();
//
remindersInfo = DxManager.get().getOutRemindersInfo();
LogUtil
.
d
(
TAG
+
"弹窗信息 ="
+
remindersInfo
);
//
LogUtil.d(TAG + "弹窗信息 =" + remindersInfo);
}
//
}
private
void
startShowDialog
()
{
private
void
startShowDialog
()
{
statSLKStart
(
remindersInfo
,
IconHelp
.
get
().
isIconHide
());
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
())
{
// if (remindersInfo == null) {
LogUtil
.
d
(
TAG
+
"finish 不是纯广告并且隐藏了icon"
);
// LogUtil.d(TAG + "finish remindersInfo为空");
close
();
// close();
return
;
// return;
}
// }
//
// if (remindersInfo.reminderType != Config.REMINDER_TYPE_WEATHER_PURE_AD && IconHelp.get().isIconHide()) {
// LogUtil.d(TAG + "finish 不是纯广告并且隐藏了icon");
// close();
// return;
// }
Window
window
=
activity
.
getWindow
();
Window
window
=
activity
.
getWindow
();
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_SECURE
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_SECURE
);
...
@@ -192,15 +202,21 @@ public class DxActivity extends BaseActivity {
...
@@ -192,15 +202,21 @@ public class DxActivity extends BaseActivity {
onceStayTime
=
System
.
currentTimeMillis
();
onceStayTime
=
System
.
currentTimeMillis
();
LogUtil
.
d
(
TAG
+
"加载新的Dialog"
);
if
(
AdManagerV2
.
get
().
isAdReady
())
{
proxyView
=
DialogFactory
.
createDialog
(
remindersInfo
,
adData
);
AdManagerV2
.
get
().
showAd
(
activity
);
}
else
{
if
(
proxyView
==
null
)
{
LogUtil
.
d
(
TAG
+
"finish 5 View=null"
);
close
();
close
();
return
;
}
}
proxyView
.
onCreate
(
activity
,
intent
,
rootView
);
// 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);
}
}
}
}
app/src/main/java/com/zl/sdk/out/ui/PureAdDialog.java
View file @
25ca2809
This diff is collapsed.
Click to expand it.
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