Commit 697d7183 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 146ae67c
......@@ -76,7 +76,7 @@ public class VideoAdingManager {
/**
* 初始化广告manager
*
* @param activity
* @param activity
*/
private void init(Activity activity) {
this.activity = activity;
......@@ -179,11 +179,12 @@ public class VideoAdingManager {
/**
* 根据广告优先级获取下一个
* <p>
* 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底)
* <p>
* 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
*/
private String getNextFailAdType() {
// 高额任务时 会为空
if (adList == null || currentRandomAdList == null) {
if (isHighWeight || adList == null || currentRandomAdList == null) {
return getHighWeight();
}
......@@ -228,7 +229,6 @@ public class VideoAdingManager {
this.isHighWeight = isHighWeight;
}
/**
* 高额任务广告类型
*
......@@ -323,27 +323,28 @@ public class VideoAdingManager {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
adList.add("d");
adList.add("e");
}
if (AppConfig.csjFullVedioAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight);
adList.add("e");
adList.add("f");
}
if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
adList.add("f");
adList.add("g");
}
if (AppConfig.flVideoAdCount > 0) {
weightList.add(new WeightBean(flVideoWeight, Constant.FL_VEDIO_AD));
weight = weight + flVideoWeight;
LogUtil.d(TAG, "权重值:flVideoWeight:" + flVideoWeight);
adList.add("g");
adList.add("h");
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
......@@ -382,17 +383,11 @@ public class VideoAdingManager {
int wnAdCount = AppConfig.wnVideoAdCount;
int flVideoAdCount = AppConfig.flVideoAdCount;
int tzVideoAdCount = AppConfig.shVideoAdCount;
int ksVideoAdCount = AppConfig.ksVideoAdCount;
int csjFullVedioAdCount = AppConfig.csjFullVedioAdCount;
int ksVideoAdCount = AppConfig.ksVideoAdCount;
if (ylhAdCount <= 0 &&
csjVideoAdCount <= 0 &&
wnAdCount <= 0 &&
flVideoAdCount <= 0 &&
tzVideoAdCount <= 0 &&
csjFullVedioAdCount <= 0 &&
ksVideoAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
if (ylhAdCount <= 0 && csjVideoAdCount <= 0 && wnAdCount <= 0 && flVideoAdCount <= 0
&& tzVideoAdCount <= 0 && csjFullVedioAdCount <= 0 && ksVideoAdCount <= 0 ) {
return true;
}
return false;
......@@ -485,13 +480,6 @@ public class VideoAdingManager {
* @param bean
*/
private void loadAdVideo(String videoAdType, VideoAdingBean bean) {
if (TextUtils.isEmpty(videoAdType)) {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerError(bean.getCarrierType());
}
return;
}
try {
if (TextUtils.equals(videoAdType, Constant.YLH_VEDIO_AD)) {
// 优量汇
......@@ -763,31 +751,34 @@ public class VideoAdingManager {
}
private String getCode(String adtype) {
String code = "g";
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String code = "h";
switch (adtype) {
case "a":
code = Constant.CSJ_VEDIO_AD;
case Constant.CSJ_VEDIO_AD:
code = "a";
break;
case "b":
code = Constant.YLH_VEDIO_AD;
case Constant.YLH_VEDIO_AD:
code = "b";
break;
case "c":
code = Constant.KS_VEDIO_AD;
case Constant.KS_VEDIO_AD:
code = "c";
break;
case "d":
code = Constant.SDHZ_VEDIO_AD;
case Constant.SDHZ_VEDIO_AD:
code = "e";
break;
case "e":
code = Constant.CSJ_FULL_AD;
case Constant.CSJ_FULL_AD:
code = "f";
break;
case "f":
code = Constant.SH_VEDIO_AD;
case Constant.SH_VEDIO_AD:
code = "g";
break;
}
return code;
}
private String getAdtype(String code) {
//// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String adtype = Constant.FL_VEDIO_AD;
switch (code) {
case "a":
......@@ -799,13 +790,13 @@ public class VideoAdingManager {
case "c":
adtype = Constant.KS_VEDIO_AD;
break;
case "d":
case "e":
adtype = Constant.SDHZ_VEDIO_AD;
break;
case "e":
case "f":
adtype = Constant.CSJ_FULL_AD;
break;
case "f":
case "g":
adtype = Constant.SH_VEDIO_AD;
break;
}
......
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