Commit dd0e18e0 authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :多多菜园
[实现方案] :1.0.3_预加载广告
parent 868b20b8
......@@ -47,12 +47,12 @@ class BaseApplication : MultiDexApplication() {
// .Build()
// );
//TODO Android 9及以上必须设置 (聚合快手时必须添加)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// val processName = Application.getProcessName()
// if (packageName != processName) {
// WebView.setDataDirectorySuffix(processName)
// }
// }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val processName = Application.getProcessName()
if (packageName != processName) {
WebView.setDataDirectorySuffix(processName)
}
}
UMConfigure.setLogEnabled(true)
UMConfigure.init(this, "5f9bb48945b2b751a91fb2d5", "", UMConfigure.DEVICE_TYPE_PHONE, "")
......
......@@ -92,7 +92,7 @@ dependencies {
api 'com.tencent.bugly:crashreport:latest.release'
api 'com.tencent.bugly:nativecrashreport:latest.release'
api('cn.vlion.inland:inlandmix:9.8.5') {
api('cn.vlion.inland:inlandmix:9.8.8') {
exclude group: 'cn.vlion.inland', module: 'inlandb'
exclude group: 'cn.vlion.inland', module: 'inlandg'
exclude group: 'cn.vlion.inland', module: 'inlands'
......@@ -106,7 +106,7 @@ dependencies {
exclude group: 'com.github.bumptech.glide'
exclude group: 'com.tuia'
exclude group: 'cn.vlion.inland', module: 'inlandhy'
exclude group: 'com.mintegral.msdk'
// exclude group: 'com.mintegral.msdk'
exclude group: 'cn.vlion.inlandsh'
}
......
......@@ -555,6 +555,7 @@ object AdManager {
}
override fun onAdFail() {
1
Log.d(TAG, "onAdFail totalEntity.size" + totalEntity.size)
AdCache.rewardList.put(slotName, totalEntity)
if (totalEntity.size > 0) {
......@@ -566,6 +567,8 @@ object AdManager {
} else {//未超时 走缓存
playCacheRewardAd(mActivity, newsEntitys, listener, this)
}
} else {
Utils.showToast(mActivity, "视频加载失败...")
}
}
}
......
......@@ -405,6 +405,7 @@ object GDTAdUtils {
//=============================================预加载===========================================
private var zxVideoListener: ZXADVideoListener? = null
private var ZXADPlayListener: ZXADCallback? = null
fun loadCacheRewardAd(
activity: Activity,
entity: CacheAdEntity.CodeConfig
......@@ -459,11 +460,14 @@ object GDTAdUtils {
override fun onError(p0: AdError?) {
Log.d(TAG, "广点通 激励视频 onError" + p0?.errorMsg)
zxVideoListener?.onError()
ZXADPlayListener?.onAdFail()
}
override fun onADShow() {
Log.d(TAG, "广点通 激励视频 onADShow")
ZXADPlayListener?.onAdSuccess()
zxVideoListener?.onAdShow()
}
}) // 有声播放
cacheRewardVideoAD.loadAD()
......@@ -480,10 +484,11 @@ object GDTAdUtils {
callback: ZXADCallback
) {
zxVideoListener = listener
ZXADPlayListener = callback
var rewardVideoAD = getRewardVideo(activity, newsEntity.codeId)
if (rewardVideoAD != null) {
if (!rewardVideoAD.hasShown()) {
callback.onAdSuccess()
// callback.onAdSuccess()
rewardVideoAD.showAD()
} else {
// playCacheRewardAd(activity, newsEntity, listener, callback)
......
......@@ -287,6 +287,7 @@ object RSADUtils {
// private val mRsAdCache: ConcurrentLinkedQueue<VideoManager> =
// ConcurrentLinkedQueue<VideoManager>()
private var zxVideoListener: ZXADVideoListener? = null
private var zxPlayListener: ZXADCallback? = null
//预加载激励视频
fun loadCacheRewardAd(
......@@ -321,12 +322,14 @@ object RSADUtils {
override fun onVideoPlayStart(adId: String) {
Log.e(TAG, "2瑞狮 onVideoPlayStart:adId=$adId")
zxVideoListener?.onAdShow()
zxPlayListener?.onAdSuccess()
}
override fun onVideoPlayFailed(adId: String, code: Int, msg: String) {
Log.e(TAG, "瑞狮 onVideoPlayFailed:adId=" + adId + "code=" + code + "msg=" + msg)
AdManager.initCacheAdList(activity)
zxVideoListener?.onError()
zxPlayListener?.onAdFail()
}
override fun onVideoClosed(adId: String) {
......@@ -353,7 +356,7 @@ object RSADUtils {
//广告请求失败
override fun onRequestFailed(adId: String, code: Int, errorMsg: String) {
AdManager.initCacheAdList(activity)
zxPlayListener?.onAdFail()
Log.e(
TAG,
"onRequestFailed:adId=" + adId + "code=" + code + "errorMsg=" + errorMsg
......@@ -367,9 +370,10 @@ object RSADUtils {
newsEntity: NewsEntity,
listener: ZXADVideoListener, callback: ZXADCallback
) {
zxVideoListener = listener
zxVideoListener = listener
if (VideoManager.getInstance().isReady) {
callback.onAdSuccess()
// callback.onAdSuccess()
VideoManager.getInstance().showVideo();
} else {
callback.onAdFail()
......
......@@ -281,6 +281,7 @@ object SMADUtils {
private val mSgmAdCache: ConcurrentLinkedQueue<Map<WindRewardAdRequest, WindRewardedVideoAd>> =
ConcurrentLinkedQueue()
private var zxVideoListener: ZXADVideoListener? = null
private var zxPlayListener: ZXADCallback? = null
//只能在播放完之后缓存
fun loadCacheRewardAd(
......@@ -299,6 +300,7 @@ object SMADUtils {
Log.d(TAG, "Sigmob 激励 onVideoAdPlayError" + p0?.message)
AdManager.initCacheAdList(activity)
zxVideoListener?.onError()
zxPlayListener?.onAdFail()
}
override fun onVideoAdPreLoadFail(p0: String?) {
......@@ -324,6 +326,7 @@ object SMADUtils {
override fun onVideoAdLoadSuccess(p0: String?) {
Log.d(TAG, "Sigmob 激励 onVideoAdLoadSuccess")
zxVideoListener?.onSuccess()
zxPlayListener?.onAdSuccess()
}
override fun onVideoAdPreLoadSuccess(p0: String?) {
......@@ -338,6 +341,7 @@ object SMADUtils {
override fun onVideoAdLoadError(p0: WindAdError?, p1: String?) {
Log.d(TAG, "Sigmob 激励 onVideoAdLoadError" + p1)
AdManager.initCacheAdList(activity)
zxPlayListener?.onAdFail()
}
})
......@@ -352,6 +356,7 @@ object SMADUtils {
callback: ZXADCallback
) {
zxVideoListener = listener
zxPlayListener = callback
if (mSgmAdCache.size > 0) {
var rewardVideoADMap = mSgmAdCache.poll()
rewardVideoADMap.forEach {
......@@ -359,7 +364,7 @@ object SMADUtils {
it.value
if (it.value.isReady(it.key.placementId)) {
//广告播放
callback.onAdSuccess()
// callback.onAdSuccess()
it.value.show(activity, it.key)
} else {
callback.onAdFail()
......
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