Commit 71861b14 authored by mengcuiguang's avatar mengcuiguang

添加oneway激励视频权限

parent 291bf543
......@@ -77,7 +77,7 @@ class OwVideoAdManager private constructor() :
}
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()
}
......
......@@ -44,6 +44,7 @@ public class VideoAdingManager {
private ShVideoAdManager shVideoAdManager;
private CsjFullVideoAdManager csjFullVideoAdManager;
private KsVideoAdManager ksVideoAdManager;
private OwVideoAdManager owVideoAdManager;
private int wnWeight;
private int ylhWeight;
......@@ -52,6 +53,7 @@ public class VideoAdingManager {
private int shVideoWeight;
private int csjFullVideoWeight;
private int ksVideoWeight;
private int owVideoWeight;
private ArrayList<WeightBean> weightList;
......@@ -91,6 +93,7 @@ public class VideoAdingManager {
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
ksVideoAdManager = KsVideoAdManager.Companion.getInstance();
owVideoAdManager = OwVideoAdManager.Companion.getInstance();
weightList = new ArrayList<>();
}
......@@ -143,7 +146,8 @@ public class VideoAdingManager {
int flVideoWeight,
int shVideoWeight,
int csjFullVideoWeight,
int ksVideoWeight) {
int ksVideoWeight,
int owVideoWeight) {
this.csjVideoWeight = csjVideoWeight;
this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight;
......@@ -151,6 +155,7 @@ public class VideoAdingManager {
this.shVideoWeight = shVideoWeight;
this.csjFullVideoWeight = csjFullVideoWeight;
this.ksVideoWeight = ksVideoWeight;
this.owVideoWeight = owVideoWeight;
}
/**
......@@ -183,7 +188,8 @@ public class VideoAdingManager {
/**
* 根据广告优先级获取下一个
* <p>
* 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底)
*
* 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
*/
private String getNextFailAdType() {
// 高额任务时 会为空
......@@ -266,6 +272,7 @@ public class VideoAdingManager {
}
int weight = 0;
// 若没有视频完成数,不加入权重计算范围内
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
if (AppConfig.csjVideoAdCount > 0) {
weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVideoWeight;
......@@ -278,37 +285,44 @@ 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.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) {
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");
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
......@@ -388,6 +402,11 @@ public class VideoAdingManager {
shVideoAdManager.onDestroy();
shVideoAdManager = null;
}
if (owVideoAdManager != null) {
owVideoAdManager.setVideoAdStatusListener(null);
owVideoAdManager.onDestroy();
owVideoAdManager = null;
}
if (mReceiverBroadcastReceiver != null) {
activity.stopService(new Intent(activity, AppInstallService.class));
......@@ -702,6 +721,43 @@ public class VideoAdingManager {
});
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) {
e.printStackTrace();
......@@ -712,7 +768,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";
......@@ -720,23 +777,28 @@ 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:
case Constant.OW_VEDIO_AD:
code = "d";
break;
case Constant.SH_VEDIO_AD:
case Constant.SDHZ_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":
......@@ -746,16 +808,19 @@ public class VideoAdingManager {
adtype = Constant.YLH_VEDIO_AD;
break;
case "c":
adtype = Constant.CSJ_FULL_AD;
adtype = Constant.KS_VEDIO_AD;
break;
case "d":
adtype = Constant.SDHZ_VEDIO_AD;
adtype = Constant.OW_VEDIO_AD;
break;
case "e":
adtype = Constant.SH_VEDIO_AD;
break;
case "f":
adtype = Constant.KS_VEDIO_AD;
adtype = Constant.CSJ_FULL_AD;
break;
case "g":
adtype = Constant.SDHZ_VEDIO_AD;
break;
}
return adtype;
......
......@@ -47,29 +47,6 @@ public class YlhVideoAdManager extends BaseVideoAd {
isClickScreen = true;
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) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MAIN();
......
......@@ -92,6 +92,10 @@ public class AppConfig {
* ksVideo 剩余广告播放数
*/
public static int ksVideoAdCount = 0;
/**
* owVideo 剩余广告播放数
*/
public static int owVideoAdCount = 0;
/**
* 高额试玩任务标识
......
......@@ -172,6 +172,7 @@ object Constant {
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_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"
......
......@@ -26,14 +26,16 @@ object UserWeight {
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.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} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.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.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
......@@ -42,12 +44,14 @@ object UserWeight {
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"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 {
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private OWVedioBean OW_VEDIO;
public KsVedioBean getKS_VEDIO() {
return KS_VEDIO;
......@@ -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 {
private int surplus;
private int rate;
......@@ -140,6 +154,10 @@ public class VedioRulesBean implements Serializable {
return CSJFULL_VEDIO;
}
public OWVedioBean getOW_VEDIO() {
return OW_VEDIO;
}
public boolean isFlVideoFlag() {
return flVideoFlag;
}
......
......@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Wed May 12 10:08:26 CST 2021
sdk.dir=/Users/Hello/Library/Android/sdk
#Tue May 18 10:39:00 CST 2021
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