Commit 1203888e authored by wangxuewei's avatar wangxuewei

Merge remote-tracking branch 'origin/develop_1.0.6' into develop_1.0.6

parents b497afab 783a82c4
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -32,7 +32,7 @@ class BaseApplication : MultiDexApplication() { ...@@ -32,7 +32,7 @@ class BaseApplication : MultiDexApplication() {
//第一步初始化 application //第一步初始化 application
AppliContext.init(this) AppliContext.init(this)
// Config.init(this) // Config.init(this)
NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
Constant.appLs = "a03d5320d905cf3b"//applsq Constant.appLs = "a03d5320d905cf3b"//applsq
AdManager.init(this) AdManager.init(this)
......
...@@ -551,10 +551,10 @@ object AdManager { ...@@ -551,10 +551,10 @@ object AdManager {
var callback: ZXADCallback = object : ZXADCallback { var callback: ZXADCallback = object : ZXADCallback {
override fun onAdSuccess() { override fun onAdSuccess() {
Log.d(TAG, "onAdSuccess") Log.d(TAG, "onAdSuccess")
Log.d( // Log.d(
"mingzhong", // "mingzhong",
"Success adPlatform" + newsEntity.adPlatform + " platformId" + newsEntity.platformId // "Success adPlatform" + totalEntity[0].adPlatform + " platformId" + totalEntity[0].platformId
); // );
result.remove(newsEntity) result.remove(newsEntity)
AdCache.rewardList.put(slotName, result) AdCache.rewardList.put(slotName, result)
Utils.showToast(mActivity, "看完视频即可获得奖励") Utils.showToast(mActivity, "看完视频即可获得奖励")
...@@ -562,15 +562,20 @@ object AdManager { ...@@ -562,15 +562,20 @@ object AdManager {
} }
override fun onAdFail() { override fun onAdFail() {
Log.d(TAG, "onAdFail totalEntity.size" + totalEntity.size) Log.d("mingzhong", "onAdFail totalEntity.size" + totalEntity.size)
AdCache.rewardList.put(slotName, totalEntity)
if (totalEntity.size > 0) { if (totalEntity.size > 0) {
// Log.d(
// "mingzhong",
// "Fail adPlatform" + totalEntity[0].adPlatform + " platformId" + totalEntity[0].platformId
// );
var newsEntitys = totalEntity[0] var newsEntitys = totalEntity[0]
loadVideoAd(mActivity, newsEntitys, listener, this) loadVideoAd(mActivity, newsEntitys, listener, this)
Log.d(
"mingzhong",
"Fail adPlatform" + newsEntitys.adPlatform + " platformId" + newsEntitys.platformId
);
totalEntity.removeAt(0) totalEntity.removeAt(0)
// AdCache.rewardList.put(slotName,result) // AdCache.rewardList.put(slotName,result)
} }
...@@ -579,6 +584,7 @@ object AdManager { ...@@ -579,6 +584,7 @@ object AdManager {
loadVideoAd(mActivity, totalEntity[0], listener, callback) loadVideoAd(mActivity, totalEntity[0], listener, callback)
totalEntity.removeAt(0) totalEntity.removeAt(0)
AdCache.rewardList.put(slotName, totalEntity)
listener.onSuccess() listener.onSuccess()
} }
......
...@@ -468,27 +468,30 @@ object TTADUtils { ...@@ -468,27 +468,30 @@ object TTADUtils {
.setMediaExtra("media_extra") //用户透传的信息,可不传 .setMediaExtra("media_extra") //用户透传的信息,可不传
.build() .build()
var mttRewardVideoAd:TTRewardVideoAd? = null
mTTAdNative.loadRewardVideoAd(adSlot, object : RewardVideoAdListener { mTTAdNative.loadRewardVideoAd(adSlot, object : RewardVideoAdListener {
override fun onError(code: Int, message: String) { override fun onError(code: Int, message: String) {
EventUtils.onEventPullFail(entity) EventUtils.onEventPullFail(entity)
listener.onError() listener.onError()
callback.onAdFail() callback.onAdFail()
Log.e("mingzhong",""+code+" "+message +" platformId:"+entity.platformId)
} }
//视频广告加载后的视频文件资源缓存到本地的回调 //视频广告加载后的视频文件资源缓存到本地的回调
override fun onRewardVideoCached() { override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) {
listener.onRewardVideoCached() // listener.onRewardVideoCached()
Log.e("mingzhong","onRewardVideoCached")
mttRewardVideoAd = ad
} }
//视频广告素材加载到,如title,视频url等,不包括视频文件 //视频广告素材加载到,如title,视频url等,不包括视频文件
override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) { override fun onRewardVideoCached() {
Log.e("mingzhong","onRewardVideoAdLoad")
EventUtils.onEventPullSuccess(entity) EventUtils.onEventPullSuccess(entity)
callback.onAdSuccess() callback.onAdSuccess()
// var mttRewardVideoAd = ad
var mttRewardVideoAd = ad mttRewardVideoAd?.setRewardAdInteractionListener(object :
mttRewardVideoAd.setRewardAdInteractionListener(object :
RewardAdInteractionListener { RewardAdInteractionListener {
override fun onAdShow() { override fun onAdShow() {
listener.setRewardAdInteractionListener() listener.setRewardAdInteractionListener()
...@@ -531,7 +534,7 @@ object TTADUtils { ...@@ -531,7 +534,7 @@ object TTADUtils {
listener.onSkippedVideo() listener.onSkippedVideo()
} }
}) })
mttRewardVideoAd.setDownloadListener(object : TTAppDownloadListener { mttRewardVideoAd?.setDownloadListener(object : TTAppDownloadListener {
override fun onIdle() {} override fun onIdle() {}
override fun onDownloadActive( override fun onDownloadActive(
totalBytes: Long, totalBytes: Long,
...@@ -573,10 +576,9 @@ object TTADUtils { ...@@ -573,10 +576,9 @@ object TTADUtils {
) { ) {
} }
}) })
Log.e(TAG,"穿山甲激励视频耗时"+ (System.currentTimeMillis()-startTime)+"") Log.e(TAG,"穿山甲激励视频耗时"+ (System.currentTimeMillis()-startTime)+"")
listener.onRewardVideoAdLoad(entity) listener.onRewardVideoAdLoad(entity)
mttRewardVideoAd.showRewardVideoAd(activity) mttRewardVideoAd?.showRewardVideoAd(activity)
} }
}) })
} }
......
...@@ -29,6 +29,7 @@ import com.ym.library.module.NewsEntity ...@@ -29,6 +29,7 @@ import com.ym.library.module.NewsEntity
import com.ym.library.utils.EventUtils import com.ym.library.utils.EventUtils
import com.ym.library.utils.EventUtils.onEventClick import com.ym.library.utils.EventUtils.onEventClick
import com.ym.library.utils.EventUtils.onEventUM import com.ym.library.utils.EventUtils.onEventUM
import kotlin.math.log
object GDTAdUtils { object GDTAdUtils {
...@@ -310,6 +311,7 @@ object GDTAdUtils { ...@@ -310,6 +311,7 @@ object GDTAdUtils {
override fun onError(p0: AdError?) { override fun onError(p0: AdError?) {
EventUtils.onEventPullFail(entity) EventUtils.onEventPullFail(entity)
Log.e("huang",p0?.errorMsg+"" +p0?.errorCode)
listener.onVideoError() listener.onVideoError()
callback.onAdFail() 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