Commit 45d235f3 authored by mengcuiguang's avatar mengcuiguang

1.1.9发版

parent d343b3fa
......@@ -11,8 +11,8 @@ android {
applicationId "com.mints.highgold"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 19
versionName "1.1.8"
versionCode 20
versionName "1.1.9"
flavorDimensions "default"
// dex突破65535的限制
......
package com.mints.highgold.ad.inscreen;
import android.app.Activity;
import android.os.Build;
import android.text.TextUtils;
import android.view.View;
import com.bytedance.sdk.openadsdk.AdSlot;
......@@ -8,23 +10,33 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.lechuan.midunovel.view.FoxListener;
import com.lechuan.midunovel.view.FoxTbScreen;
import com.mints.highgold.ad.VedioAdingManager;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TaAdManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.manager.YlhAdManager;
import com.mints.highgold.mvp.model.WeightBean;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.ToastUtil;
import com.qq.e.ads.interstitial2.UnifiedInterstitialAD;
import com.qq.e.ads.interstitial2.UnifiedInterstitialADListener;
import com.qq.e.comm.util.AdError;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* 插屏广告
*/
public class InsertScreenAdManager {
private static final String TAG = VedioAdingManager.class.getSimpleName();
private Activity activity;
private ArrayList<WeightBean> weightList;
// 穿山甲
private TTAdNative mTTAdNative;
......@@ -43,6 +55,7 @@ public class InsertScreenAdManager {
public void showInsertScreenAd(String carrierType) {
if (UserManager.getInstance().getAdShowFlag()) {
if (!AppConfig.interactionAdFlag) {
weightList = new ArrayList<>();
AppConfig.interactionAdFlag = true;
initInsertScreenAd(carrierType);
}
......@@ -59,6 +72,9 @@ public class InsertScreenAdManager {
if (mTMItAd != null) {
mTMItAd.destroy();
}
if (weightList != null) {
weightList = null;
}
}
/**
......@@ -67,17 +83,33 @@ public class InsertScreenAdManager {
* @param carrierType
*/
private void initInsertScreenAd(String carrierType) {
if (AppConfig.interactionAdType == 0) {
//穿山甲
loadCsjInteractionAd(carrierType);
} else if (AppConfig.interactionAdType == 1) {
//优量汇
loadYlhInteractionAd(carrierType);
} else if (AppConfig.interactionAdType == 2) {
String adType = getRandomWeight();
if (TextUtils.isEmpty(adType)) {
//推啊
loadTaInteractionAd(carrierType);
} else {
if (TextUtils.equals(adType, Constant.CSJ_INSERTSCREEN_AD)) {
//穿山甲
loadCsjInteractionAd(carrierType);
} else if (TextUtils.equals(adType, Constant.YLH_INSERTSCREEN_AD)) {
//优量汇
loadYlhInteractionAd(carrierType);
} else {
//推啊
loadTaInteractionAd(carrierType);
}
}
// if (AppConfig.interactionAdType == 0) {
// //穿山甲
// loadCsjInteractionAd(carrierType);
// } else if (AppConfig.interactionAdType == 1) {
// //优量汇
// loadYlhInteractionAd(carrierType);
// } else if (AppConfig.interactionAdType == 2) {
// //推啊
// loadTaInteractionAd(carrierType);
// }
}
/**
......@@ -121,7 +153,7 @@ public class InsertScreenAdManager {
@Override
public void onError(int code, String message) {
//当前播放完成换下一个类型 1-优量汇
AppConfig.interactionAdType = 1;
// AppConfig.interactionAdType = 1;
setNextShowInteractionAd();
}
......@@ -152,7 +184,7 @@ public class InsertScreenAdManager {
@Override
public void onAdShow(View view, int type) {
//当前播放完成换下一个类型 1-优量汇
AppConfig.interactionAdType = 1;
// AppConfig.interactionAdType = 1;
}
......@@ -160,7 +192,7 @@ public class InsertScreenAdManager {
@Override
public void onRenderFail(View view, String msg, int code) {
//当前播放完成换下一个类型 1-优量汇
AppConfig.interactionAdType = 1;
// AppConfig.interactionAdType = 1;
setNextShowInteractionAd();
}
......@@ -214,7 +246,7 @@ public class InsertScreenAdManager {
@Override
public void onADReceive() {
//当前优量汇播放完成换下一个类型
AppConfig.interactionAdType = 2;
// AppConfig.interactionAdType = 2;
showAD();
}
......@@ -224,7 +256,7 @@ public class InsertScreenAdManager {
@Override
public void onNoAD(AdError adError) {
AppConfig.interactionAdType = 2;
// AppConfig.interactionAdType = 2;
setNextShowInteractionAd();
}
......@@ -296,19 +328,19 @@ public class InsertScreenAdManager {
mTMItAd.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
AppConfig.interactionAdType = 0;
// AppConfig.interactionAdType = 0;
}
@Override
public void onFailedToReceiveAd() {
setNextShowInteractionAd();
AppConfig.interactionAdType = 0;
// AppConfig.interactionAdType = 0;
}
@Override
public void onLoadFailed() {
setNextShowInteractionAd();
AppConfig.interactionAdType = 0;
// AppConfig.interactionAdType = 0;
}
@Override
......@@ -341,4 +373,53 @@ public class InsertScreenAdManager {
public void setNextShowInteractionAd() {
AppConfig.interactionAdFlag = false;
}
/**
* 根据权重获取广告类型
*
* @return
*/
private String getRandomWeight() {
if (weightList != null) {
weightList.clear();
}
int weight = 0;
if (AppConfig.interactionTuiaWeight > 0) {
weightList.add(new WeightBean(AppConfig.interactionTuiaWeight, Constant.TUIA_INSERTSCREEN_AD));
weight = weight + AppConfig.interactionTuiaWeight;
LogUtil.d(TAG, "权重值:interactionTuiaWeight:" + AppConfig.interactionTuiaWeight);
}
if (AppConfig.interactionCsjWeight > 0) {
weightList.add(new WeightBean(AppConfig.interactionCsjWeight, Constant.CSJ_INSERTSCREEN_AD));
weight = weight + AppConfig.interactionCsjWeight;
LogUtil.d(TAG, "权重值:interactionCsjWeight:" + AppConfig.interactionCsjWeight);
}
if (AppConfig.interactionYlhWeight > 0) {
weightList.add(new WeightBean(AppConfig.interactionYlhWeight, Constant.YLH_INSERTSCREEN_AD));
weight = weight + AppConfig.interactionYlhWeight;
LogUtil.d(TAG, "权重值:interactionYlhWeight:" + AppConfig.interactionYlhWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
Random r = new Random();
int randomWeight = r.nextInt(weight) + 1;
LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
// ToastUtil.showLong(activity,"插屏权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
if (randomWeight <= 0) {
LogUtil.d(TAG, "3、权重结果:" + weightBean.getType());
return weightBean.getType();
}
}
}
return "";
}
}
......@@ -93,4 +93,8 @@ public class AppConfig {
* MintegralInscreen true-加载成功
*/
public static boolean isMintegralInscreenFlag = false;
public static int interactionTuiaWeight = 0;
public static int interactionCsjWeight = 0;
public static int interactionYlhWeight = 0;
}
......@@ -129,6 +129,11 @@ public interface Constant {
String DUOMENT_VEDIO_AD = "DUOMENT_VEDIO_AD";
String SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD";
// 插屏广告
String CSJ_INSERTSCREEN_AD = "CSJ_INSERTSCREEN_AD";
String YLH_INSERTSCREEN_AD = "YLH_INSERTSCREEN_AD";
String TUIA_INSERTSCREEN_AD = "TUIA_INSERTSCREEN_AD";
// 载体
String CARRIER_DRINK = "DRINK";//喝水
String CARRIER_DRINK_PATCH = "DRINK_PATCH";//喝水补卡
......
......@@ -90,6 +90,11 @@ public class UserTaskMsgBean implements Serializable {
private int JPushLogin;
private int interactionplan_tuia_rate;
private int interactionplan_csj_rate;
private int interactionplan_ylh_rate;
public int getVedioplan_hytech_vedio_rate() {
return vedioplan_hytech_vedio_rate;
}
......@@ -474,4 +479,16 @@ public class UserTaskMsgBean implements Serializable {
public void setVedioplan_sdhz_vedio_surplus(int vedioplan_sdhz_vedio_surplus) {
this.vedioplan_sdhz_vedio_surplus = vedioplan_sdhz_vedio_surplus;
}
public int getInteractionTuiaWeight() {
return interactionplan_tuia_rate;
}
public int getInteractionCsjWeight() {
return interactionplan_csj_rate;
}
public int getInteractionYlhWeight() {
return interactionplan_ylh_rate;
}
}
......@@ -480,6 +480,11 @@ public class MainFragment extends BaseFragment
spUtil.putString(Constant.CSJ_VEDIO_APPIP, data.getAppIp());
spUtil.putInt(Constant.JIPUSH_FLAG, data.getJPushLogin());
AppConfig.interactionCsjWeight = data.getInteractionCsjWeight();
AppConfig.interactionYlhWeight = data.getInteractionYlhWeight();
AppConfig.interactionTuiaWeight = data.getInteractionTuiaWeight();
LogUtil.d(TAG, "插屏权重值:interactionCsjWeight:" + data.getInteractionCsjWeight() + " interactionYlhWeight:" + data.getInteractionYlhWeight() + " interactionTuiaWeight:" + data.getInteractionTuiaWeight());
//测试数据
// data.setVedioplan_csj_vedio_rate(0);
......
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