Commit 71861b14 authored by mengcuiguang's avatar mengcuiguang

添加oneway激励视频权限

parent 291bf543
...@@ -77,7 +77,7 @@ class OwVideoAdManager private constructor() : ...@@ -77,7 +77,7 @@ class OwVideoAdManager private constructor() :
} }
override fun onSdkError(onewaySdkError: OnewaySdkError, s: String) { override fun onSdkError(onewaySdkError: OnewaySdkError, s: String) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ONE, s, "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ONE, s, "onSdkError")
videoAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
......
...@@ -44,6 +44,7 @@ public class VideoAdingManager { ...@@ -44,6 +44,7 @@ public class VideoAdingManager {
private ShVideoAdManager shVideoAdManager; private ShVideoAdManager shVideoAdManager;
private CsjFullVideoAdManager csjFullVideoAdManager; private CsjFullVideoAdManager csjFullVideoAdManager;
private KsVideoAdManager ksVideoAdManager; private KsVideoAdManager ksVideoAdManager;
private OwVideoAdManager owVideoAdManager;
private int wnWeight; private int wnWeight;
private int ylhWeight; private int ylhWeight;
...@@ -52,6 +53,7 @@ public class VideoAdingManager { ...@@ -52,6 +53,7 @@ public class VideoAdingManager {
private int shVideoWeight; private int shVideoWeight;
private int csjFullVideoWeight; private int csjFullVideoWeight;
private int ksVideoWeight; private int ksVideoWeight;
private int owVideoWeight;
private ArrayList<WeightBean> weightList; private ArrayList<WeightBean> weightList;
...@@ -91,6 +93,7 @@ public class VideoAdingManager { ...@@ -91,6 +93,7 @@ public class VideoAdingManager {
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity); shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity); csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(); ksVideoAdManager = KsVideoAdManager.Companion.getInstance();
owVideoAdManager = OwVideoAdManager.Companion.getInstance();
weightList = new ArrayList<>(); weightList = new ArrayList<>();
} }
...@@ -143,7 +146,8 @@ public class VideoAdingManager { ...@@ -143,7 +146,8 @@ public class VideoAdingManager {
int flVideoWeight, int flVideoWeight,
int shVideoWeight, int shVideoWeight,
int csjFullVideoWeight, int csjFullVideoWeight,
int ksVideoWeight) { int ksVideoWeight,
int owVideoWeight) {
this.csjVideoWeight = csjVideoWeight; this.csjVideoWeight = csjVideoWeight;
this.ylhWeight = ylhWeight; this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight; this.wnWeight = wnWeight;
...@@ -151,6 +155,7 @@ public class VideoAdingManager { ...@@ -151,6 +155,7 @@ public class VideoAdingManager {
this.shVideoWeight = shVideoWeight; this.shVideoWeight = shVideoWeight;
this.csjFullVideoWeight = csjFullVideoWeight; this.csjFullVideoWeight = csjFullVideoWeight;
this.ksVideoWeight = ksVideoWeight; this.ksVideoWeight = ksVideoWeight;
this.owVideoWeight = owVideoWeight;
} }
/** /**
...@@ -183,7 +188,8 @@ public class VideoAdingManager { ...@@ -183,7 +188,8 @@ public class VideoAdingManager {
/** /**
* 根据广告优先级获取下一个 * 根据广告优先级获取下一个
* <p> * <p>
* 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底) *
* 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
*/ */
private String getNextFailAdType() { private String getNextFailAdType() {
// 高额任务时 会为空 // 高额任务时 会为空
...@@ -266,6 +272,7 @@ public class VideoAdingManager { ...@@ -266,6 +272,7 @@ public class VideoAdingManager {
} }
int weight = 0; int weight = 0;
// 若没有视频完成数,不加入权重计算范围内 // 若没有视频完成数,不加入权重计算范围内
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
if (AppConfig.csjVideoAdCount > 0) { if (AppConfig.csjVideoAdCount > 0) {
weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD)); weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVideoWeight; weight = weight + csjVideoWeight;
...@@ -278,37 +285,44 @@ public class VideoAdingManager { ...@@ -278,37 +285,44 @@ public class VideoAdingManager {
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight); LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
adList.add("b"); adList.add("b");
} }
if (AppConfig.csjFullVedioAdCount > 0) { if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD)); weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + csjFullVideoWeight; weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight); LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
adList.add("c"); adList.add("c");
} }
if (AppConfig.owVideoAdCount > 0) {
weightList.add(new WeightBean(owVideoWeight, Constant.OW_VEDIO_AD));
weight = weight + owVideoWeight;
LogUtil.d(TAG, "权重值:owVideoWeight:" + owVideoWeight);
adList.add("d");
}
if (AppConfig.wnVideoAdCount > 0) { if (AppConfig.wnVideoAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD)); weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight; weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + 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) { if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD)); weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight; weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight); LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
adList.add("e"); adList.add("g");
}
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
adList.add("f");
} }
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;
LogUtil.d(TAG, "权重值:flVideoWeight:" + flVideoWeight); LogUtil.d(TAG, "权重值:flVideoWeight:" + flVideoWeight);
adList.add("g"); adList.add("h");
} }
// 权重随机 // 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) { if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight); LogUtil.d(TAG, "1、权重总值:" + weight);
...@@ -388,6 +402,11 @@ public class VideoAdingManager { ...@@ -388,6 +402,11 @@ public class VideoAdingManager {
shVideoAdManager.onDestroy(); shVideoAdManager.onDestroy();
shVideoAdManager = null; shVideoAdManager = null;
} }
if (owVideoAdManager != null) {
owVideoAdManager.setVideoAdStatusListener(null);
owVideoAdManager.onDestroy();
owVideoAdManager = null;
}
if (mReceiverBroadcastReceiver != null) { if (mReceiverBroadcastReceiver != null) {
activity.stopService(new Intent(activity, AppInstallService.class)); activity.stopService(new Intent(activity, AppInstallService.class));
...@@ -702,6 +721,43 @@ public class VideoAdingManager { ...@@ -702,6 +721,43 @@ public class VideoAdingManager {
}); });
ksVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId()); ksVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}else if (TextUtils.equals(videoAdType, Constant.OW_VEDIO_AD)) {
// oneway广告激励视频
if (owVideoAdManager == null) {
if (activity == null) {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerError(Constant.OW_VEDIO_AD);
}
return;
}
owVideoAdManager = OwVideoAdManager.Companion.getInstance();
}
owVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override
public void adSuccess() {
AppConfig.owVideoAdCount--;
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerSuccess(Constant.OW_VEDIO_AD);
}
}
@Override
public void adFail() {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerFail(Constant.OW_VEDIO_AD);
}
}
@Override
public void adDownload() {
isVideoAdDownload = true;
// 注册下载任务监听
registerBroad();
}
});
owVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -712,7 +768,8 @@ public class VideoAdingManager { ...@@ -712,7 +768,8 @@ public class VideoAdingManager {
} }
private String getCode(String adtype) { private String getCode(String adtype) {
String code = "g"; // 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String code = "h";
switch (adtype) { switch (adtype) {
case Constant.CSJ_VEDIO_AD: case Constant.CSJ_VEDIO_AD:
code = "a"; code = "a";
...@@ -720,23 +777,28 @@ public class VideoAdingManager { ...@@ -720,23 +777,28 @@ public class VideoAdingManager {
case Constant.YLH_VEDIO_AD: case Constant.YLH_VEDIO_AD:
code = "b"; code = "b";
break; break;
case Constant.CSJ_FULL_AD: case Constant.KS_VEDIO_AD:
code = "c"; code = "c";
break; break;
case Constant.SDHZ_VEDIO_AD: case Constant.OW_VEDIO_AD:
code = "d"; code = "d";
break; break;
case Constant.SH_VEDIO_AD: case Constant.SDHZ_VEDIO_AD:
code = "e"; code = "e";
break; break;
case Constant.KS_VEDIO_AD: case Constant.CSJ_FULL_AD:
code = "f"; code = "f";
break; break;
case Constant.SH_VEDIO_AD:
code = "g";
break;
} }
return code; return code;
} }
private String getAdtype(String code) { private String getAdtype(String code) {
//// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String adtype = Constant.FL_VEDIO_AD; String adtype = Constant.FL_VEDIO_AD;
switch (code) { switch (code) {
case "a": case "a":
...@@ -746,16 +808,19 @@ public class VideoAdingManager { ...@@ -746,16 +808,19 @@ public class VideoAdingManager {
adtype = Constant.YLH_VEDIO_AD; adtype = Constant.YLH_VEDIO_AD;
break; break;
case "c": case "c":
adtype = Constant.CSJ_FULL_AD; adtype = Constant.KS_VEDIO_AD;
break; break;
case "d": case "d":
adtype = Constant.SDHZ_VEDIO_AD; adtype = Constant.OW_VEDIO_AD;
break; break;
case "e": case "e":
adtype = Constant.SH_VEDIO_AD; adtype = Constant.SH_VEDIO_AD;
break; break;
case "f": case "f":
adtype = Constant.KS_VEDIO_AD; adtype = Constant.CSJ_FULL_AD;
break;
case "g":
adtype = Constant.SDHZ_VEDIO_AD;
break; break;
} }
return adtype; return adtype;
......
...@@ -47,29 +47,6 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -47,29 +47,6 @@ public class YlhVideoAdManager extends BaseVideoAd {
isClickScreen = true; isClickScreen = true;
String ylhPostId; String ylhPostId;
// switch (carrierType) {
// case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MAIN_POSTID;
// break;
// case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
// case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
// case Constant.CARRIER_WALK_BUBBLE:// 汽泡
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MOREDIALOG_POSTID;
// break;
// case Constant.CARRIER_HOMEWATER:// 喝水
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_DRINK_POSTID;
// break;
// case Constant.CARRIER_CHALLENGE_TURN:// 大转盘
// case Constant.CARRIER_DRAWCASH:// 提现
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_TURNABLE_POSTID;
// break;
// case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_ERASE_POSTID;
// break;
// default:// 在线收益翻倍
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MOREDIALOG_POSTID;
// break;
// }
switch (carrierType) { switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频 case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MAIN(); ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MAIN();
......
...@@ -92,6 +92,10 @@ public class AppConfig { ...@@ -92,6 +92,10 @@ public class AppConfig {
* ksVideo 剩余广告播放数 * ksVideo 剩余广告播放数
*/ */
public static int ksVideoAdCount = 0; public static int ksVideoAdCount = 0;
/**
* owVideo 剩余广告播放数
*/
public static int owVideoAdCount = 0;
/** /**
* 高额试玩任务标识 * 高额试玩任务标识
......
...@@ -172,6 +172,7 @@ object Constant { ...@@ -172,6 +172,7 @@ object Constant {
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD" const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD" const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD" const val KS_VEDIO_AD = "KS_VEDIO_AD"
const val OW_VEDIO_AD = "OW_VEDIO_AD"
// 信息流广告类型 // 信息流广告类型
const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD" const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD"
......
...@@ -26,14 +26,16 @@ object UserWeight { ...@@ -26,14 +26,16 @@ object UserWeight {
data.vedioRules.fL_VEDIO.rate, data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate, data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate, data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate) data.vedioRules.kS_VEDIO.rate,
data.vedioRules.oW_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " + LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " + "ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " + "sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " + "csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " + "shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " + "flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate} ") "ksWeight:${data.vedioRules.kS_VEDIO.rate} "+
"owWeight:${data.vedioRules.oW_VEDIO.rate} ")
// 广告视频数 // 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
...@@ -42,12 +44,14 @@ object UserWeight { ...@@ -42,12 +44,14 @@ object UserWeight {
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " + LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " + "ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " + "sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " + "csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " + "shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " + "flCount:${AppConfig.flVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount} ") "ksCount:${AppConfig.ksVideoAdCount} "+
"owCount:${AppConfig.owVideoAdCount} ")
} }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ public class VedioRulesBean implements Serializable { ...@@ -10,6 +10,7 @@ public class VedioRulesBean implements Serializable {
private FLVedioBean FL_VEDIO; private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO; private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO; private CORALVedioBean CORAL_VEDIO;
private OWVedioBean OW_VEDIO;
public KsVedioBean getKS_VEDIO() { public KsVedioBean getKS_VEDIO() {
return KS_VEDIO; return KS_VEDIO;
...@@ -88,6 +89,19 @@ public class VedioRulesBean implements Serializable { ...@@ -88,6 +89,19 @@ public class VedioRulesBean implements Serializable {
} }
} }
public class OWVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class CsjfullVedioBean implements Serializable { public class CsjfullVedioBean implements Serializable {
private int surplus; private int surplus;
private int rate; private int rate;
...@@ -140,6 +154,10 @@ public class VedioRulesBean implements Serializable { ...@@ -140,6 +154,10 @@ public class VedioRulesBean implements Serializable {
return CSJFULL_VEDIO; return CSJFULL_VEDIO;
} }
public OWVedioBean getOW_VEDIO() {
return OW_VEDIO;
}
public boolean isFlVideoFlag() { public boolean isFlVideoFlag() {
return flVideoFlag; return flVideoFlag;
} }
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle. # Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the # For customization when using a Version Control System, please read the
# header note. # header note.
#Wed May 12 10:08:26 CST 2021 #Tue May 18 10:39:00 CST 2021
sdk.dir=/Users/Hello/Library/Android/sdk sdk.dir=/Users/mcg/Library/Android/sdk
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