Commit dea0f819 authored by mengcuiguang's avatar mengcuiguang

代码优化

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