Commit 36ad682f authored by mengcuiguang's avatar mengcuiguang

1.0.8珊瑚上线

parent c0cee586
......@@ -27,8 +27,10 @@ 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;
import com.mints.highgold.utils.RudenessScreenHelper;
import com.mints.highgold.utils.rxutil.CommonRxTask;
import com.mints.highgold.utils.rxutil.RxjavaUtil;
......@@ -65,6 +67,8 @@ import rx.schedulers.Schedulers;
*/
public class MintsApplication extends MultiDexApplication {
private static final String TAG = MintsApplication.class.getSimpleName();
private static Context mContext;
private static LocalBroadcastManager mLocalBroadcatManager;
......@@ -137,6 +141,7 @@ public class MintsApplication extends MultiDexApplication {
JLibrary.InitEntry(base);
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(e);
}
}
......@@ -230,6 +235,7 @@ public class MintsApplication extends MultiDexApplication {
miitHelper.getDeviceIds(getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(e);
}
}
......@@ -323,10 +329,10 @@ public class MintsApplication extends MultiDexApplication {
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(e);
}
System.out.println("mcg __ oaid:" + oaid);
LogUtil.d(TAG, "oaid:" + oaid);
YwSDK.Companion.init(this, appSecret, appid, userID, "1", oaid);
}
......@@ -414,11 +420,10 @@ public class MintsApplication extends MultiDexApplication {
shanhuFlag = TMSDKContext.init(this, new AbsTMSConfig() {
@Override
public String getServerAddress() {
if (BuildConfig.DEBUG) {
return "mazutest.3g.qq.com"; // 测试环境
} else {
return "mazu.3g.qq.com"; // 正式环境
}
// if (BuildConfig.DEBUG) {
// return "mazutest.3g.qq.com"; // 测试环境
// }
return "mazu.3g.qq.com"; // 正式环境
}
});
/**
......@@ -426,7 +431,7 @@ public class MintsApplication extends MultiDexApplication {
* setAutoConnectionSwitch()影响渠道号上报这个自动联网项是否运行。请不要一直设置为false,影响激活量和活跃量统计,后台会关注并停止相关服务,请在过工信部测试允许联网后,设置回true
*/
ShanHuAD.init(TMSDKContext.getApplicationContext(), new H5Browser(), TMSDKContext.getCoinProductId());
System.out.println("mcg __ shanhuFlag:" + shanhuFlag);
LogUtil.d(TAG, "shanhuFlag:" + shanhuFlag);
}
/**
......@@ -509,6 +514,7 @@ public class MintsApplication extends MultiDexApplication {
}
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(e);
}
return null;
}
......
......@@ -23,6 +23,7 @@ import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.presenters.MintegralVedioAdPresenter;
import com.mints.highgold.mvp.views.MintegralVedioAdManagerView;
import com.mints.highgold.ui.widgets.LoadingDialog;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.ToastUtil;
import java.util.HashMap;
......@@ -32,6 +33,8 @@ import java.util.HashMap;
*/
public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
private static final String TAG = MintegralVedioAdManager.class.getSimpleName();
private static MintegralVedioAdManager _inst;
private MintegralVedioAdPresenter mintegralVedioAdPresenter;
......@@ -176,7 +179,7 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
@Override
public void onVideoLoadFail(String errorMsg) {
System.out.println("mcg __ onVideoLoadFail:" + errorMsg);
LogUtil.d(TAG, "onVideoLoadFail:" + errorMsg);
if (mintegralVedioAdListener != null) {
mintegralVedioAdListener.mintegralVedioAdFail();
}
......@@ -186,7 +189,7 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
@Override
public void onShowFail(String errorMsg) {
System.out.println("mcg __ onShowFail errorMsg:" + errorMsg);
LogUtil.d(TAG, "onShowFail:" + errorMsg);
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_MINTEGRAL, Constant.EVENT_TYPE_ONE, "999998", errorMsg);
if (mintegralVedioAdListener != null) {
mintegralVedioAdListener.mintegralVedioAdFail();
......@@ -212,8 +215,7 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
}
System.out.println("mcg __ onAdClose isCompleteView:" + isCompleteView);
LogUtil.d(TAG, "onAdClose isCompleteView::" + isCompleteView);
}
@Override
......
package com.mints.highgold.ad;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import com.mintegral.msdk.out.MTGRewardVideoHandler;
import com.mintegral.msdk.out.RewardVideoListener;
import com.mintegral.msdk.videocommon.download.NetStateOnReceive;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.MintegralManager;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.mvp.presenters.MintegralVedioAdPresenter;
import com.mints.highgold.mvp.views.MintegralVedioAdManagerView;
import com.mints.highgold.ui.widgets.LoadingDialog;
import com.mints.highgold.utils.ToastUtil;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.presenters.ShanhuVedioAdPresenter;
import com.mints.highgold.mvp.views.ShanhuVedioAdManagerView;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.shanhu.CommonUtil;
import com.mints.library.utils.json.JsonUtil;
import com.tencent.ep.shanhuad.adpublic.ADError;
import com.tencent.ep.shanhuad.adpublic.adbuilder.RewardVideo;
import com.tencent.ep.shanhuad.adpublic.models.AdID;
import com.tencent.ep.shanhuad.adpublic.models.AdMetaInfo;
import com.tmsdk.module.coin.AdConfig;
import com.tmsdk.module.coin.AdConfigManager;
import com.tmsdk.module.coin.AdRequestData;
import com.tmsdk.module.coin.CmpAdConfig;
import com.tmsdk.module.coin.Coin;
import com.tmsdk.module.coin.CoinManager;
import com.tmsdk.module.coin.CoinRequestInfo;
import com.tmsdk.module.coin.CoinTask;
import com.tmsdk.module.coin.CoinTaskType;
import com.tmsdk.module.coin.ErrorCode;
import com.tmsdk.module.coin.ManagerCreator;
import com.tmsdk.module.coin.SubmitResultItem;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 珊瑚视频
*/
public class ShanhuVedioAdManager {
public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
private static final String TAG = ShanhuVedioAdManager.class.getSimpleName();
private static ShanhuVedioAdManager _inst;
private ShanhuVedioAdListener shanhuVedioAdListener;
Activity activity;
private ShanhuVedioAdPresenter shanhuVedioAdPresenter;
private Activity activity;
private RewardVideo mRewardVedio;
private int curCoin;
private String extraId;
private String carrierType;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
private UserManager userManager;
private CoinManager mCoinManager;
private CoinRequestInfo coinRequestInfo;
private Coin coin;
private CoinTask coinTask1;
public static ShanhuVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
......@@ -66,9 +75,19 @@ public class ShanhuVedioAdManager {
private void init(Activity activity) {
this.activity = activity;
userManager = UserManager.getInstance();
shanhuVedioAdPresenter = new ShanhuVedioAdPresenter();
shanhuVedioAdPresenter.attachView(this);
mCoinManager = ManagerCreator.getManager(CoinManager.class);
}
public void destory() {
if (shanhuVedioAdPresenter != null) {
shanhuVedioAdPresenter.dispose();
shanhuVedioAdPresenter.detachView();
}
}
public void loadShanhuAd(int downloadCoin, int curCoin, String carrierType, String extraId) {
......@@ -79,6 +98,7 @@ public class ShanhuVedioAdManager {
this.curCoin = curCoin;
this.extraId = extraId;
this.carrierType = carrierType;
if (!MintsApplication.shanhuFlag) {
((MintsApplication) activity.getApplication()).initShanhuAd();
......@@ -88,13 +108,67 @@ public class ShanhuVedioAdManager {
} else {
new Thread() {
public void run() {
Bundle inBundle1 = new Bundle();
AdConfig aAdConfig1 = new AdConfig(104, inBundle1);
CmpAdConfig cmpAdConfig = AdConfigManager.checkParam(aAdConfig1, 5 * 1000L);
//获取请求具体广告类的参数,封装在AdRequestData
AdRequestData adRequestData = AdConfigManager.getSimplePositionAdConfig(cmpAdConfig);
//AdRequestData的position_id参数对应AdID.posID,
getAdFromBusiness(adRequestData.business + "", adRequestData);
// 第一步:先拉取视频任务
int taskType = 104; // 视频任务的ID
coinRequestInfo = new CoinRequestInfo();
coinRequestInfo.accountId = userManager.getUserID();
coinRequestInfo.loginKey = JsonUtil.toJson(getAdMapVO(carrierType));
ArrayList<CoinTaskType> coinTaskTypes = new ArrayList<CoinTaskType>();
coin = new Coin();
ArrayList<Integer> taskTypes = new ArrayList<Integer>();
taskTypes.add(taskType);
int ret = mCoinManager.GetTasks(coinRequestInfo, taskTypes, coin, coinTaskTypes);
if (ret != ErrorCode.EC_SUCCESS) {
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
}
return;
}
boolean showAdFlag = false;
// 第二步 过滤没做的任务
CoinTaskType coinTaskType = coinTaskTypes.get(0);
try {
// if (coinTaskType != null) {
// LogUtil.d(TAG, "CoinTaskType :" + JsonUtil.toJson(coinTaskType));
// }
for (CoinTask coinTask : coinTaskType.coinTasks) {
if (coinTask.task_status == CoinTask.TaskStatus.NEW) {
coinTask1 = coinTask;
// 拉取未做任务的广告资源,可以多拉一点,因为广告有填充率问题
List<AdConfig> adConfigs = new ArrayList<AdConfig>();
Bundle inBundle1 = new Bundle();
inBundle1.putInt(AdConfig.AD_KEY.AD_NUM.name(), 10);
inBundle1.putString(AdConfig.AD_KEY.AD_CHANNEL_NO.name(), Constant.MINTS_PKG_NAME);
AdConfig aAdConfig1 = new AdConfig(taskType, inBundle1);
adConfigs.add(aAdConfig1);
CmpAdConfig cmpAdConfig = AdConfigManager.checkParam(aAdConfig1, 5 * 1000L);
//获取请求具体广告类的参数,封装在AdRequestData
AdRequestData adRequestData = AdConfigManager.getSimplePositionAdConfig(cmpAdConfig);
//AdRequestData的position_id参数对应AdID.posID,
//positionFormatTypes参数对应Adid的styleArray参数
getAdFromBusiness(adRequestData.business + "", adRequestData);
showAdFlag = true;
break;
}
}
} catch (Throwable t) {
t.printStackTrace();
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "shanhu Throwable");
shanhuVedioAdListener.shanhuVedioAdFail();
}
}
if (!showAdFlag) {
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "no Ad show");
shanhuVedioAdListener.shanhuVedioAdFail();
}
}
}
}.start();
}
......@@ -107,13 +181,16 @@ public class ShanhuVedioAdManager {
* @param adRequestData 请求体,AdRequestData的position_id参数对应AdID.posID,
* positionFormatTypes参数对应Adid的styleArray参数
*/
private void getAdFromBusiness(String Business1, AdRequestData adRequestData) {
if (Business1.equals("COIN_VIDEO_EXIT")) {
gotRewardVedio(adRequestData.positionId, adRequestData.positionFormatTypes);
private List<AdMetaInfo> getAdFromBusiness(String Business1, AdRequestData adRequestData) {
if (adRequestData != null) {
if (Business1.equals("COIN_VIDEO_EXIT")) {
return gotRewardVedio(adRequestData.positionId, adRequestData.positionFormatTypes);
}
}
return null;
}
private void gotRewardVedio(int adId, List<Integer> styleId) {
private List<AdMetaInfo> gotRewardVedio(int adId, List<Integer> styleId) {
mRewardVedio = new RewardVideo();
List<AdID> list = new ArrayList<>();
list.add(new AdID(adId, 968, 300));
......@@ -128,58 +205,56 @@ public class ShanhuVedioAdManager {
mRewardVedio.showAD();
}
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ZERO, "", "");
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ZERO, "", "");
}
});
System.out.println("mcg __ gotRewardVedio loaded");
LogUtil.d(TAG, "gotRewardVedio loaded");
}
@Override
public void onAdError(ADError adError) {
if (adError != null) {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ONE, adError.code + "", adError.msg);
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ONE, adError.code + "", adError.msg);
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
}
System.out.println("mcg __ gotRewardVedio_onAdError");
LogUtil.d(TAG, "gotRewardVedio_onAdError code:" + adError.code + " msg:" + adError.msg);
}
@Override
public void onVideoComplete() {
System.out.println("mcg __ gotRewardVedio onVideoComplete");
Log.e("onVideoComplete", "onVideoComplete");
LogUtil.d(TAG, "gotRewardVedio onVideoComplete");
}
@Override
public void onVideoPlay() {
System.out.println("mcg __ gotRewardVedio onVideoPlay");
LogUtil.d(TAG, "gotRewardVedio onVideoPlay");
}
@Override
public void onClick() {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_TWO, "", "");
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
// 防止重复
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_FOUR, "", "");
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdDownload();
}
System.out.println("mcg __ gotRewardVedio onClick");
LogUtil.d(TAG, "gotRewardVedio onClick");
}
@Override
public void onClose() {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_THREE, "", "");
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_THREE, "", "");
LogUtil.d(TAG, "gotRewardVedio onClose");
System.out.println("mcg __ gotRewardVedio onClose");
cmtTask();
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdAdSuccess();
......@@ -187,12 +262,128 @@ public class ShanhuVedioAdManager {
}
}, activity, new AdID(adId, 968, 300));
}
return null;
}
private void cmtTask() {
new Thread(new Runnable() {
@Override
public void run() {
try {
ArrayList<CoinTask> coinTasks = new ArrayList<CoinTask>();
coinTasks.add(coinTask1);
ArrayList<SubmitResultItem> submitResultItems = new ArrayList<SubmitResultItem>();
int ret = mCoinManager.SubmitBatchTask(coinRequestInfo, coinTasks, coin, submitResultItems);
LogUtil.d(TAG, "cmtTask 错误码:" + ret);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
private HashMap<String, Object> getAdMapVO(String carrierType) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("carrierType", carrierType);
vo.put("adtype", Constant.ADTYPE_VEDIO);
vo.put("adsource", Constant.AD_SOURCE_SHANHU);
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_DAILY_DOWNLOAD:// 每日任务-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_DAILY_VIDEO:// 观看视频-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_HOMEWATER_BUBBLE:// 首页喝水汽泡
vo.put("waterCoin", curCoin);
break;
case Constant.CARRIER_ONLINE_INCOME_DOUBLE:// 在线收益翻倍
vo.put("online_income", curCoin);
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
vo.put("offline_income", curCoin);
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
vo.put("page", Constant.PAGE_TWO);
vo.put("block", Constant.BLOCK_ONE);
vo.put("order", Constant.ORDER_ONE);
break;
case Constant.CARRIER_DRINK:// 喝水正常
case Constant.CARRIER_DRINK_PATCH:// 喝水补卡
vo.put("page", Constant.PAGE_ONE);
vo.put("block", Constant.BLOCK_FOUR);
vo.put("order", Constant.ORDER_ONE);
vo.put("critId", extraId);
break;
case Constant.CARRIER_VERSUS_DRINKTEA://喝饮料
vo.put("page", Constant.PAGE_TWO);
vo.put("block", Constant.BLOCK_ONE);
vo.put("order", Constant.ORDER_THREE);
vo.put("critId", extraId);
break;
case Constant.CARRIER_DAILY_TURN:// 首页大转盘
vo.put("page", Constant.PAGE_ONE);
vo.put("block", Constant.BLOCK_THREE);
vo.put("order", Constant.ORDER_THREE);
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
vo.put("page", Constant.PAGE_TWO);
vo.put("block", Constant.BLOCK_ONE);
vo.put("order", Constant.ORDER_FOUR);
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_CARD:// 挑战刮刮乐
vo.put("page", Constant.PAGE_TWO);
vo.put("block", Constant.BLOCK_ONE);
vo.put("order", Constant.ORDER_FIVE);
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_REDENVELOPE_DOUBLE:// 红包翻倍奖励
case Constant.CARRIER_REDENVELOPE:// 红包奖励
vo.put("page", Constant.PAGE_ONE);
vo.put("block", Constant.BLOCK_ONE);
vo.put("order", Constant.ORDER_ONE);
vo.put("numKey", extraId);
break;
default:// 在线收益翻倍
vo.put("page", Constant.PAGE_ONE);
if (curCoin != -1) {
vo.put("online_income", curCoin);
}
break;
}
return vo;
}
public void setShanhuVedioAdListener(ShanhuVedioAdListener shanhuVedioAdListener) {
this.shanhuVedioAdListener = shanhuVedioAdListener;
}
@Override
public MintsApplication getBaseApplication() {
return (MintsApplication) activity.getApplication();
}
@Override
public void showLoading(String msg) {
}
@Override
public void hideLoading() {
}
@Override
public void showToast(String msg) {
}
public interface ShanhuVedioAdListener {
void shanhuVedioAdFail();
......
......@@ -8,6 +8,7 @@ import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.mvp.model.VedioAdingBean;
import com.mints.highgold.mvp.model.WeightBean;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.ToastUtil;
import com.mints.library.utils.json.JsonUtil;
......@@ -20,6 +21,8 @@ import java.util.Random;
*/
public class VedioAdingManager {
private static final String TAG = VedioAdingManager.class.getSimpleName();
public static final int SECOND = 60;
private static VedioAdingManager _inst;
......@@ -77,7 +80,7 @@ public class VedioAdingManager {
/**
* 初始化广告权重
*/
public void initAdWeight(int csjVedioWeight, int ylhWeight, int csjFullWeight, int hytechVedioWeight, int mintegralWeight) {
public void initAdWeight(int csjVedioWeight, int ylhWeight, int csjFullWeight, int hytechVedioWeight, int mintegralWeight, int shanhuWeight) {
this.csjVedioWeight = csjVedioWeight;
this.ylhWeight = ylhWeight;
this.csjFullWeight = csjFullWeight;
......@@ -113,14 +116,16 @@ public class VedioAdingManager {
String nextAdType = "";
if (AppConfig.csjVedioAdCount > 0) {
nextAdType = Constant.CSJ_VEDIO_AD;
} else if (AppConfig.csjFullAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD;
} else if (AppConfig.hytechVedioAdCount > 0) {
nextAdType = Constant.HYTECH_VEDIO_AD;
} else if (AppConfig.mintegralAdCount > 0) {
nextAdType = Constant.MINTEGRAL_VEDIO_AD;
} else if (AppConfig.ylhAdCount > 0) {
nextAdType = Constant.YLH_VEDIO_AD;
} else if (AppConfig.mintegralAdCount > 0) {
nextAdType = Constant.MINTEGRAL_VEDIO_AD;
} else if (AppConfig.shanhuAdCount > 0) {
nextAdType = Constant.SHANHU_VEDIO_AD;
} else if (AppConfig.hytechVedioAdCount > 0) {
nextAdType = Constant.HYTECH_VEDIO_AD;
} else if (AppConfig.csjFullAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD;
}
return nextAdType;
}
......@@ -131,7 +136,8 @@ public class VedioAdingManager {
private String getVedioAdType() {
// 根据权重获取广告类型
String adType = getRandomWeight();
System.out.println("mcg __ 权重结果返回的广告类型:" + adType);
LogUtil.d(TAG, "权重结果返回的广告类型:" + adType);
return adType;
}
......@@ -150,50 +156,48 @@ public class VedioAdingManager {
if (AppConfig.csjVedioAdCount > 0) {
weightList.add(new WeightBean(csjVedioWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVedioWeight;
System.out.print("mcg __ 权重值:csjVedioWeight:" + csjVedioWeight);
LogUtil.d(TAG, "权重值:csjVedioWeight:" + csjVedioWeight);
}
if (AppConfig.csjFullAdCount > 0) {
weightList.add(new WeightBean(csjFullWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullWeight;
System.out.print(" mcg __ 权重值:csjFullWeight:" + csjFullWeight);
if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
}
if (AppConfig.mintegralAdCount > 0) {
weightList.add(new WeightBean(mintegralWeight, Constant.MINTEGRAL_VEDIO_AD));
weight = weight + mintegralWeight;
LogUtil.d(TAG, "权重值:mintegralWeight:" + mintegralWeight);
}
if (AppConfig.shanhuAdCount > 0) {
weightList.add(new WeightBean(shanhuWeight, Constant.SHANHU_VEDIO_AD));
weight = weight + shanhuWeight;
System.out.print(" mcg __ 权重值:shanhuWeight:" + shanhuWeight);
LogUtil.d(TAG, "权重值:shanhuWeight:" + shanhuWeight);
}
if (AppConfig.hytechVedioAdCount > 0) {
weightList.add(new WeightBean(hytechVedioWeight, Constant.HYTECH_VEDIO_AD));
weight = weight + hytechVedioWeight;
System.out.print(" mcg __ 权重值:hytechVedioWeight:" + hytechVedioWeight);
}
if (AppConfig.mintegralAdCount > 0) {
weightList.add(new WeightBean(mintegralWeight, Constant.MINTEGRAL_VEDIO_AD));
weight = weight + mintegralWeight;
System.out.print(" mcg __ 权重值:mintegralWeight:" + mintegralWeight);
LogUtil.d(TAG, "权重值:hytechVedioWeight:" + hytechVedioWeight);
}
if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight;
System.out.println(" mcg __ 权重值:ylhWeight:" + ylhWeight);
if (AppConfig.csjFullAdCount > 0) {
weightList.add(new WeightBean(csjFullWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullWeight;
LogUtil.d(TAG, "权重值:csjFullWeight:" + csjFullWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
// for (WeightBean weightBean : weightList) {
// weight += weightBean.getWeight();
// }
System.out.print("mcg __ 1、权重总值:" + weight);
LogUtil.d(TAG, "1、权重总值:" + weight);
Random r = new Random();
int randomWeight = r.nextInt(weight) + 1;
System.out.print(" 2、权重随机值:" + randomWeight);
LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
if (randomWeight <= 0) {
System.out.println(" 3、权重结果:" + weightBean.getType());
LogUtil.d(TAG, "3、权重结果:" + weightBean.getType());
return weightBean.getType();
}
}
......@@ -221,9 +225,10 @@ public class VedioAdingManager {
int csjFullAdCount = AppConfig.csjFullAdCount;
int hytechVedioAdCount = AppConfig.hytechVedioAdCount;
int mintegralAdCount = AppConfig.mintegralAdCount;
int shanhuAdCount = AppConfig.shanhuAdCount;
if (csjFullAdCount <= 0 && ylhAdCount <= 0 &&
csjVedioAdCount <= 0 && hytechVedioAdCount <= 0 &&
mintegralAdCount <= 0) {
mintegralAdCount <= 0 && shanhuAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
return true;
}
......@@ -479,7 +484,7 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
}else if (TextUtils.equals(vedioAdType, Constant.SHANHU_VEDIO_AD)) {
} else if (TextUtils.equals(vedioAdType, Constant.SHANHU_VEDIO_AD)) {
// 珊瑚激励视频
if (shanhuVedioAdManager == null) {
if (activity == null) {
......
......@@ -11,16 +11,20 @@ import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.mintegral.msdk.interstitialvideo.out.InterstitialVideoListener;
import com.mintegral.msdk.interstitialvideo.out.MTGInterstitialVideoHandler;
import com.mintegral.msdk.videocommon.download.NetStateOnReceive;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.manager.MintegralManager;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TTNativeExpressManager;
import com.mints.highgold.utils.LogUtil;
/**
* Mintegral插屏视频
*/
public class MintegralInscreenVedioAdManager {
private static final String TAG = MintegralInscreenVedioAdManager.class.getSimpleName();
private static MintegralInscreenVedioAdManager _inst;
private Activity activity;
......@@ -63,7 +67,7 @@ public class MintegralInscreenVedioAdManager {
} else {
AppConfig.isMintegralInscreenFlag = false;
loadCsjFullAd();
System.out.println("mcg __ MintegralInscreenVedioAdManager onVideoLoadFail noReady:");
LogUtil.d(TAG, "MintegralInscreenVedioAdManager onVideoLoadFail noReady:");
}
}
......@@ -82,7 +86,7 @@ public class MintegralInscreenVedioAdManager {
mMtgInterstitalVideoHandler.setInterstitialVideoListener(new InterstitialVideoListener() {
@Override
public void onLoadSuccess(String unitId) {
System.out.println("mcg __ MintegralInscreenVedioAdManager onLoadSuccess");
LogUtil.d(TAG, "MintegralInscreenVedioAdManager onLoadSuccess");
AppConfig.isMintegralInscreenFlag = true;
}
......@@ -90,19 +94,19 @@ public class MintegralInscreenVedioAdManager {
@Override
public void onVideoLoadSuccess(String unitId) {
AppConfig.isMintegralInscreenFlag = true;
System.out.println("mcg __ MintegralInscreenVedioAdManager onVideoLoadSuccess");
LogUtil.d(TAG, "MintegralInscreenVedioAdManager onVideoLoadSuccess");
}
@Override
public void onVideoLoadFail(String errorMsg) {
AppConfig.isMintegralInscreenFlag = false;
System.out.println("mcg __ MintegralInscreenVedioAdManager onVideoLoadFail errorMsg:" + errorMsg);
LogUtil.d(TAG, "MintegralInscreenVedioAdManager onVideoLoadFail errorMsg:" + errorMsg);
}
@Override
public void onShowFail(String errorMsg) {
AppConfig.isMintegralInscreenFlag = false;
System.out.println("mcg __ MintegralInscreenVedioAdManager onShowFail errorMsg:" + errorMsg);
LogUtil.d(TAG, "MintegralInscreenVedioAdManager onShowFail errorMsg:" + errorMsg);
}
@Override
......
......@@ -189,7 +189,7 @@ public interface Constant {
String AD_SOURCE_CSJFULL = "CSJFULL";
String AD_SOURCE_MINTEGRAL = "MINTEGRAL";
String AD_SOURCE_HYTECH = "HYTECH";//东方网
String AD_SOURCE_SHANHU = "SHANHU";//珊瑚
String AD_SOURCE_SHANHU = "CORAL";//珊瑚
// 页面
int PAGE_ONE = 1;
......
......@@ -12,6 +12,7 @@ import com.amap.api.location.AMapLocationListener;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.mvp.model.LocationBean;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.SPUtil;
import com.mints.library.utils.json.JsonUtil;
......@@ -25,6 +26,8 @@ import java.lang.ref.WeakReference;
*/
public class AmapLocationManager {
private static final String TAG = AmapLocationManager.class.getSimpleName();
private static volatile AmapLocationManager _inst;
private Context c;
......@@ -207,12 +210,12 @@ public class AmapLocationManager {
// dlch.put(Constant.LOCATION_DATA, lb);
if(lb!=null){
spUtil.putString(Constant.LOCATION_DATA, JsonUtil.toJson(lb));
System.out.println("mcg__ location-->" + JsonUtil.toJson(lb));
LogUtil.d(TAG, "location-->" + JsonUtil.toJson(lb));
}
} else {
System.out.println("mcg__ location--> 异常");
LogUtil.d(TAG, "location--> 异常" );
}
// else if (loc != null && loc.getErrorCode() == 12) {
......
......@@ -61,18 +61,15 @@
// AdManager.getInstance(context).init(activity, APPID, UserManager.getInstance().getUserID(), APPKEY, cimei, new CommonCallBack() {
// @Override
// public void onSuccess(String s) {
// System.out.println("mcg __ 愉悦推:onSuccess -->"+s);
//
// }
//
// @Override
// public void onFailure(String s) {
// System.out.println("mcg __ 愉悦推:onFailure -->"+s);
// }
//
// @Override
// public void onFailure() {
// System.out.println("mcg __ 愉悦推:onFailure end");
// }
// });
// }
......
......@@ -72,12 +72,14 @@ public class UserTaskMsgBean implements Serializable {
private int vedioplan_liyan_vedio_rate;
private int vedioplan_hytech_vedio_rate;
private int vedioplan_mintegral_vedio_rate;
private int vedioplan_coral_vedio_rate;
private int vedioplan_csj_vedio_surplus;
private int vedioplan_liyan_vedio_surplus;
private int vedioplan_lyh_vedio_surplus;
private int vedioplan_csj_full_screen_video_surplus;
private int vedioplan_hytech_vedio_surplus;
private int vedioplan_mintegral_vedio_surplus;
private int vedioplan_coral_vedio_surplus;
public int getVedioplan_hytech_vedio_rate() {
return vedioplan_hytech_vedio_rate;
......@@ -391,4 +393,20 @@ public class UserTaskMsgBean implements Serializable {
public String getNiceUrl() {
return niceUrl;
}
public int getVedioplan_coral_vedio_rate() {
return vedioplan_coral_vedio_rate;
}
public void setVedioplan_coral_vedio_rate(int vedioplan_coral_vedio_rate) {
this.vedioplan_coral_vedio_rate = vedioplan_coral_vedio_rate;
}
public int getVedioplan_coral_vedio_surplus() {
return vedioplan_coral_vedio_surplus;
}
public void setVedioplan_coral_vedio_surplus(int vedioplan_coral_vedio_surplus) {
this.vedioplan_coral_vedio_surplus = vedioplan_coral_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.MintegralVedioAdManagerView;
import com.mints.highgold.mvp.views.ShanhuVedioAdManagerView;
import com.mints.highgold.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class ShanhuVedioAdPresenter extends BasePresenter<ShanhuVedioAdManagerView> {
private MintsApplication loanApplication;
private LoanService loanService;
private Subscription subscription;
public void reportAddCoinMsg(Activity activity, HashMap<String, Object> vo) {
if (activity == null)
return;
loanApplication = (MintsApplication) activity.getApplication();
loanService = loanApplication.getLoanService();
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
// view.checkLYContextSuc(false);
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
public void dispose() {
loanService = null;
loanApplication = null;
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
}
}
......@@ -158,7 +158,7 @@ public class VersionUpdatePresenter {
if (granted) {
appFileUrl = bean.getUrl();
} else {
appFileUrl = "https://mints-gs.oss-cn-beijing.aliyuncs.com/pkg/mints.apk";
appFileUrl = "";
}
View v_details = View.inflate(activity, R.layout.view_dialog_update, null);
......
package com.mints.highgold.mvp.views;
public interface ShanhuVedioAdManagerView extends BaseView {
}
......@@ -214,7 +214,6 @@ public class EraseActivity extends BaseActivity
blEarseWebview.registerHandler("erasegetChannelCardMsg", new BridgeHandler() {
@Override
public void handler(String data, CallBackFunction function) {
System.out.println("mcg getChannelCardMsg Js:-->>" + data);
//{"title":"40金币","coin":40,"key":"t4"}
TurntableBean turntableBean = JsonUtil.parseJson(data, TurntableBean.class);
......@@ -234,7 +233,6 @@ public class EraseActivity extends BaseActivity
readyGoForResult(AwardActivity.class, ERASE_REQUEST_CODE, bundle);
}
}
// System.out.println("getNum-->" + androidCallJsGetFinishcount());
}
});
blEarseWebview.setDefaultHandler(new DefaultHandler() {
......
......@@ -350,13 +350,13 @@ public class HytechVedioActivity extends BaseActivity
* 点击的开始位置
*/
case MotionEvent.ACTION_DOWN:
System.out.println("mcg__ 起始位置:(" + event.getX() + "," + event.getY());
// System.out.println("mcg__ 起始位置:(" + event.getX() + "," + event.getY());
break;
/**
* 离开屏幕的位置
*/
case MotionEvent.ACTION_UP:
System.out.println("mcg__ 结束位置:(" + event.getX() + "," + event.getY());
// System.out.println("mcg__ 结束位置:(" + event.getX() + "," + event.getY());
break;
default:
break;
......
......@@ -114,11 +114,6 @@ public class MainActivity extends BaseActivity implements MainView {
tabIvLoan.setSelected(true);
tabTvLoan.setSelected(true);
}
// System.out.println("mcg __ test:"+NetUtils.getDomain("http://api.mints-id.com/pro-gs-api/"));
// HytechVedioAdManager.getInstance(this).loanHytechAd(0,"","");
// mainPresenter = new MainPresenter();
// mainPresenter.attachView(this);
}
@Override
......
......@@ -437,7 +437,6 @@ public class RedboxActivity extends BaseActivity implements RedboxView {
timer.setOnCountDownTimerListener(new OnCountDownTimerListener() {
@Override
public void onTick(long millisUntilFinished) {
// System.out.println("mcg __ redbox -->" + TimeRender.ms2HMS((int) (millisUntilFinished)));
if (!RedboxActivity.this.isFinishing()) {
if (tvredBox != null) {
......
......@@ -213,7 +213,6 @@ public class TurntableActivity extends BaseActivity
blTurntableWebview.registerHandler("getTurnResult", new BridgeHandler() {
@Override
public void handler(String data, CallBackFunction function) {
// System.out.println("mcg turn Js:-->>" + data);
//{"title":"40金币","coin":40,"key":"t4"}
TurntableBean turntableBean = JsonUtil.parseJson(data, TurntableBean.class);
......@@ -232,7 +231,6 @@ public class TurntableActivity extends BaseActivity
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBeanKey);
readyGoForResult(AwardActivity.class, TURNTABLE_REQUEST_CODE, bundle);
}
// System.out.println("getNum-->" + androidCallJsGetFinishcount());
}
});
blTurntableWebview.setDefaultHandler(new DefaultHandler() {
......@@ -390,8 +388,6 @@ public class TurntableActivity extends BaseActivity
@Override
public void onADClick() {//激励视频广告被点击
// Map<String, String> map = rewardVideoAD.getExts();
// String clickUrl = map.get("clickUrl");
// System.out.println("mcg __ clickUrl:" + clickUrl);
}
@Override
......
......@@ -121,7 +121,6 @@ public class WebActivity extends BaseActivity {
mBrowserLayout.getWebView().setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// System.out.println("mcg __ url:"+url);
if (url.contains(".apk") || url.contains("pgyer")) {
Uri uri = Uri.parse(url);
......
......@@ -60,6 +60,7 @@ import com.mints.highgold.ui.widgets.WaterView;
import com.mints.highgold.ui.widgets.countdowntimer.CountDownTimerSupport;
import com.mints.highgold.ui.widgets.countdowntimer.OnCountDownTimerListener;
import com.mints.highgold.ui.widgets.refresh.CustomRefreshLayout;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.SPUtil;
import com.mints.highgold.utils.SpanUtils;
import com.mints.highgold.utils.rxutil.CommonRxTask;
......@@ -96,11 +97,11 @@ public class MainFragment extends BaseFragment
IGameAdCallback,
IGameExitInfoCallback {
private static final String TAG = MainFragment.class.getSimpleName();
public static final String AIP_GAME_URL = "api/game/add";//退出游戏、游戏关卡回调
public static final String STASTICIS_GAME_URL = "stasticis/game/add";//点击游戏
private static final String TAG = GameFragment.class.getSimpleName();
@Bind(R.id.fl_main_ttbanner)
FrameLayout flMainTtbanner;
@Bind(R.id.main_main_crl_refresh)
......@@ -479,27 +480,29 @@ public class MainFragment extends BaseFragment
// data.setVedioplan_lyh_vedio_rate(0);
// data.setVedioplan_csj_full_screen_video_rate(0);
// data.setVedioplan_hytech_vedio_rate(0);
// data.setVedioplan_mintegral_vedio_rate(5);
// data.setVedioplan_mintegral_vedio_rate(0);
// data.setVedioplan_coral_vedio_rate(5);
//
// data.setVedioplan_csj_vedio_surplus(0);
// data.setVedioplan_lyh_vedio_surplus(0);
// data.setVedioplan_csj_full_screen_video_surplus(0);
// data.setVedioplan_hytech_vedio_surplus(0);
// data.setVedioplan_mintegral_vedio_surplus(20);
// data.setVedioplan_mintegral_vedio_surplus(0);
// data.setVedioplan_coral_vedio_surplus(20);
// 设置随机广告权重
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());
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());
}
System.out.println("mcg __ 首页权重值: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());
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());
// 广告完成数
AppConfig.csjVedioAdCount = data.getVedioplan_csj_vedio_surplus();
AppConfig.ylhAdCount = data.getVedioplan_lyh_vedio_surplus();
AppConfig.csjFullAdCount = data.getVedioplan_csj_full_screen_video_surplus();
AppConfig.hytechVedioAdCount = data.getVedioplan_hytech_vedio_surplus();
AppConfig.mintegralAdCount = data.getVedioplan_mintegral_vedio_surplus();
System.out.println("mcg __ 首页广告完成数: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());
AppConfig.shanhuAdCount = data.getVedioplan_coral_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());
AppConfig.yilanVedioTime = data.getRedPacketSecond();
userManager.setAdShowFlag(data.isAdFlag());
......@@ -823,7 +826,6 @@ public class MainFragment extends BaseFragment
vo.put("pkg", Constant.MINTS_PKG_NAME);
loanPresenter.gameAdd(STASTICIS_GAME_URL, eventTypeClick, vo);
}
Log.d(TAG, "cmgamesdk_mainF_gameClickCallback_默认游戏中心页面,点击游戏试,触发回调----" + gameID + "----" + gameName);
// }
}
......@@ -856,7 +858,6 @@ public class MainFragment extends BaseFragment
}
Log.d(TAG, "cmgamesdk_mainF_gamePlayTimeCallback—mainfragment_点击游戏右上角或物理返回键,退出游戏时触发回调,并返回游戏时长----" + "play game :" + gameID + "playTimeInSeconds : " + playTimeInSeconds);
// }
}
......@@ -873,7 +874,6 @@ public class MainFragment extends BaseFragment
@Override
public void onGameAdAction(String gameId, int adType, int adAction) {
// if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_LOAN) {
Log.d(TAG, "cmgamesdk_mainF_onGameAdAction_广告曝光/点击回调----" + "onGameAdAction gameID: " + gameID + " adType: " + adType + " adAction: " + adAction);
if (userConfig != null) {
if (adAction != 1) {
HashMap<String, Object> vo = new HashMap<>();
......@@ -921,7 +921,6 @@ public class MainFragment extends BaseFragment
vo.put("pkg", Constant.MINTS_PKG_NAME);
loanPresenter.gameAdd(AIP_GAME_URL, Constant.EVENT_TYPE_GAMEINFO, vo);
}
Log.d(TAG, "cmgamesdk_mainF_gameExitInfoCallback_返回游戏数据(json格式),如:每玩一关,返回关卡数----" + "gameExitInfoCallback: " + gameExitInfo);
// }
}
......@@ -1372,7 +1371,7 @@ public class MainFragment extends BaseFragment
public void vedioAdingListenerError(String adType) {
showToast("加载超时,请休息一下");
hideLoading();
System.out.println("mcg __ VedioAdingManager: vedioAdingListenerError--adType:" + adType);
LogUtil.d(TAG, "VedioAdingManager: vedioAdingListenerError--adType:" + adType);
// showToast("视频异常,请重试");
}
......@@ -1387,21 +1386,19 @@ public class MainFragment extends BaseFragment
public void vedioAdingListenerError(String adType) {
showToast("加载超时,请休息一下");
hideLoading();
System.out.println("mcg __ 内部 vedioAdingListenerError adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerError adType:" + adType);
}
@Override
public void vedioAdingListenerFail(String adType) {
hideLoading();
showToast("视频加载异常,请重试!");
System.out.println("mcg __ 内部 vedioAdingListenerFail adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerFail adType:" + adType);
}
@Override
public void vedioAdingListenerSuccess(String adType) {
System.out.println("mcg __ 内部 vedioAdingListenerSuccess adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerSuccess adType:" + adType);
hideLoading();
vedioAdingSuccess(adType, carrierType);
......@@ -1414,7 +1411,7 @@ public class MainFragment extends BaseFragment
public void vedioAdingListenerSuccess(String adType) {
hideLoading();
// showToast("成功了");
System.out.println("mcg __ VedioAdingManager: vedioAdingListenerSuccess --adType:" + adType + " --- 是否点击下载isVedioAdDownload=" + vedioAdingManager.isVedioAdDownload());
LogUtil.d(TAG, "VedioAdingManager: vedioAdingListenerSuccess --adType:" + adType + " --- 是否点击下载isVedioAdDownload=" + vedioAdingManager.isVedioAdDownload());
vedioAdingSuccess(adType, carrierType);
}
......@@ -1432,12 +1429,15 @@ public class MainFragment extends BaseFragment
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD) ||
TextUtils.equals(adType, Constant.CSJ_VEDIO_AD) ||
TextUtils.equals(adType, Constant.CSJ_FULL_AD) ||
TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD) ||
TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD)) {
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_YLH;
} else if (TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_MINTEGRAL;
} else if (TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_SHANHU;
} else {
AD_SOURCE = Constant.AD_SOURCE_CSJ;
}
......
......@@ -57,6 +57,7 @@ import com.mints.highgold.ui.widgets.countdowntimer.OnCountDownTimerListener;
import com.mints.highgold.ui.widgets.refresh.CustomRefreshLayout;
import com.mints.highgold.utils.AppPackageUsageUtils;
import com.mints.highgold.utils.ImageUtil;
import com.mints.highgold.utils.LogUtil;
import com.mints.highgold.utils.MD5;
import com.mints.highgold.utils.SPUtil;
import com.mints.highgold.utils.SpanUtils;
......@@ -92,6 +93,8 @@ import cn.sharesdk.wechat.friends.Wechat;
public class VersusFragment extends BaseFragment
implements VersusView, CustomRefreshLayout.OnRefreshListener, PlatformActionListener, OnLoginListener {
private static final String TAG = VersusFragment.class.getSimpleName();
@Bind(R.id.main_versus_crl_refresh)
SmartRefreshLayout mainVersusCrlRefresh;
@Bind(R.id.tv_versus_video_gold)
......@@ -1343,8 +1346,6 @@ public class VersusFragment extends BaseFragment
@Override
public void onTick(long millisUntilFinished) {
if (getActivity() != null && !getActivity().isFinishing()) {
// System.out.println("mcg __ versus health type:" + type);
if (type == 1) {
llVersusBreath.setVisibility(View.GONE);
viewVersusBreath.setVisibility(View.GONE);
......@@ -1388,8 +1389,6 @@ public class VersusFragment extends BaseFragment
@Override
public void onFinish() {
if (getActivity() != null && !getActivity().isFinishing()) {
// System.out.println("mcg __ versus onFinish type:" + type);
if (type == 1) {
tvVersusBreath.setText("立即领取");
tvVersusBreath.setBackground(getResources().getDrawable(R.drawable.shape_tv_gold));
......@@ -2183,7 +2182,7 @@ public class VersusFragment extends BaseFragment
@Override
public void vedioAdingListenerError(String adType) {
hideLoading();
System.out.println("mcg __ VedioAdingManager: vedioAdingListenerError--adType:" + adType);
LogUtil.d(TAG, "VedioAdingManager: vedioAdingListenerError--adType:" + adType);
// showToast("视频异常,请重试");
}
......@@ -2191,7 +2190,7 @@ public class VersusFragment extends BaseFragment
@Override
public void vedioAdingListenerFail(String adType) {
// showToast("人工添加,第一次加载失败");
System.out.println("mcg __ Versus VedioAdingManager: vedioAdingListenerFail");
LogUtil.d(TAG, "Versus VedioAdingManager: vedioAdingListenerFail");
// hideLoading();
vedioAdingManager.loadFailAding(bean);
......@@ -2200,21 +2199,19 @@ public class VersusFragment extends BaseFragment
public void vedioAdingListenerError(String adType) {
showToast("加载超时,请休息一下");
hideLoading();
System.out.println("mcg __ 内部 vedioAdingListenerError adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerError adType:" + adType);
}
@Override
public void vedioAdingListenerFail(String adType) {
hideLoading();
showToast("视频加载异常,请重试!");
System.out.println("mcg __ 内部 vedioAdingListenerFail adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerFail adType:" + adType);
}
@Override
public void vedioAdingListenerSuccess(String adType) {
System.out.println("mcg __ 内部 vedioAdingListenerSuccess adType:" + adType);
LogUtil.d(TAG, "内部 vedioAdingListenerSuccess adType:" + adType);
hideLoading();
vedioAdingSuccess(adType, carrierType);
......@@ -2227,7 +2224,7 @@ public class VersusFragment extends BaseFragment
public void vedioAdingListenerSuccess(String adType) {
hideLoading();
// showToast("成功了");
System.out.println("mcg __ Versus VedioAdingManager: vedioAdingListenerSuccess --- 是否点击下载isVedioAdDownload=" + vedioAdingManager.isVedioAdDownload());
LogUtil.d(TAG, "Versus VedioAdingManager: vedioAdingListenerSuccess --- 是否点击下载isVedioAdDownload=" + vedioAdingManager.isVedioAdDownload());
vedioAdingSuccess(adType, carrierType);
}
......@@ -2245,12 +2242,15 @@ public class VersusFragment extends BaseFragment
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD) ||
TextUtils.equals(adType, Constant.CSJ_VEDIO_AD) ||
TextUtils.equals(adType, Constant.CSJ_FULL_AD) ||
TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD) ||
TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD)) {
if (TextUtils.equals(adType, Constant.YLH_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_YLH;
} else if (TextUtils.equals(adType, Constant.MINTEGRAL_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_MINTEGRAL;
} else if (TextUtils.equals(adType, Constant.SHANHU_VEDIO_AD)) {
AD_SOURCE = Constant.AD_SOURCE_SHANHU;
} else {
AD_SOURCE = Constant.AD_SOURCE_CSJ;
}
......
......@@ -3,6 +3,7 @@ package com.mints.highgold.ui.fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.R;
import com.mints.highgold.ad.inscreen.InsertScreenAdManager;
import com.mints.highgold.common.AppConfig;
......@@ -10,6 +11,7 @@ import com.mints.highgold.mvp.presenters.YilanVedioPresenter;
import com.mints.highgold.mvp.views.YilanVedioView;
import com.mints.highgold.ui.fragment.base.BaseFragment;
import com.mints.highgold.ui.widgets.CountDownVedioView;
import com.mints.highgold.utils.LogUtil;
import com.yilan.sdk.player.UserCallback;
import com.yilan.sdk.player.entity.PlayData;
import com.yilan.sdk.player.utils.Constant;
......@@ -31,6 +33,8 @@ import butterknife.Bind;
public class YilanVedioFragment extends BaseFragment
implements YilanVedioView, AdVideoCallback {
private static final String TAG = YilanVedioFragment.class.getSimpleName();
@Bind(R.id.cdvv_fragment_yilan_time)
CountDownVedioView cdvvYilanTime;
private LittleVideoFragment littleVideoFragment;
......@@ -71,7 +75,6 @@ public class YilanVedioFragment extends BaseFragment
onResume();
}
super.onHiddenChanged(hidden);
// System.out.println("mcg __ onHiddenChanged");
}
@Override
......@@ -122,7 +125,6 @@ public class YilanVedioFragment extends BaseFragment
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
// System.out.println("mcg __ setUserVisibleHint");
if (littleVideoFragment != null) {
littleVideoFragment.setUserVisibleHint(isVisibleToUser);
}
......@@ -170,7 +172,7 @@ public class YilanVedioFragment extends BaseFragment
*/
@Override
public void onVideoError(int errorCode, AdEntity entity) {
System.out.println("mcg __ onVideoError entity:" + entity + " errorCode:" + errorCode);
LogUtil.d(TAG, "onVideoError entity:" + entity + " errorCode:" + errorCode);
}
/**
......@@ -180,7 +182,7 @@ public class YilanVedioFragment extends BaseFragment
*/
@Override
public void onVideoAdStartPlay(AdEntity entity) {
System.out.println("mcg __ onVideoAdStartPlay entity:" + entity);
LogUtil.d(TAG, "onVideoAdStartPlay entity:" + entity);
}
/**
......
......@@ -307,7 +307,6 @@ public class WaterView extends FrameLayout
// waterList.add(Integer.valueOf(tvFouroneWater.getText().toString()));
// }
// System.out.println("mcg __ waterList" + JsonUtil.toJson(waterList));
return waterList;
}
......@@ -423,7 +422,6 @@ public class WaterView extends FrameLayout
public void onTick(long millisUntilFinished) {
if (activity != null && !activity.isFinishing()) {
if (tvWaterDrinktime != null) {
// System.out.println("mcg __ 后喝水领金币" + TimeRender.ms2HMS((int) (millisUntilFinished)));
tvWaterDrinktime.setVisibility(VISIBLE);
tvWaterDrinktime.setText(TimeRender.ms2HMS((int) (millisUntilFinished)) + "后喝水领金币");
}
......
......@@ -85,20 +85,5 @@ public class AESUtils {
}
public static void main(String[] args) throws Exception {
// String message = "123456wwe";
// String entryptedMsg = encrypt(message, key);
// System.out.println("encrypted message is below :");
// System.out.println("加密结果:" + entryptedMsg);
// String dexryptedmsg = "Dj4MYXI5X6gL3H+bBjAhspXibZVhO79bgzoIawpl/6NNJWsjTHKMJGLtTPmvInRmbK3ipi4NvxsU\n" + "FtSufnPbZCtpydpNldkXCJ3vNALju60=";
// String decryptedMsg = detrypt(dexryptedmsg, key);
// System.out.println("decrypted message is below :");
// System.out.println(MD5.GetMD5Code("meijie_2016").substring(8, 24));
System.out.println(detrypt("5EBue8TMfYS2P8YAZUyJUKnYvTVEblnJMwC00vC1yZHjvqq6Ws4TeaXQ+7l+iwdzoQNi2yJ9CLrG\n" +
"cfQlCjaAbr5gmLokexHida7yLofB7V5ItaxTGlXyxK3CH+Wr/lvbWKmP8YROCrtzrreqP8svuf0M\n" +
"AzKbOnPhoURvpfVS5di/dk3chtujIqC74xd5XpLJfHiXQadEX+12zq+IXa0xIWezTHjL6cJBTN6y\n" +
"xg5w6+ey7EYzEdJ118HaSTr1tLu7AkxguXJez9QxhB9nifRBvgl7tlY0oL20+yGGZ3WgR/CmWh9u\n" +
"PjEy0eB3NgmNd8SRmImXDYOQDMJqxa5AUMKjQkQ/NmrDLBdRO+9zy5Ujv7YL1KVoUmmxeH5EVPZR\n" +
"nV+E", "abcdnnnnnn123456"));
}
}
......@@ -191,7 +191,7 @@ public class FileUtils {
DecimalFormat df = new DecimalFormat("#.00");
size = df.format((double) bt.length / 1048576) + "MB";
} else {
System.out.println("没有从该连接获得内容");
// System.out.println("没有从该连接获得内容");
}
inStream.close();
outStream.close();
......
package com.mints.highgold.utils;
import android.util.Log;
import com.mints.highgold.BuildConfig;
public class LogUtil {
/**
* Don't let anyone instantiate this class.
*/
private LogUtil() {
throw new Error("Do not need instantiate!");
}
private static final boolean DEBUG = BuildConfig.DEBUG;
private static final String DEBUGTAG = "McgLog_";
public static final int DEBUG_LEVEL = 0;
/**
* 'System.out' switch.When it is true, you can see the 'System.out' log.
* Otherwise, you cannot.
*/
public static final boolean DEBUG_SYSOUT = false;
/**
* Send a {@link android.util.Log#VERBOSE} log message.
*
* @param obj
*/
public static void v(Object obj) {
if (DEBUG) {
if (Log.VERBOSE > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.v(DEBUGTAG+tag, msg);
}
}
}
/**
* Send a {@link #DEBUG_LEVEL} log message.
*
* @param obj
*/
public static void d(Object obj) {
if (DEBUG) {
if (Log.DEBUG > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.d(DEBUGTAG+tag, msg);
}
}
}
/**
* Send an {@link android.util.Log#INFO} log message.
*
* @param obj
*/
public static void i(Object obj) {
if (DEBUG) {
if (Log.INFO > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.i(DEBUGTAG+tag, msg);
}
}
}
/**
* Send a {@link android.util.Log#WARN} log message.
*
* @param obj
*/
public static void w(Object obj) {
if (DEBUG) {
if (Log.WARN > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.w(DEBUGTAG+tag, msg);
}
}
}
/**
* Send an {@link android.util.Log#ERROR} log message.
*
* @param obj
*/
public static void e(Object obj) {
if (DEBUG) {
if (Log.ERROR > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.e(DEBUGTAG+tag, msg);
}
}
}
/**
* What a Terrible Failure: Report a condition that should never happen. The
* error will always be logged at level ASSERT with the call stack.
* Depending on system configuration, a report may be added to the
* {@link android.os.DropBoxManager} and/or the process may be terminated
* immediately with an error dialog.
*
* @param obj
*/
public static void wtf(Object obj) {
if (DEBUG) {
if (Log.ASSERT > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.wtf(DEBUGTAG+tag, msg);
}
}
}
/**
* Send a {@link android.util.Log#VERBOSE} log message.
*
* @param tag Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static void v(String tag, String msg) {
if (DEBUG) {
if (Log.VERBOSE > DEBUG_LEVEL) {
Log.v(DEBUGTAG+tag, msg);
}
}
}
/**
* Send a {@link #DEBUG_LEVEL} log message.
*
* @param tag Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static void d(String tag, String msg) {
if (DEBUG) {
if (Log.DEBUG > DEBUG_LEVEL) {
Log.d(DEBUGTAG+tag, msg);
}
}
}
/**
* Send an {@link android.util.Log#INFO} log message.
*
* @param tag Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static void i(String tag, String msg) {
if (DEBUG) {
if (Log.INFO > DEBUG_LEVEL) {
Log.i(DEBUGTAG+tag, msg);
}
}
}
/**
* Send a {@link android.util.Log#WARN} log message.
*
* @param tag Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static void w(String tag, String msg) {
if (DEBUG) {
if (Log.WARN > DEBUG_LEVEL) {
Log.w(DEBUGTAG+tag, msg);
}
}
}
/**
* Send an {@link android.util.Log#ERROR} log message.
*
* @param tag Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static void e(String tag, String msg) {
if (Log.ERROR > DEBUG_LEVEL) {
Log.e(DEBUGTAG+tag, msg);
}
}
/**
* What a Terrible Failure: Report a condition that should never happen. The
* error will always be logged at level ASSERT with the call stack.
* Depending on system configuration, a report may be added to the
* {@link android.os.DropBoxManager} and/or the process may be terminated
* immediately with an error dialog.
*
* @param tag Used to identify the source of a log message.
* @param msg The message you would like logged.
*/
public static void wtf(String tag, String msg) {
if (Log.ASSERT > DEBUG_LEVEL) {
Log.wtf(DEBUGTAG+tag, msg);
}
}
/**
* Send a {@link android.util.Log#VERBOSE} log message. And just print method name and
* position in black.
*/
public static void print() {
if (Log.VERBOSE > DEBUG_LEVEL) {
String tag = getClassName();
String method = callMethodAndLine();
Log.v(DEBUGTAG+tag, method);
if (DEBUG_SYSOUT) {
System.out.println(DEBUGTAG+tag + " " + method);
}
}
}
/**
* Send a {@link #DEBUG_LEVEL} log message.
*
* @param object The object to print.
*/
public static void print(Object object) {
if (Log.DEBUG > DEBUG_LEVEL) {
String tag = getClassName();
String method = callMethodAndLine();
String content = "";
if (object != null) {
content = object.toString() + " ---- "
+ method;
} else {
content = " ## " + " ---- " + method;
}
Log.d(DEBUGTAG+tag, content);
if (DEBUG_SYSOUT) {
System.out.println(DEBUGTAG+tag + " " + content + " " + method);
}
}
}
/**
* Send an {@link android.util.Log#ERROR} log message.
*
* @param object The object to print.
*/
public static void printError(Object object) {
if (Log.ERROR > DEBUG_LEVEL) {
String tag = getClassName();
String method = callMethodAndLine();
String content = "";
if (object != null) {
content = object.toString() + " ---- "
+ method;
} else {
content = " ## " + " ---- " + method;
}
Log.e(DEBUGTAG+tag, content);
if (DEBUG_SYSOUT) {
System.err.println(DEBUGTAG+tag + " " + method + " " + content);
}
}
}
/**
* Print the array of stack trace elements of this method in black.
*
* @return
*/
public static void printCallHierarchy() {
if (Log.VERBOSE > DEBUG_LEVEL) {
String tag = getClassName();
String method = callMethodAndLine();
String hierarchy = getCallHierarchy();
Log.v(DEBUGTAG+tag, method + hierarchy);
if (DEBUG_SYSOUT) {
System.out.println(DEBUGTAG+tag + " " + method + hierarchy);
}
}
}
/**
* Print debug log in blue.
*
* @param object The object to print.
*/
public static void printMyLog(Object object) {
if (Log.DEBUG > DEBUG_LEVEL) {
String tag = "MYLOG";
String method = callMethodAndLine();
String content = "";
if (object != null) {
content = object.toString() + " ---- "
+ method;
} else {
content = " ## " + " ---- " + method;
}
Log.d(DEBUGTAG+tag, content);
if (DEBUG_SYSOUT) {
System.out.println(DEBUGTAG+tag + " " + content + " " + method);
}
}
}
private static String getCallHierarchy() {
String result = "";
StackTraceElement[] trace = (new Exception()).getStackTrace();
for (int i = 2; i < trace.length; i++) {
result += "\r\t" + trace[i].getClassName() + ""
+ trace[i].getMethodName() + "():"
+ trace[i].getLineNumber();
}
return result;
}
private static String getClassName() {
String result = "";
StackTraceElement thisMethodStack = (new Exception()).getStackTrace()[2];
result = thisMethodStack.getClassName();
return result;
}
/**
* Realization of double click jump events.
*
* @return
*/
private static String callMethodAndLine() {
String result = "at ";
StackTraceElement thisMethodStack = (new Exception()).getStackTrace()[2];
result += thisMethodStack.getClassName() + "";
result += thisMethodStack.getMethodName();
result += "(" + thisMethodStack.getFileName();
result += ":" + thisMethodStack.getLineNumber() + ") ";
return result;
}
}
......@@ -16,7 +16,6 @@ public class MD5 {
// 返回形式为数字跟字符串
private static String byteToArrayString(byte bByte) {
int iRet = bByte;
// System.out.println("iRet="+iRet);
if (iRet < 0) {
iRet += 256;
}
......@@ -28,7 +27,6 @@ public class MD5 {
// 返回形式只为数字
private static String byteToNum(byte bByte) {
int iRet = bByte;
System.out.println("iRet1=" + iRet);
if (iRet < 0) {
iRet += 256;
}
......@@ -58,7 +56,7 @@ public class MD5 {
}
public static void main(String[] args) {
MD5 getMD5 = new MD5();
System.out.println(getMD5.GetMD5Code("136111111111231231231231e807f1fcf82d132f9bb018ca6738a19f"));
// MD5 getMD5 = new MD5();
// System.out.println(getMD5.GetMD5Code("136111111111231231231231e807f1fcf82d132f9bb018ca6738a19f"));
}
}
\ No newline at end of file
......@@ -55,7 +55,6 @@ public final class Utils {
public static void main(String[] args) {
System.out.println((int) ((Math.random() * 9 + 1) * 100000));
}
......
......@@ -30,10 +30,10 @@ public class OkHttpProgress {
final ProgressListener progressListener = new ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
System.out.println(bytesRead);
System.out.println(contentLength);
System.out.println(done);
System.out.format("%d%% done\n", (100 * bytesRead) / contentLength);
// System.out.println(bytesRead);
// System.out.println(contentLength);
// System.out.println(done);
// System.out.format("%d%% done\n", (100 * bytesRead) / contentLength);
}
};
......@@ -63,7 +63,7 @@ public class OkHttpProgress {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
System.out.println(response.body().string());
// System.out.println(response.body().string());
}
public static void main(String... arg) throws Exception {
......
......@@ -148,7 +148,6 @@ public class SystemUtils {
.getUriFor("screen_brightness");
int nowScreenBri = getScreenBrightness(activity);
nowScreenBri = nowScreenBri <= 225 ? nowScreenBri + 30 : 30;
System.out.println("nowScreenBri==" + nowScreenBri);
android.provider.Settings.System.putInt(resolver, "screen_brightness",
nowScreenBri);
resolver.notifyChange(uri, null);
......
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