Commit fbfb6e54 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent b4be1133
......@@ -183,7 +183,7 @@ public class VideoAdingManager {
*/
private String getNextFailAdType() {
// 高额任务时 会为空
if (adList == null || currentRandomAdList == null) {
if (isHighWeight || adList == null || currentRandomAdList == null) {
return getHighWeight();
}
......@@ -298,7 +298,7 @@ public class VideoAdingManager {
weightList.clear();
}
int weight = 0;
// 若没有视频完成数,不加入权重计算范围内
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
if (AppConfig.csjVideoAdCount > 0) {
weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVideoWeight;
......@@ -311,35 +311,35 @@ public class VideoAdingManager {
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
adList.add("b");
}
if (AppConfig.csjFullVedioAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight);
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
adList.add("c");
}
if (AppConfig.wnVideoAdCount > 0) {
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("f");
}
if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
adList.add("e");
}
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
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");
}
// 权重随机
......@@ -745,7 +745,8 @@ public class VideoAdingManager {
}
private String getCode(String adtype) {
String code = "g";
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String code = "h";
switch (adtype) {
case Constant.CSJ_VEDIO_AD:
code = "a";
......@@ -753,23 +754,25 @@ public class VideoAdingManager {
case Constant.YLH_VEDIO_AD:
code = "b";
break;
case Constant.CSJ_FULL_AD:
case Constant.KS_VEDIO_AD:
code = "c";
break;
case Constant.SDHZ_VEDIO_AD:
code = "d";
break;
case Constant.SH_VEDIO_AD:
code = "e";
break;
case Constant.KS_VEDIO_AD:
case Constant.CSJ_FULL_AD:
code = "f";
break;
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":
......@@ -779,16 +782,16 @@ public class VideoAdingManager {
adtype = Constant.YLH_VEDIO_AD;
break;
case "c":
adtype = Constant.CSJ_FULL_AD;
break;
case "d":
adtype = Constant.SDHZ_VEDIO_AD;
adtype = Constant.KS_VEDIO_AD;
break;
case "e":
adtype = Constant.SH_VEDIO_AD;
adtype = Constant.SDHZ_VEDIO_AD;
break;
case "f":
adtype = Constant.KS_VEDIO_AD;
adtype = Constant.CSJ_FULL_AD;
break;
case "g":
adtype = Constant.SH_VEDIO_AD;
break;
}
return adtype;
......
......@@ -466,6 +466,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
readyGoThenKill(DrawcashActivity::class.java)
}
4 -> {
showToast("视频加载异常,请稍后重试~")
}
}
}
R.id.tvAwardNext -> {
......
......@@ -1113,6 +1113,7 @@ class MyFragment : BaseFragment(),
if (activity != null && !activity!!.isFinishing) {
// 高额任务
if (TextUtils.equals(carrierType, Constant.CARRIER_HIGH_ACTIVITY)) {
onDestroyBroadcastReceiver()
return
}
......
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