Commit d343b3fa authored by mengcuiguang's avatar mengcuiguang

添加闪电盒子

parent fdd28516
......@@ -11,8 +11,8 @@ android {
applicationId "com.mints.highgold"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 18
versionName "1.1.7"
versionCode 19
versionName "1.1.8"
flavorDimensions "default"
// dex突破65535的限制
......@@ -108,12 +108,8 @@ android {
}
productFlavors {
xiaomi {}
yingyongbao {}
oppo {}
highgold {}
highgoldpkg {}
vivo {}
}
productFlavors.all {
......@@ -300,6 +296,8 @@ dependencies {
// 酷问新闻
// implementation 'com.tencent.tbs.tbssdk:sdk:43903'
// implementation 'com.liulishuo.filedownloader:library:1.7.4'
// 闪电盒子
implementation(name: 'wannuosili_ad_1.0.3', ext: 'aar')
......
......@@ -455,5 +455,8 @@
# ===================== 闪电盒子 START ================
-keep class com.wannuosili.sdk.** {*;}
-dontwarn com.wannuosili.sdk.**
# ======================= 闪电盒子 END ================
......@@ -301,6 +301,16 @@
android:resource="@xml/provider_paths" />
</provider>
<provider
android:name="com.wannuosili.sdk.ad.component.WNFileProvider"
android:authorities="${applicationId}.WNFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/wn_file_paths" />
</provider>
<!-- 极光一键登录 -->
<!-- since 2.0.0 optional 可选项,使用一键登录功能必须添加 -->
......
......@@ -10,7 +10,6 @@ import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebView;
import com.bun.miitmdid.core.JLibrary;
......@@ -23,12 +22,12 @@ import com.mintegral.msdk.MIntegralSDK;
import com.mintegral.msdk.out.MIntegralSDKFactory;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.AdMngrHolder;
import com.mints.highgold.manager.LiebaoManager;
import com.mints.highgold.manager.MiitHelper;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.net.LoanService;
import com.mints.highgold.ui.widgets.BannerView;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.ForegroundOrBackground;
import com.mints.highgold.utils.LogUtil;
......@@ -88,7 +87,7 @@ public class MintsApplication extends MultiDexApplication {
private static boolean isSupportOaid = true;
private static int errorCode;
public volatile static boolean shanhuFlag = false;
public volatile static boolean shanhuFlag = false;// 极光登录验证通过标志
public static String getOaid() {
return oaid;
......@@ -242,8 +241,11 @@ public class MintsApplication extends MultiDexApplication {
// 极光一键登录
initJLogin();
//闪电盒子
initWNAd();
}
/**
* 移动安装联盟 获取OAID等设备标识符
*/
......@@ -487,6 +489,13 @@ public class MintsApplication extends MultiDexApplication {
});
}
/**
* 闪电盒子
*/
private void initWNAd() {
AdMngrHolder.init(this);
}
/**
* 酷问新闻
*/
......
......@@ -24,8 +24,6 @@ public class VedioAdingManager {
private static final String TAG = VedioAdingManager.class.getSimpleName();
public static final int SECOND = 60;
private static VedioAdingManager _inst;
private VedioAdingListener vedioAdingListener;
......@@ -38,6 +36,7 @@ public class VedioAdingManager {
private ShanhuVedioAdManager shanhuVedioAdManager;
private ChuangshenVedioAdManager chuangshenVedioAdManager;
private DomobVedioAdManager domobVedioAdManager;
private WnVedioAdManager wnVedioAdManager;
private int ylhWeight;
private int csjFullWeight;
......@@ -47,6 +46,7 @@ public class VedioAdingManager {
private int shanhuWeight;
private int chuangshenWeight;
private int domobWeight;
private int wnWeight;
private ArrayList<WeightBean> weightList;
private Activity activity;
......@@ -81,6 +81,7 @@ public class VedioAdingManager {
shanhuVedioAdManager = ShanhuVedioAdManager.getInstance(activity);
chuangshenVedioAdManager = ChuangshenVedioAdManager.Companion.getInstance(activity);
domobVedioAdManager = DomobVedioAdManager.Companion.getInstance(activity);
wnVedioAdManager = WnVedioAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>();
}
......@@ -88,7 +89,8 @@ public class VedioAdingManager {
* 初始化广告权重
*/
public void initAdWeight(int csjVedioWeight, int ylhWeight, int csjFullWeight, int hytechVedioWeight,
int mintegralWeight, int shanhuWeight, int chuangshenWeight, int domobWeight) {
int mintegralWeight, int shanhuWeight, int chuangshenWeight, int domobWeight,
int wnWeight) {
this.csjVedioWeight = csjVedioWeight;
this.ylhWeight = ylhWeight;
this.csjFullWeight = csjFullWeight;
......@@ -97,6 +99,7 @@ public class VedioAdingManager {
this.shanhuWeight = shanhuWeight;
this.chuangshenWeight = chuangshenWeight;
this.domobWeight = domobWeight;
this.wnWeight = wnWeight;
}
/**
......@@ -142,6 +145,8 @@ public class VedioAdingManager {
nextAdType = Constant.HYTECH_VEDIO_AD;
} else if (AppConfig.csjFullAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD;
} else if (AppConfig.sdhzVedioAdCount > 0) {
nextAdType = Constant.SDHZ_VEDIO_AD;
}
return nextAdType;
}
......@@ -180,6 +185,11 @@ public class VedioAdingManager {
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
}
if (AppConfig.sdhzVedioAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:wnWeight:" + wnWeight);
}
if (AppConfig.shanhuAdCount > 0) {
weightList.add(new WeightBean(shanhuWeight, Constant.SHANHU_VEDIO_AD));
weight = weight + shanhuWeight;
......@@ -190,30 +200,29 @@ public class VedioAdingManager {
weight = weight + chuangshenWeight;
LogUtil.d(TAG, "权重值:chuangshenWeight:" + chuangshenWeight);
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && AppConfig.duomentVedioAdCount > 0) {
weightList.add(new WeightBean(domobWeight, Constant.DUOMENT_VEDIO_AD));
weight = weight + domobWeight;
LogUtil.d(TAG, "权重值:domobWeight:" + domobWeight);
}
if (AppConfig.mintegralAdCount > 0) {
weightList.add(new WeightBean(mintegralWeight, Constant.MINTEGRAL_VEDIO_AD));
weight = weight + mintegralWeight;
LogUtil.d(TAG, "权重值:mintegralWeight:" + mintegralWeight);
}
if (AppConfig.hytechVedioAdCount > 0) {
weightList.add(new WeightBean(hytechVedioWeight, Constant.HYTECH_VEDIO_AD));
weight = weight + hytechVedioWeight;
LogUtil.d(TAG, "权重值:hytechVedioWeight:" + hytechVedioWeight);
}
if (AppConfig.csjFullAdCount > 0) {
weightList.add(new WeightBean(csjFullWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullWeight;
LogUtil.d(TAG, "权重值:csjFullWeight:" + csjFullWeight);
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && AppConfig.duomentVedioAdCount > 0) {
weightList.add(new WeightBean(domobWeight, Constant.DUOMENT_VEDIO_AD));
weight = weight + domobWeight;
LogUtil.d(TAG, "权重值:domobWeight:" + domobWeight);
}
if (AppConfig.hytechVedioAdCount > 0) {
weightList.add(new WeightBean(hytechVedioWeight, Constant.HYTECH_VEDIO_AD));
weight = weight + hytechVedioWeight;
LogUtil.d(TAG, "权重值:hytechVedioWeight:" + hytechVedioWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
Random r = new Random();
int randomWeight = r.nextInt(weight) + 1;
......@@ -254,6 +263,7 @@ public class VedioAdingManager {
int mintegralAdCount = AppConfig.mintegralAdCount;
int shanhuAdCount = AppConfig.shanhuAdCount;
int chuangshenVedioAdCount = AppConfig.chuangshenVedioAdCount;
int sdhzVedioAdCount = AppConfig.sdhzVedioAdCount;
// android10以下多盟判断可用视频数
boolean domobFlag = true;
......@@ -265,7 +275,7 @@ public class VedioAdingManager {
if (csjFullAdCount <= 0 && ylhAdCount <= 0 &&
csjVedioAdCount <= 0 && hytechVedioAdCount <= 0 &&
mintegralAdCount <= 0 && shanhuAdCount <= 0 &&
chuangshenVedioAdCount <= 0 && domobFlag) {
chuangshenVedioAdCount <= 0 && domobFlag && sdhzVedioAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
return true;
}
......@@ -311,6 +321,11 @@ public class VedioAdingManager {
domobVedioAdManager.destory();
domobVedioAdManager = null;
}
if (wnVedioAdManager != null) {
wnVedioAdManager.destory();
wnVedioAdManager = null;
}
}
public void setVedioAdingListener(VedioAdingListener vedioAdingListener) {
......@@ -598,6 +613,40 @@ public class VedioAdingManager {
});
domobVedioAdManager.loadDomobAd(bean.getDownloadCoin(), bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(vedioAdType, Constant.SDHZ_VEDIO_AD)) {
// 闪电盒子激励视频
if (wnVedioAdManager == null) {
if (activity == null) {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.SDHZ_VEDIO_AD);
}
return;
}
wnVedioAdManager = WnVedioAdManager.Companion.getInstance(activity);
}
wnVedioAdManager.setWnVedioAdListener(new WnVedioAdManager.WnVedioAdListener() {
@Override
public void wnVedioAdSuccess() {
AppConfig.sdhzVedioAdCount--;
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.SDHZ_VEDIO_AD);
}
}
@Override
public void wnVedioAdFail() {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.SDHZ_VEDIO_AD);
}
}
@Override
public void wnVedioAdDownload() {
isVedioAdDownload = true;
}
});
wnVedioAdManager.loadWnAd(bean.getDownloadCoin(), bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
package com.mints.highgold.ad
import android.app.Activity
import android.util.Log
import android.widget.Toast
import com.mints.highgold.MintsApplication
import com.mints.highgold.common.Constant
import com.mints.highgold.manager.AdMngrHolder
import com.mints.highgold.manager.TrackManager
import com.mints.highgold.mvp.presenters.WnVedioAdPresenter
import com.mints.highgold.mvp.views.WnVedioAdView
import com.mints.highgold.utils.LogUtil
import com.mints.highgold.utils.ToastUtil
import com.wannuosili.sdk.WNAdConstant
import com.wannuosili.sdk.WNAdDownloadListener
import com.wannuosili.sdk.WNAdSlot
import com.wannuosili.sdk.WNRewardVideoAd
import java.util.*
/**
* 闪电盒子视频
*/
class WnVedioAdManager private constructor(activity: Activity) :
WnVedioAdView {
private val TAG = WnVedioAdManager::class.java.simpleName
lateinit var wnVedioAdPresenter: WnVedioAdPresenter
private var wnVedioAdListener: WnVedioAdListener? = null
var activity: Activity? = null
private lateinit var mRewardVideoAd: WNRewardVideoAd
private var curCoin = 0
private var extraId: String? = null
private var downloadCoin = 10
private var carrierType = ""
private var isClickScreen: Boolean = true
companion object {
private var _inst: WnVedioAdManager? = null
fun getInstance(activity: Activity): WnVedioAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = WnVedioAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
wnVedioAdPresenter = WnVedioAdPresenter()
wnVedioAdPresenter.attachView(this)
}
fun loadWnAd(downloadCoin: Int, curCoin: Int, carrierType: String, extraId: String?) {
if (activity == null) {
return
}
isClickScreen = true
this.downloadCoin = downloadCoin
this.carrierType = carrierType
this.curCoin = curCoin
this.extraId = extraId
var postId: String
when (carrierType) {
Constant.CARRIER_DAILY_VIDEO -> postId = AdMngrHolder.SDHZ_AD_VEDIO_MAIN_LOOK
Constant.CARRIER_VERSUS_VIDEO -> postId = AdMngrHolder.SDHZ_AD_VEDIO_VERSUS_LOOK
Constant.CARRIER_ONLINE_INCOME_DOUBLE, Constant.CARRIER_HOMEWATER_BUBBLE -> postId = AdMngrHolder.SDHZ_AD_VEDIO_MAIN_POP
Constant.CARRIER_REDENVELOPE_DOUBLE, Constant.CARRIER_REDENVELOPE -> postId = AdMngrHolder.SDHZ_AD_VEDIO_REDBOX
else -> postId = AdMngrHolder.SDHZ_AD_VEDIO_MAIN_LOOK
}
val slot = WNAdSlot.Builder()
.setSlotId(postId)
.setOrientation(WNAdConstant.REWARD_VIDEO_AD_PORTRAIT)
.build()
AdMngrHolder.get().loadRewardVideoAd(slot, object : WNRewardVideoAd.RewardVideoAdListener {
override fun onError(code: Int, message: String) {
LogUtil.d(TAG, "onError $code:$message")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ONE, (code).toString(), message)
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdFail()
}
}
override fun onLoad(ad: WNRewardVideoAd) {
ad.interactionListener = object : WNRewardVideoAd.InteractionListener {
override fun onAdShow() {
LogUtil.d(TAG, "onAdShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onAdClick() {
LogUtil.d(TAG, "onAdClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdDownload()
}
}
override fun onAdClose() {
LogUtil.d(TAG, "onAdClose")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdSuccess()
}
wnVedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO())
}
override fun onVideoComplete() {
LogUtil.d(TAG, "onVideoComplete")
}
override fun onRewardVerify(rewardVerify: Boolean, rewardAmount: Int, rewardName: String) {
LogUtil.d(TAG, "onRewardVerify")
}
}
if (ad.type == WNAdConstant.AD_TYPE_DOWNLOAD) {
ad.downloadListener = object : WNAdDownloadListener {
override fun onDownloadStarted(totalBytes: Long, fileName: String, appName: String) {
showToast("开始下载")
}
override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {
LogUtil.d(TAG, "下载结束")
}
override fun onDownloadFailed(fileName: String, appName: String) {
LogUtil.d(TAG, "下载报错: $fileName")
}
}
}
mRewardVideoAd = ad
mRewardVideoAd.showRewardVideoAd(activity)
}
})
}
fun setWnVedioAdListener(wnVedioAdListener: WnVedioAdListener?) {
this.wnVedioAdListener = wnVedioAdListener
}
interface WnVedioAdListener {
fun wnVedioAdSuccess()
fun wnVedioAdFail()
fun wnVedioAdDownload()
}
override fun showLoading(msg: String?) {
TODO("Not yet implemented")
}
override fun showToast(msg: String?) {
if (activity == null) return
ToastUtil.show(activity, msg)
}
override fun hideLoading() {
TODO("Not yet implemented")
}
override fun getBaseApplication() = activity?.application as MintsApplication
private fun getAdMapVO(): HashMap<String, Any> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO
vo["adsource"] = Constant.AD_SOURCE_SDHZ
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_DAILY_DOWNLOAD -> vo["coin"] = curCoin
Constant.CARRIER_DAILY_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER_BUBBLE -> vo["waterCoin"] = curCoin
Constant.CARRIER_ONLINE_INCOME_DOUBLE -> vo["online_income"] = curCoin
Constant.CARRIER_OFFLINE_DOUBLE -> {
vo["offline_income"] = curCoin
vo["page"] = Constant.PAGE_TWO
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_ONE
}
Constant.CARRIER_SIGNIN_HOMEPAGE_CARD -> {
vo["page"] = Constant.PAGE_TWO
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_ONE
}
Constant.CARRIER_DRINK, Constant.CARRIER_DRINK_PATCH -> {
vo["page"] = Constant.PAGE_ONE
vo["block"] = Constant.BLOCK_FOUR
vo["order"] = Constant.ORDER_ONE
vo["critId"] = extraId!!
}
Constant.CARRIER_VERSUS_DRINKTEA -> {
vo["page"] = Constant.PAGE_TWO
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_THREE
vo["critId"] = extraId!!
}
Constant.CARRIER_DAILY_TURN -> {
vo["page"] = Constant.PAGE_ONE
vo["block"] = Constant.BLOCK_THREE
vo["order"] = Constant.ORDER_THREE
vo["turntableKey"] = extraId!!
}
Constant.CARRIER_CHALLENGE_TURN -> {
vo["page"] = Constant.PAGE_TWO
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_FOUR
vo["turntableKey"] = extraId!!
}
Constant.CARRIER_CHALLENGE_CARD -> {
vo["page"] = Constant.PAGE_TWO
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_FIVE
vo["turntableKey"] = extraId!!
}
Constant.CARRIER_REDENVELOPE_DOUBLE, Constant.CARRIER_REDENVELOPE -> {
vo["page"] = Constant.PAGE_ONE
vo["block"] = Constant.BLOCK_ONE
vo["order"] = Constant.ORDER_ONE
vo["numKey"] = extraId!!
}
else -> {
vo["page"] = Constant.PAGE_ONE
if (curCoin != -1) {
vo["online_income"] = curCoin
}
}
}
return vo
}
fun destory() {
wnVedioAdPresenter?.let {
wnVedioAdPresenter.dispose()
wnVedioAdPresenter.detachView()
}
}
}
\ No newline at end of file
......@@ -65,6 +65,10 @@ public class AppConfig {
* 多盟 剩余广告播放数
*/
public static int duomentVedioAdCount = 0;
/**
* 多盟 剩余广告播放数
*/
public static int sdhzVedioAdCount = 0;
/**
* 一览视频 时间间隔 单位-秒
......
......@@ -127,6 +127,7 @@ public interface Constant {
String SHANHU_VEDIO_AD = "SHANHU_VEDIO_AD";
String CHUANGSHEN_VEDIO_AD = "CHUANGSHEN_VEDIO_AD";
String DUOMENT_VEDIO_AD = "DUOMENT_VEDIO_AD";
String SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD";
// 载体
String CARRIER_DRINK = "DRINK";//喝水
......@@ -194,6 +195,7 @@ public interface Constant {
String AD_SOURCE_SHANHU = "CORAL";//珊瑚
String AD_SOURCE_CHUANGSHEN = "CHUANGSHEN";//创神
String AD_SOURCE_DOMOB = "DOMOB";//多盟
String AD_SOURCE_SDHZ = "SDHZ";//闪电盒子
// 页面
int PAGE_ONE = 1;
......
package com.mints.highgold.manager;
import android.content.Context;
import com.mints.highgold.BuildConfig;
import com.wannuosili.sdk.WNAdConfig;
import com.wannuosili.sdk.WNAdManager;
import com.wannuosili.sdk.WNAdSdk;
/**
* 闪电盒子
*/
public class AdMngrHolder {
private static boolean sInit;
public static final String APPID = "10000013";
public static final String SDHZ_AD_VEDIO_MAIN_LOOK = "100000042011";//首页看视频
public static final String SDHZ_AD_VEDIO_REDBOX = "100000052011";//抢红包
public static final String SDHZ_AD_VEDIO_VERSUS_LOOK = "100000062011";//任务赚看视频
public static final String SDHZ_AD_VEDIO_MAIN_POP = "100000072011";//汽泡
public static WNAdManager get() {
if (!sInit) {
throw new RuntimeException("WNAdSdk is not init, please check.");
}
return WNAdSdk.getAdManager();
}
public static void init(Context context) {
doInit(context);
}
private static void doInit(Context context) {
if (!sInit) {
WNAdSdk.initialize(new WNAdConfig.Builder()
.setAppId(APPID)
.setDebug(BuildConfig.DEBUG) // 设置是否是debug模式
.setContext(context) // 上下文
.build());
sInit = true;
}
}
public static void setOaid(String oaid) {
WNAdSdk.setOaid(oaid);
}
}
......@@ -75,6 +75,7 @@ public class UserTaskMsgBean implements Serializable {
private int vedioplan_coral_vedio_rate;
private int vedioplan_chuangshen_vedio_rate;
private int vedioplan_domob_vedio_rate;
private int vedioplan_sdhz_vedio_rate;
private int vedioplan_csj_vedio_surplus;
private int vedioplan_liyan_vedio_surplus;
......@@ -85,6 +86,7 @@ public class UserTaskMsgBean implements Serializable {
private int vedioplan_coral_vedio_surplus;
private int vedioplan_chuangshen_vedio_surplus;
private int vedioplan_domob_vedio_surplus;
private int vedioplan_sdhz_vedio_surplus;
private int JPushLogin;
......@@ -456,4 +458,20 @@ public class UserTaskMsgBean implements Serializable {
public void setJPushLogin(int JPushLogin) {
this.JPushLogin = JPushLogin;
}
public int getVedioplan_sdhz_vedio_rate() {
return vedioplan_sdhz_vedio_rate;
}
public void setVedioplan_sdhz_vedio_rate(int vedioplan_sdhz_vedio_rate) {
this.vedioplan_sdhz_vedio_rate = vedioplan_sdhz_vedio_rate;
}
public int getVedioplan_sdhz_vedio_surplus() {
return vedioplan_sdhz_vedio_surplus;
}
public void setVedioplan_sdhz_vedio_surplus(int vedioplan_sdhz_vedio_surplus) {
this.vedioplan_sdhz_vedio_surplus = vedioplan_sdhz_vedio_surplus;
}
}
package com.mints.highgold.mvp.presenters
import android.app.Activity
import com.mints.highgold.MintsApplication
import com.mints.highgold.mvp.model.BaseResponse
import com.mints.highgold.mvp.views.DomobVedioAdView
import com.mints.highgold.mvp.views.WnVedioAdView
import com.mints.highgold.net.LoanService
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class WnVedioAdPresenter : BasePresenter<WnVedioAdView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.getLoanService()
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any?>?>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
fun onNext(baseResponse: BaseResponse<Any?>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
package com.mints.highgold.mvp.views
interface WnVedioAdView : BaseView {
}
\ No newline at end of file
......@@ -453,7 +453,7 @@ public class AwardActivity extends BaseActivity implements AwardView {
/**
* 广告返回结果
*
* @param adType
* @param adType CHUANGSHEN_VEDIO_AD HYTECH_VEDIO_AD 自有界面
*/
private void vedioAdingSuccess(String adType) {
if (TextUtils.equals(adType, Constant.CHUANGSHEN_VEDIO_AD) || TextUtils.equals(adType, Constant.HYTECH_VEDIO_AD)) {
......
......@@ -25,12 +25,15 @@ import com.daimajia.androidanimations.library.YoYo;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.R;
import com.mints.highgold.ad.DomobVedioAdManager;
import com.mints.highgold.ad.VedioAdingManager;
import com.mints.highgold.ad.WnVedioAdManager;
import com.mints.highgold.ad.inscreenvedio.MintegralInscreenVedioAdManager;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.AdMngrHolder;
import com.mints.highgold.manager.AmapLocationManager;
import com.mints.highgold.manager.LiebaoManager;
import com.mints.highgold.manager.ShumeiManager;
......@@ -360,7 +363,7 @@ public class MainFragment extends BaseFragment
case R.id.tv_fragment_main_whatgold:// 如何赚金币
readyGo(WhatGoldActivity.class);
// WnVedioAdManager.Companion.getInstance(getActivity()).loadWnAd(0, 0, "", "");
break;
case R.id.rl_fragment_main_redbox:// 红包
readyGo(RedboxActivity.class);
......@@ -383,7 +386,7 @@ public class MainFragment extends BaseFragment
.subscribe(granted -> {
if (granted) {
String gameId = userConfig.getGameHomeId();
if (!TextUtils.isEmpty(gameId) ) {
if (!TextUtils.isEmpty(gameId)) {
liebaoManager.startH5Game(gameId);
} else {
boolean main = getActivity() instanceof MainActivity;
......@@ -486,7 +489,8 @@ public class MainFragment extends BaseFragment
// data.setVedioplan_mintegral_vedio_rate(0);
// data.setVedioplan_coral_vedio_rate(0);
// data.setVedioplan_domob_vedio_rate(0);
// data.setVedioplan_chuangshen_vedio_rate(10);
// data.setVedioplan_chuangshen_vedio_rate(0);
// data.setVedioplan_sdhz_vedio_rate(10);
//
// data.setVedioplan_csj_vedio_surplus(0);
// data.setVedioplan_lyh_vedio_surplus(0);
......@@ -495,18 +499,19 @@ public class MainFragment extends BaseFragment
// data.setVedioplan_mintegral_vedio_surplus(0);
// data.setVedioplan_coral_vedio_surplus(0);
// data.setVedioplan_domob_vedio_surplus(0);
// data.setVedioplan_chuangshen_vedio_surplus(10);
// data.setVedioplan_chuangshen_vedio_surplus(0);
// data.setVedioplan_sdhz_vedio_surplus(10);
// 设置随机广告权重
if (vedioAdingManager != null) {
vedioAdingManager.initAdWeight(data.getVedioplan_csj_vedio_rate(), data.getVedioplan_lyh_vedio_rate(),
data.getVedioplan_csj_full_screen_video_rate(), data.getVedioplan_hytech_vedio_rate(),
data.getVedioplan_mintegral_vedio_rate(), data.getVedioplan_coral_vedio_rate(),
data.getVedioplan_chuangshen_vedio_rate(), data.getVedioplan_domob_vedio_rate());
data.getVedioplan_chuangshen_vedio_rate(), data.getVedioplan_domob_vedio_rate(), data.getVedioplan_sdhz_vedio_rate());
}
LogUtil.d(TAG, "首页权重值:csjVedioWeight:" + data.getVedioplan_csj_vedio_rate() + " ylhWeight:" + data.getVedioplan_lyh_vedio_rate() + " csjFullWeight:" + data.getVedioplan_csj_full_screen_video_rate() +
" hytechVedioAdWeight:" + data.getVedioplan_hytech_vedio_rate() + " mintegralVedioAdWeight:" + data.getVedioplan_mintegral_vedio_rate() + " shanhuVedioAdWeight:" + data.getVedioplan_coral_vedio_rate() +
" chuangshenVedioAdWeight:" + data.getVedioplan_chuangshen_vedio_rate() + " domobVedioAdWeight:" + data.getVedioplan_domob_vedio_rate());
" chuangshenVedioAdWeight:" + data.getVedioplan_chuangshen_vedio_rate() + " domobVedioAdWeight:" + data.getVedioplan_domob_vedio_rate() + " sdhzVedioAdWeight:" + data.getVedioplan_sdhz_vedio_rate());
// 广告视频数
AppConfig.csjVedioAdCount = data.getVedioplan_csj_vedio_surplus();
AppConfig.ylhAdCount = data.getVedioplan_lyh_vedio_surplus();
......@@ -516,9 +521,10 @@ public class MainFragment extends BaseFragment
AppConfig.shanhuAdCount = data.getVedioplan_coral_vedio_surplus();
AppConfig.chuangshenVedioAdCount = data.getVedioplan_chuangshen_vedio_surplus();
AppConfig.duomentVedioAdCount = data.getVedioplan_domob_vedio_surplus();
AppConfig.sdhzVedioAdCount = data.getVedioplan_sdhz_vedio_surplus();
LogUtil.d(TAG, "首页视频数:csjVedioAdCount:" + data.getVedioplan_csj_vedio_surplus() + " ylhAdCount:" + data.getVedioplan_lyh_vedio_surplus() + " csjFullAdCount:" + data.getVedioplan_csj_full_screen_video_surplus() +
" hytechVedioAdCount:" + data.getVedioplan_hytech_vedio_surplus() + " mintegralVedioAdCount:" + data.getVedioplan_mintegral_vedio_surplus() + " shanhuVedioAdCount:" + data.getVedioplan_coral_vedio_surplus() +
" chuangshenVedioAdCount:" + data.getVedioplan_chuangshen_vedio_surplus() + " domobVedioAdCount:" + data.getVedioplan_domob_vedio_surplus());
" chuangshenVedioAdCount:" + data.getVedioplan_chuangshen_vedio_surplus() + " domobVedioAdCount:" + data.getVedioplan_domob_vedio_surplus() + " sdhzVedioAdCount:" + data.getVedioplan_sdhz_vedio_surplus());
AppConfig.yilanVedioTime = data.getRedPacketSecond();
......@@ -1068,7 +1074,7 @@ public class MainFragment extends BaseFragment
switch (status) {
case 0:
case 2:
if (!TextUtils.isEmpty(gameId) ) {
if (!TextUtils.isEmpty(gameId)) {
liebaoManager.startH5Game(gameId);
} else {
boolean main = getActivity() instanceof MainActivity;
......@@ -1092,7 +1098,7 @@ public class MainFragment extends BaseFragment
readyGo(AwardActivity.class, bundle);
break;
default:
if (!TextUtils.isEmpty(gameId) ) {
if (!TextUtils.isEmpty(gameId)) {
liebaoManager.startH5Game(gameId);
} else {
boolean main = getActivity() instanceof MainActivity;
......@@ -1143,6 +1149,11 @@ public class MainFragment extends BaseFragment
wvWater.setWaterViewListener(this);
// 权限
showOpenAppPermissionDialog();
//闪电盒子传入oaid
if (!TextUtils.isEmpty(MintsApplication.getOaid())) {
AdMngrHolder.setOaid(MintsApplication.getOaid());
}
}
/**
......@@ -1450,6 +1461,7 @@ public class MainFragment extends BaseFragment
TextUtils.equals(adType, Constant.CSJ_FULL_AD) ||
TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD) ||
TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD) ||
TextUtils.equals(adType, Constant.SDHZ_VEDIO_AD) ||
TextUtils.equals(adType, Constant.DUOMENT_VEDIO_AD)) {
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD)) {
......@@ -1460,6 +1472,8 @@ public class MainFragment extends BaseFragment
AD_SOURCE = Constant.AD_SOURCE_SHANHU;
} else if (TextUtils.equals(adType, Constant.DUOMENT_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_SHANHU;
} else if (TextUtils.equals(adType, Constant.SDHZ_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_SDHZ;
} else {
AD_SOURCE = Constant.AD_SOURCE_CSJ;
}
......
......@@ -2246,6 +2246,7 @@ public class VersusFragment extends BaseFragment
TextUtils.equals(adType, Constant.CSJ_FULL_AD) ||
TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD) ||
TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD) ||
TextUtils.equals(adType, Constant.SDHZ_VEDIO_AD) ||
TextUtils.equals(adType, Constant.DUOMENT_VEDIO_AD)) {
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD)) {
......@@ -2256,6 +2257,8 @@ public class VersusFragment extends BaseFragment
AD_SOURCE = Constant.AD_SOURCE_SHANHU;
} else if (TextUtils.equals(adType, Constant.DUOMENT_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_DOMOB;
} else if (TextUtils.equals(adType, Constant.SDHZ_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_SDHZ;
} else {
AD_SOURCE = Constant.AD_SOURCE_CSJ;
}
......
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!--为了适配所有路径可以设置 path = "." -->
<external-path name="download" path="." />
<external-files-path name="external_file" path="." />
<external-cache-path name="external_cache" path="." />
<files-path name="files" path="." />
<cache-path name="cache" path="。" />
</paths>
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