Commit dea0f819 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 03432d7e
...@@ -63,7 +63,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -63,7 +63,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
mRewardVideoAd!!.setRewardAdInteractionListener(object : KsRewardVideoAd.RewardAdInteractionListener { mRewardVideoAd!!.setRewardAdInteractionListener(object : KsRewardVideoAd.RewardAdInteractionListener {
override fun onAdClicked() { override fun onAdClicked() {
ToastUtil.show(activity, "快手激励视频⼴告点击") // ToastUtil.show(activity, "快手激励视频⼴告点击")
if (AppConfig.needReportClickAdEvent) { if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent() TrackManager.getInstance().reportClickAdEvent()
...@@ -82,7 +82,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -82,7 +82,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
} }
override fun onPageDismiss() { override fun onPageDismiss() {
ToastUtil.show(activity, "快手激励视频⼴告关闭") // ToastUtil.show(activity, "快手激励视频⼴告关闭")
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_KS, extraId, curCoin)) TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_KS, extraId, curCoin))
...@@ -94,7 +94,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -94,7 +94,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
} }
override fun onVideoPlayError(p0: Int, p1: Int) { override fun onVideoPlayError(p0: Int, p1: Int) {
ToastUtil.show(activity, "快手激励视频⼴告播放出错") // ToastUtil.show(activity, "快手激励视频⼴告播放出错")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, (p0).toString(), "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
...@@ -104,15 +104,15 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -104,15 +104,15 @@ class KsVideoAdManager private constructor(activity: Activity) :
} }
override fun onVideoPlayEnd() { override fun onVideoPlayEnd() {
ToastUtil.show(activity, "快手激励视频⼴告播放完成") // ToastUtil.show(activity, "快手激励视频⼴告播放完成")
} }
override fun onVideoPlayStart() { override fun onVideoPlayStart() {
ToastUtil.show(activity, "快手激励视频⼴告播放开始") // ToastUtil.show(activity, "快手激励视频⼴告播放开始")
} }
override fun onRewardVerify() { override fun onRewardVerify() {
ToastUtil.show(activity, "快手激励视频⼴告获取激励") // ToastUtil.show(activity, "快手激励视频⼴告获取激励")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ZERO, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ZERO, "", "")
} }
......
...@@ -31,6 +31,9 @@ public class VideoAdingManager { ...@@ -31,6 +31,9 @@ public class VideoAdingManager {
private static VideoAdingManager _inst; private static VideoAdingManager _inst;
// APP下载回调广播
private BroadcastReceiver mReceiverBroadcastReceiver = null;
private VideoAdingListener videoAdingListener; private VideoAdingListener videoAdingListener;
private WnVideoAdManager wnVideoAdManager; private WnVideoAdManager wnVideoAdManager;
...@@ -87,9 +90,6 @@ public class VideoAdingManager { ...@@ -87,9 +90,6 @@ public class VideoAdingManager {
weightList = new ArrayList<>(); weightList = new ArrayList<>();
} }
// APP下载回调广播
private BroadcastReceiver mReceiverBroadcastReceiver = null;
private void registerBroad() { private void registerBroad() {
if (AppConfig.isSuperTask) { if (AppConfig.isSuperTask) {
return; return;
...@@ -208,6 +208,8 @@ public class VideoAdingManager { ...@@ -208,6 +208,8 @@ public class VideoAdingManager {
nextAdType = Constant.YLH_VEDIO_AD; nextAdType = Constant.YLH_VEDIO_AD;
} else if (AppConfig.csjFullVideoAdCount > 0) { } else if (AppConfig.csjFullVideoAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD; nextAdType = Constant.CSJ_FULL_AD;
} else if (AppConfig.ksVideoAdCount > 0) {
nextAdType = Constant.KS_VEDIO_AD;
} else if (AppConfig.shVideoAdCount > 0) { } else if (AppConfig.shVideoAdCount > 0) {
nextAdType = Constant.SH_VEDIO_AD; nextAdType = Constant.SH_VEDIO_AD;
} else { } else {
...@@ -277,6 +279,11 @@ public class VideoAdingManager { ...@@ -277,6 +279,11 @@ public class VideoAdingManager {
weight = weight + csjFullVideoWeight; weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVedioWeight:" + csjFullVideoWeight); LogUtil.d(TAG, "权重值:csjFullVedioWeight:" + csjFullVideoWeight);
} }
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
}
if (AppConfig.flVideoAdCount > 0) { if (AppConfig.flVideoAdCount > 0) {
weightList.add(new WeightBean(flVideoWeight, Constant.FL_VEDIO_AD)); weightList.add(new WeightBean(flVideoWeight, Constant.FL_VEDIO_AD));
weight = weight + flVideoWeight; weight = weight + flVideoWeight;
...@@ -292,11 +299,7 @@ public class VideoAdingManager { ...@@ -292,11 +299,7 @@ public class VideoAdingManager {
weight = weight + shVideoWeight; weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight); LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
} }
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
}
// 权重随机 // 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) { if (weightList != null && weightList.size() > 0 && weight > 0) {
...@@ -338,8 +341,11 @@ public class VideoAdingManager { ...@@ -338,8 +341,11 @@ public class VideoAdingManager {
int wnAdCount = AppConfig.wnVideoAdCount; int wnAdCount = AppConfig.wnVideoAdCount;
int flVideoAdCount = AppConfig.flVideoAdCount; int flVideoAdCount = AppConfig.flVideoAdCount;
int tzVideoAdCount = AppConfig.shVideoAdCount; int tzVideoAdCount = AppConfig.shVideoAdCount;
int ksVideoAdCount = AppConfig.ksVideoAdCount;
if (ylhAdCount <= 0 && csjVideoAdCount <= 0 && wnAdCount <= 0 && flVideoAdCount <= 0 && tzVideoAdCount <= 0) { if (ylhAdCount <= 0 && csjVideoAdCount <= 0 &&
wnAdCount <= 0 && flVideoAdCount <= 0 &&
tzVideoAdCount <= 0 && ksVideoAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧"); // showToast("今日视频已看完,请明天再来吧");
return true; return true;
} }
...@@ -654,16 +660,16 @@ public class VideoAdingManager { ...@@ -654,16 +660,16 @@ public class VideoAdingManager {
ksVideoAdManager.setKsVideoAdListener(new KsVideoAdManager.KsVideoAdListener() { ksVideoAdManager.setKsVideoAdListener(new KsVideoAdManager.KsVideoAdListener() {
@Override @Override
public void ksVideoAdSuccess() { public void ksVideoAdSuccess() {
AppConfig.shVideoAdCount--; AppConfig.ksVideoAdCount--;
if (videoAdingListener != null) { if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerSuccess(Constant.SH_VEDIO_AD); videoAdingListener.videoAdingListenerSuccess(Constant.KS_VEDIO_AD);
} }
} }
@Override @Override
public void ksVideoAdFail() { public void ksVideoAdFail() {
if (videoAdingListener != null) { if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerFail(Constant.SH_VEDIO_AD); videoAdingListener.videoAdingListenerFail(Constant.KS_VEDIO_AD);
} }
} }
......
...@@ -3,6 +3,7 @@ package com.mints.goodmoney.manager ...@@ -3,6 +3,7 @@ package com.mints.goodmoney.manager
import android.app.Application import android.app.Application
import com.kwad.sdk.api.KsAdSDK import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.SdkConfig import com.kwad.sdk.api.SdkConfig
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R import com.mints.goodmoney.R
/** /**
...@@ -31,7 +32,7 @@ object KsManager { ...@@ -31,7 +32,7 @@ object KsManager {
.appId(KS_APP_ID) // 测试aapId,请联系快⼿平台申请正式AppId,必填 .appId(KS_APP_ID) // 测试aapId,请联系快⼿平台申请正式AppId,必填
.appName(application.getString(R.string.app_name)) // 测试appName,请填写您应⽤的名称,⾮必填 .appName(application.getString(R.string.app_name)) // 测试appName,请填写您应⽤的名称,⾮必填
.showNotification(true) // 是否展示下载通知栏 .showNotification(true) // 是否展示下载通知栏
.debug(true) // 是否开启sdk 调试⽇志 可选 .debug(BuildConfig.DEBUG) // 是否开启sdk 调试⽇志 可选
.build()) .build())
} }
......
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