Commit f4abdc0d authored by mengcuiguang's avatar mengcuiguang

优化权重逻辑

parent 704bc6e1
......@@ -197,7 +197,7 @@ dependencies {
// implementation(name: 'alipaySdk-15.6.8-20191021122514', ext: 'aar')
implementation(name: 'alipaySdk-15.7.4-20200228192319-noUtdid', ext: 'aar')
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNormal.4.176.1046', ext: 'aar')
implementation(name: 'GDTSDK.unionNormal.4.191.1061', ext: 'aar')
// jsbridge
implementation 'com.github.lzyzsd:jsbridge:1.0.4'
// 阴影库-ShadowLayout
......@@ -220,7 +220,7 @@ dependencies {
// 三方接入
// 立言积分广告
implementation(name: 'lycoin-release-v1.4.3', ext: 'aar')
// implementation(name: 'lycoin-release-v1.4.3', ext: 'aar')
// 穿山甲广告
implementation(name: 'open_ad_sdk', ext: 'aar')
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
......
......@@ -294,19 +294,6 @@
# ===================== 立言积分 START ================
-keep class btmsdkobf.** { *; }
-keep class com.tmsdk.** { *; }
-keep class tmsdk.** { *; }
-keep class com.liyanmobi.soft.lycoin.* { *;}
#以下是okhttp库的混淆
-dontwarn javax.annotation.**
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
# ======================= 立言积分 END ================
# ===================== JZVedio START ================
-keep public class cn.jzvd.JZMediaSystem {*; }
......
......@@ -3,37 +3,26 @@ package com.mints.highgold;
import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import com.bun.miitmdid.core.JLibrary;
import com.component.dly.xzzq_ywsdk.YwSDK;
import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig;
import com.lechuan.midunovel.view.FoxSDK;
import com.liyanmobi.soft.lycoin.LyEntry;
import com.liyanmobi.soft.lycoin.LyOnInitializeListener;
import com.mintegral.msdk.MIntegralSDK;
import com.mintegral.msdk.out.MIntegralSDKFactory;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.R;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.LiebaoManager;
import com.mints.highgold.manager.LyAdManager;
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.utils.DevicesUtil;
import com.mints.highgold.utils.ForegroundOrBackground;
import com.mints.highgold.utils.RudenessScreenHelper;
import com.mints.highgold.utils.rxutil.CommonRxTask;
import com.mints.highgold.utils.rxutil.RxjavaUtil;
import com.mints.library.utils.CommonUtils;
import com.mints.library.utils.SmartBarUtils;
import com.mob.MobSDK;
......@@ -154,7 +143,7 @@ public class MintsApplication extends MultiDexApplication {
LiebaoManager.getInstance().initCmGameSdk();
// 立言积分初始化
initGold(this);
// initGold(this);
// 初始化ShareSDK
MobSDK.init(this);
......@@ -235,26 +224,6 @@ public class MintsApplication extends MultiDexApplication {
new RudenessScreenHelper(this, AppConfig.design_width).activate();
}
/**
* 积分初始化
*/
public void initGold(Context context) {
LyEntry.setDebug(context, true);//测试期间,可以打开测试模式,可以在/lycoin/包名/logs目录下找到日志文件
LyEntry.init(context, LyAdManager.APP_KEY, new LyOnInitializeListener() {
@Override
public void onSuccess() {
AppConfig.lyAdSdkInitState = true;
// System.out.println("lyAd success");
}
@Override
public void onFailed(int code) {
AppConfig.lyAdSdkInitState = false;
// System.out.println("lyAd fail" + code);
}
});
}
/**
* 友盟初始化
*/
......
......@@ -40,6 +40,8 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
protected LoadingDialog progressDialog;
boolean isClickRunDownload = false;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjFullVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
......@@ -83,7 +85,7 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
showToast("界面加载超时,请重新加载");
return;
}
isClickScreen = true;
isClickRunDownload = false;
this.curCoin = curCoin;
this.extraId = extraId;
......@@ -144,6 +146,11 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdVideoBarClick() {
// System.out.println("mcg __ csjfull onAdVideoBarClick");
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_TWO, "", "");
isClickRunDownload = true;
......
......@@ -47,6 +47,8 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
boolean isClickRunDownload = false;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
......@@ -90,7 +92,7 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
showToast("界面加载超时,请重新加载");
return;
}
isClickScreen = true;
isClickRunDownload = false;
this.curCoin = curCoin;
this.extraId = extraId;
......@@ -211,6 +213,12 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
isClickRunDownload = true;
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
// 内容是H5连接 点击后也给金币
try {
if (mttRewardVideoAd.getInteractionType() == 3) {
......
package com.mints.highgold.ad;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.KeyEvent;
import com.liyanmobi.soft.lycoin.LyAdInfo;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.R;
import com.mints.highgold.common.AppConfig;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.LyAdManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.presenters.LyVedioAdPresenter;
import com.mints.highgold.mvp.views.LyVedioAdManagerView;
import com.mints.highgold.ui.activitys.TryVedioActivity;
import com.mints.highgold.ui.widgets.LoadingDialog;
import com.mints.highgold.utils.SPUtil;
import com.mints.highgold.utils.ToastUtil;
import com.mints.highgold.utils.rxutil.CommonRxTask;
import com.mints.highgold.utils.rxutil.RxjavaUtil;
/**
* 立言视频
*/
public class LyVedioAdManager implements LyVedioAdManagerView {
private static LyVedioAdManager _inst;
private LyVedioAdPresenter lyVedioAdPresenter;
private LyVedioAdListener lyVedioAdListener;
Activity activity;
private Context context;
private SPUtil spUtil;
private int curCoin;
private String extraId;
private LyAdManager lyAdManager;
private UserManager userManager;
protected LoadingDialog progressDialog;
private int downloadCoin = 10;
private String carrierType = "";
public static LyVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
_inst = new LyVedioAdManager(activity);
return _inst;
}
}
private LyVedioAdManager(Activity activity) {
init(activity);
return;
}
private void init(Activity activity) {
this.activity = activity;
context = MintsApplication.getContext();
lyAdManager = LyAdManager.getInstance();
userManager = UserManager.getInstance();
spUtil = SPUtil.getInstance(context);
lyVedioAdPresenter = new LyVedioAdPresenter();
lyVedioAdPresenter.attachView(this);
}
/**
* 立言视频
*/
public void tryVedio(int downloadCoin, int curCoin, String carrierType, String extraId) {
if (activity == null) {
showToast("界面加载超时,请重新加载");
return;
}
// showLoading("加载中...");
if (!AppConfig.lyAdSdkInitState) {
MintsApplication mintsApplication = (MintsApplication) activity.getApplication();
mintsApplication.initGold(context);
// hideLoading();
if (lyVedioAdListener != null) {
lyVedioAdListener.lyVedioAdFail();
}
return;
}
this.downloadCoin = downloadCoin;
this.carrierType = carrierType;
this.curCoin = curCoin;
this.extraId = extraId;
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
if (AppConfig.lyAdSdkVedioState) {
// 获取
lyAdManager.setLyAdVedioInfo(lyAdManager.getAdVedioInfo(context, spUtil, userManager.getUserID()));
}
}
@Override
public void doInUIThread() {
LyAdInfo lyAdVedioInfo = lyAdManager.getLyAdVedioInfo();
if (lyAdVedioInfo != null) {
lyVedioAdPresenter.checkLYContext(activity, lyAdVedioInfo.video_url);
} else {
// 立言失败就调用穿山甲
// hideLoading();
if (lyVedioAdListener != null) {
lyVedioAdListener.lyVedioAdFail();
}
}
}
});
}
@Override
public void checkLYContextSuc(boolean lyCmtFlag) {
// hideLoading();
if (lyCmtFlag) {
if (lyVedioAdListener != null) {
lyVedioAdListener.lyVedioAdSuccess();
}
Bundle bundle = new Bundle();
bundle.putString(Constant.TRY_VEDIO_COIN, curCoin + "");
bundle.putString(Constant.TRY_TASK_H5DOWNLOADCOIN, downloadCoin + "");
// bundle.putInt(Constant.TRY_COIN, userConfig.getCoin());
// bundle.putInt(Constant.TRY_COIN_RATE, userConfig.getCoinRate());
// bundle.putString(Constant.TRY_CARRIER, Constant.CARRIER_DAILY_DOWNLOAD);
bundle.putString(Constant.TRY_CARRIER, carrierType);
bundle.putInt(Constant.MAIN_CUR_COIN, curCoin);
bundle.putString(Constant.MAIN_EXTRA_ID, extraId);
readyGo(TryVedioActivity.class, bundle);
// RxjavaUtil.executeRxTask(new CommonRxTask<String>("aaaa") {
// @Override
// public void doInIOThread() {
// try {
// Thread.sleep(500);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void doInUIThread() {
// if (lyVedioAdListener != null) {
// lyVedioAdListener.lyVedioAdSuccess();
// }
// }
//
//
// });
} else {
if (lyVedioAdListener != null) {
lyVedioAdListener.lyVedioAdFail();
}
}
}
public void destory() {
if (lyVedioAdPresenter != null) {
lyVedioAdPresenter.dispose();
lyVedioAdPresenter.detachView();
}
}
protected void showMissingPermissionDialog(String msg) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.notifyTitle);
//当前应用缺少必要权限。\n\n请点击\"设置\"-\"权限\"-打开所需权限。
builder.setMessage("当前应用缺少 " + msg + "授权\n\n请点击 设置-权限-打开所需权限");
// 拒绝, 退出应用
builder.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setPositiveButton(R.string.setting,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + context.getPackageName()));
context.startActivity(intent);
}
});
builder.setCancelable(false);
builder.show();
}
@Override
public MintsApplication getBaseApplication() {
return (MintsApplication) activity.getApplication();
}
/**
* 显示加载进度条(自定义message)
*
* @param message
*/
@Override
public void showLoading(String message) {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog == null) {
progressDialog = new LoadingDialog(activity);
progressDialog.setLoadText(message);
}
progressDialog.show();
setProgressOnTouchOutside(false);
setProgressNoDismiss();
}
}
/**
* 设置Progress是否手触消失
*
* @param onTouchOutside
*/
public void setProgressOnTouchOutside(boolean onTouchOutside) {
if (progressDialog != null)
progressDialog.setCanceledOnTouchOutside(onTouchOutside);
}
/**
* 设置点击返回是否消失加载进度条
*/
public final void setProgressNoDismiss() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
}
}
/**
* 消失加载进度条
*/
@Override
public void hideLoading() {
try {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
progressDialog = null;
}
}
@Override
public void showToast(String msg) {
if (!TextUtils.isEmpty(msg))
ToastUtil.show(MintsApplication.getContext(), msg);
}
protected void readyGo(Class<?> clazz, Bundle bundle) {
Intent intent = new Intent(activity, clazz);
if (null != bundle) {
intent.putExtras(bundle);
}
activity.startActivity(intent);
}
public void setLyVedioAdListener(LyVedioAdListener lyVedioAdListener) {
this.lyVedioAdListener = lyVedioAdListener;
}
public interface LyVedioAdListener {
void lyVedioAdFail();
void lyVedioAdSuccess();
}
}
......@@ -17,6 +17,7 @@ import com.mints.highgold.MintsApplication;
import com.mints.highgold.R;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.MintegralManager;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.views.MintegralVedioAdManagerView;
import com.mints.highgold.ui.widgets.LoadingDialog;
......@@ -49,6 +50,9 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
private String mRewardUnitId = MintegralManager.MINTEGRAL_AD_VEDIO_MOREDIALOG_UNITID;
private String mUserId;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static MintegralVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
......@@ -104,6 +108,8 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
return;
}
isClickScreen = true;
this.downloadCoin = downloadCoin;
this.carrierType = carrierType;
this.curCoin = curCoin;
......@@ -191,6 +197,12 @@ public class MintegralVedioAdManager implements MintegralVedioAdManagerView {
System.out.println("mcg __ onVideoAdClicked");
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_MINTEGRAL, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (mintegralVedioAdListener != null) {
mintegralVedioAdListener.mintegralVedioAdDownload();
}
......
......@@ -39,6 +39,7 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
protected LoadingDialog progressDialog;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVedioAdManager getInstance(Activity activity) {
if (_inst != null) {
......@@ -76,7 +77,7 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
showToast("界面加载超时,请重新加载");
return;
}
isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
// showLoading("加载中...");
......@@ -163,6 +164,11 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
public void onADClick() {//激励视频广告被点击
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
System.out.println("mcg ylh 点击");
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdDownload();
......
......@@ -18,16 +18,6 @@ public class AppConfig {
*/
public static float design_width = 750;
/**
* 立言广告SDK状态
*/
public static Boolean lyAdSdkInitState = false;
/**
* 立言广告 是否加载网络视频 true-加载
*/
public static Boolean lyAdSdkVedioState = true;
/**
* fragment tag 首页 0-赚钱大厅(主页) 1-挑战(任务赚) 2-游戏赚 3-我
*/
......@@ -53,10 +43,6 @@ public class AppConfig {
* 上一个播放的广告时间
*/
public static long preAdTime = 0;
/**
* ly 剩余广告播放数
*/
public static int lyAdCount = 5;
/**
* ylh 剩余广告播放数
*/
......
......@@ -5,10 +5,6 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import com.liyanmobi.soft.lycoin.LyAdInfo;
import com.mints.highgold.utils.SPUtil;
import java.io.File;
import java.util.ArrayList;
......@@ -68,66 +64,6 @@ public class AppListManager {
return packageList;
}
/**
* 获取筛选后的广告列表(用户拒绝授权)
*
* @param context
* @param spUtil
* @param userId
* @return
*/
public List<LyAdInfo> getAppAdListNew(Context context, List<LyAdInfo> lyAdList, int size, SPUtil spUtil, String userId) {
int appCount = 0;// 筛选后app数量
List<LyAdInfo> lyAdInfos = new ArrayList<>();
if (lyAdList != null && lyAdList.size() > 0) {
for (int i = 0; i < lyAdList.size(); i++) {
if (appCount == size) break;
LyAdInfo lyAdInfo = lyAdList.get(i);
String packagename = lyAdInfo.packagename;
if (!this.hasPackage(context, packagename) &&
TextUtils.isEmpty(spUtil.getString(lyAdInfo.packagename + userId + lyAdInfo.ad_type))) {
lyAdInfos.add(lyAdList.get(i));
appCount++;
}
}
}
return lyAdInfos;
}
/**
* 获取筛选后的广告列表(未拒绝权限)
*
* @param context
* @return
*/
public List<LyAdInfo> getAppAdList(Context context, List<LyAdInfo> lyAdList, int size) {
int appCount = 0;// 筛选后app数量
List<LyAdInfo> newAppAdList = new ArrayList<>();
List<String> packageList = this.getAppPackageNameList(context);
if (packageList != null && packageList.size() > 0 &&
lyAdList != null && lyAdList.size() > 0) {
// 查看广告列表是否包含在app内
for (int adPkgCount = 0; adPkgCount < lyAdList.size(); adPkgCount++) {
if (appCount == size) break;
for (int sysPkgCount = 0; sysPkgCount < packageList.size(); sysPkgCount++) {
if (TextUtils.equals(packageList.get(sysPkgCount), lyAdList.get(adPkgCount).packagename)) {
// 相同
break;
} else {
if (sysPkgCount == packageList.size() - 1) {
newAppAdList.add(lyAdList.get(adPkgCount));
appCount++;
}
}
}
}
}
return newAppAdList;
}
public List<String> getFilesAllName(String path) {
File file = new File(path);
File[] files = file.listFiles();
......
package com.mints.highgold.mvp.presenters;
import com.mints.highgold.manager.AppHttpManager;
import com.mints.highgold.mvp.views.MainView;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import com.mints.highgold.mvp.model.BaseResponse;
import com.liyanmobi.soft.lycoin.LyAdInfo;
import com.liyanmobi.soft.lycoin.LyAdType;
import com.liyanmobi.soft.lycoin.LyManager;
import rx.Observable;
/**
* 描述:Main
......@@ -19,93 +10,4 @@ import rx.Observable;
*/
public class MainPresenter extends BasePresenter<MainView> {
// public void getAllCode() {
// view.showLoading("加载中...");
//
// HashMap<String, Object> map = new HashMap<>();
// map.put("mobile","123");
//
// AppHttpManager.getInstance(loanApplication)
// .call(loanService.getDic(map),
// new BaseSubscriber<BaseResponse<JsonObject>>() {
// @Override
// public void onCompleted() {
// if (isLinkView()) return;
//
// view.hideLoading();
// }
//
// @Override
// public void onError(Throwable e) {
// if (isLinkView()) return;
//
// view.hideLoading();
// view.showToast(e.getMessage());
// }
//
// @Override
// public void onNext(BaseResponse<JsonObject> baseResponse) {
// if (isLinkView()) return;
//
// int code = baseResponse.getCode();
// JsonObject content = baseResponse.getContent();
// switch (code) {
// case 200://成功
// System.out.println("mcg"+content);
// break;
// }
// }
// });
// }
/**
* 获取游戏产品
*/
public void getGiftProductList() {
view.showLoading("加载中...");
subscription = AppHttpManager.getInstance(loanApplication)
.call(Observable.from(LyManager.getInstance().getAds(LyAdType.AD_TYPE_VIDEO)),new BaseSubscriber<BaseResponse<LyAdInfo>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<LyAdInfo> baseResponse) {
if (isLinkView()) return;
System.out.println("LyAdInfo"+baseResponse);
//获取广告列表
// List<LyAdInfo> lyAdInfos = ;
// int code = baseResponse.getCode();
// String msg = baseResponse.getMessage();
//
// switch (code) {
// case 200:
// GameBagBean content = baseResponse.getContent();
// if (content != null) {
// List<GameBagBean.ProductsBean> beanList = content.getProducts();
// if ( beanList!= null && beanList.size() > 0) {
//// view.getDataSuccess(beanList);
// }
// }
// break;
// default:
// view.showToast(msg);
// break;
// }
}
});
}
}
......@@ -285,6 +285,14 @@ public class HytechVedioActivity extends BaseActivity
}
}
@Override
public void onBackPressed() {
if (jzvdStd.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
......@@ -313,7 +321,8 @@ public class HytechVedioActivity extends BaseActivity
try {
if (jzvdStd != null) {
jzvdStd.goOnPlayOnPause();
jzvdStd.releaseAllVideos();
jzvdStd.removeAllViews();
jzvdStd = null;
}
} catch (Exception e) {
......@@ -331,7 +340,6 @@ public class HytechVedioActivity extends BaseActivity
// }
hytechVedioPresenter.dispose();
hytechVedioPresenter.detachView();
}
......
......@@ -16,11 +16,6 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.liyanmobi.soft.lycoin.LyAdInfo;
import com.liyanmobi.soft.lycoin.LyAdType;
import com.liyanmobi.soft.lycoin.LyManager;
import com.liyanmobi.soft.lycoin.LyTaskInfo;
import com.liyanmobi.soft.lycoin.LyTaskType;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.R;
import com.mints.highgold.common.AppConfig;
......@@ -97,7 +92,6 @@ public class LoginActivity extends BaseActivity implements LoginView {
private String imgCodeIdStr = "";// 图形验证码id
private CountDownTimerSupport mTimer;//定时器
private LyAdInfo lyAdInfo;
private String mobile;
private String userId;
......@@ -443,192 +437,6 @@ public class LoginActivity extends BaseActivity implements LoginView {
tvLoginCode.postDelayed(run, 1000);
}
private void tryVedio() {
// 防止不显示画面就播放声音问题
JzvdStd.goOnPlayOnPause();
if (!AppConfig.lyAdSdkInitState) {
flLoginVedio.setVisibility(View.GONE);
return;
}
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
// 获取
LyAdManager.getInstance().setLyAdVedioInfo(getAdVedioInfo());
}
@Override
public void doInUIThread() {
lyAdInfo = LyAdManager.getInstance().getLyAdVedioInfo();
if (lyAdInfo != null) {
flLoginVedio.setVisibility(View.VISIBLE);
loginJzVideo.setUp(lyAdInfo.video_url, "");
loginJzVideo.startVideo();
loginJzVideo.setJzVedioStatusListener(new JZVideoPlayerStandardLoopVideo.JZVedioStatusListener() {
@Override
public void jzVedioPlaying() {
// 防止倒计时重复调用
if (tvLoginTime != null && tvLoginTime.getVisibility() != View.GONE) {
startTime();
}
}
});
}
}
});
}
private void startTime() {
if (mTimer == null && tvLoginTime != null && tvLoginTime.getVisibility() != View.GONE) {
if (lyAdInfo != null) {
this.cmtLyOnPlay(lyAdInfo);
}
long millisInFuture = Long.parseLong("15000");
long countDownInterval = Long.parseLong("1000");
mTimer = new CountDownTimerSupport(millisInFuture, countDownInterval);
mTimer.setOnCountDownTimerListener(new OnCountDownTimerListener() {
@Override
public void onTick(long millisUntilFinished) {
long second = millisUntilFinished / 1000;
if (second == 10) {
cmtLyDisplay(lyAdInfo);
}
tvLoginTime.setText(second + "s");
}
@Override
public void onFinish() {
spUtil.putString(lyAdInfo.sub_title + userId + lyAdInfo.ad_type, "true");
tvLoginTime.setVisibility(View.GONE);
if (mTimer != null) {
mTimer.stop();
mTimer = null;
}
RxjavaUtil.executeRxTask(new CommonRxTask<String>("aaaa") {
@Override
public void doInIOThread() {
boolean isLyFlag = false;
int lyVedioCount = 0;//已完成的任务 0
List<LyTaskInfo> lyTaskInfos = LyManager.getInstance().getTasks(LyTaskType.TYPE_VIDEO, userId);
LyTaskInfo noneLyTaskInfo = null;
if (lyTaskInfos != null && lyTaskInfos.size() > 0) {
for (int i = 0; i < lyTaskInfos.size(); i++) {
LyTaskInfo lyTaskInfo = lyTaskInfos.get(i);
if (lyTaskInfo.task_status == 1) {
lyVedioCount++;
} else {
noneLyTaskInfo = lyTaskInfo;
}
}
}
if (noneLyTaskInfo != null) {
int lySumCount = spUtil.getInt(Constant.LOAN_LY_COUNT);//首页任务总量
if (lySumCount != -1) {
int lyNoneCount = 9 - lySumCount;//剩余要完成的任务 1
if (lyVedioCount < lyNoneCount) {
// 可以完成的= 已完成的任务< 剩余要完成的任务
LyManager.getInstance().submitTask(noneLyTaskInfo, userId);
isLyFlag = true;
}
}
}
setT(String.valueOf(isLyFlag));
}
@Override
public void doInUIThread() {
// String flag = getT();
// if (TextUtils.equals(flag, "true")) {
//// flLoginVedio.setVisibility(View.GONE);
// } else {
// flLoginVedio.setVisibility(View.VISIBLE);
// }
}
});
}
});
}
mTimer.start();
}
/**
* 获取筛选后的观看视频报文
*
* @return
*/
private LyAdInfo getAdVedioInfo() {
List<LyAdInfo> adVedioList = LyManager.getInstance().getAds(LyAdType.AD_TYPE_VIDEO);
LyAdInfo lyAdInfo = null;
if (adVedioList != null) {
// 1、获取视频h5广告
for (int i = 0; i < adVedioList.size(); i++) {
if (adVedioList.get(i).ad_sub_type == LyAdType.AD_SUB_TYPE_APP &&
!AppListManager.getInstance().hasPackage(getContext(), adVedioList.get(i).packagename) &&
TextUtils.isEmpty(spUtil.getString(adVedioList.get(i).sub_title + userId + adVedioList.get(i).ad_type))) {
lyAdInfo = adVedioList.get(i);
break;
}
}
}
return lyAdInfo;
}
/**
* 展示时上报
*
* @param lyAdInfo
*/
public void cmtLyDisplay(LyAdInfo lyAdInfo) {
String adLocalName = lyAdInfo.packagename + LyAdManager.AD_TYPE_DISPLAY + lyAdInfo.ad_type;
boolean adLocalFlag = ps.getBoolean(adLocalName, false);
if (!adLocalFlag) {
try {
LyManager.getInstance().onDisplay(lyAdInfo);
ps.putBoolean(adLocalName, true);
addStasticis(Constant.LY_H5_VIDEO, Constant.LY_VIEW, 1);
System.out.println("mcg --> cmtLyDisplay___" + lyAdInfo.packagename);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 视频广告播放上报
*
* @param lyAdInfo
*/
public void cmtLyOnPlay(LyAdInfo lyAdInfo) {
String adLocalName = lyAdInfo.packagename + LyAdManager.AD_TYPE_ONPLAY + lyAdInfo.ad_type;
boolean adLocalFlag = ps.getBoolean(adLocalName, false);
if (!adLocalFlag) {
try {
LyManager.getInstance().onPlay(lyAdInfo);
ps.putBoolean(adLocalName, true);
addStasticis(Constant.LY_H5_VIDEO, Constant.LY_VIDEO_PLAY, 1);
System.out.println("mcg --> cmtLyOnPlay___" + lyAdInfo.packagename);
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void addStasticis(String adType, String eventType, int num) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("pkg", Constant.MINTS_PKG_NAME);
......@@ -640,10 +448,4 @@ public class LoginActivity extends BaseActivity implements LoginView {
loginPresenter.addStasticis(vo);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
}
......@@ -182,6 +182,8 @@ public class WxLoginActivity extends BaseActivity implements WxLoginView, OnLogi
Manifest.permission.ACCESS_FINE_LOCATION)
.subscribe(granted -> {
if (granted) {
AmapLocationManager.getInstance().startLocation(mLocationHandler);
Platform wechat = ShareSDK.getPlatform(Wechat.NAME);
if (!wechat.isClientValid()) {
showToast("请先安装微信");
......
......@@ -9,7 +9,6 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.liyanmobi.soft.lycoin.LyAdInfo;
import com.mints.highgold.R;
import com.mints.library.utils.GlideUtils;
......@@ -23,11 +22,11 @@ import java.util.List;
*/
public class TryTaskAdapter extends BaseAdapter {
private List<LyAdInfo> orders;
private List<Object> orders;
private int downloandCoin;
private Context context;
public TryTaskAdapter(Context context, List<LyAdInfo> orders, int downloandCoin) {
public TryTaskAdapter(Context context, List<Object> orders, int downloandCoin) {
this.orders = orders;
this.context = context;
this.downloandCoin = downloandCoin;
......@@ -69,13 +68,6 @@ public class TryTaskAdapter extends BaseAdapter {
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
LyAdInfo data = orders.get(position);
if (data != null) {
GlideUtils.loadImageViewLoding(context, data.icon_url, viewHolder.ic_trytask, R.mipmap.ic_launcher, R.mipmap.ic_launcher);
viewHolder.tv_trytask_title.setText(data.sub_title);
viewHolder.tv_trytask_copies.setText(data.main_title);
viewHolder.tv_trytask_cash.setText(downloandCoin + "");
}
return convertView;
}
......
......@@ -478,28 +478,26 @@ public class MainFragment extends BaseFragment
// 设置随机广告权重
if (vedioAdingManager != null) {
vedioAdingManager.initAdWeight(data.getVedioplan_csj_vedio_rate(), data.getVedioplan_liyan_vedio_rate(), data.getVedioplan_lyh_vedio_rate(), data.getVedioplan_csj_full_screen_video_rate(), data.getVedioplan_hytech_vedio_rate());
// vedioAdingManager.initAdWeight(1, 0, 0, 0, 20);
vedioAdingManager.initAdWeight(data.getVedioplan_csj_vedio_rate(), data.getVedioplan_lyh_vedio_rate(), data.getVedioplan_csj_full_screen_video_rate(), data.getVedioplan_hytech_vedio_rate());
// vedioAdingManager.initAdWeight(0, 0, 0, 1);
}
System.out.println("mcg __ 首页权重值:csjVedioWeight:" + data.getVedioplan_csj_vedio_rate() + " lyWeight:" + data.getVedioplan_liyan_vedio_rate() + " ylhWeight:" + data.getVedioplan_lyh_vedio_rate() + " csjFullWeight:" + data.getVedioplan_csj_full_screen_video_rate() + " hytechVedioAdWeight:" + data.getVedioplan_hytech_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());
// 广告完成数
AppConfig.csjVedioAdCount = data.getVedioplan_csj_vedio_surplus();
AppConfig.lyAdCount = data.getVedioplan_liyan_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.csjVedioAdCount = 0;
// AppConfig.lyAdCount = 0;
// AppConfig.ylhAdCount = 0;
// AppConfig.csjFullAdCount = 0;
// AppConfig.hytechVedioAdCount = 10;
// AppConfig.hytechVedioAdCount = 20;
AppConfig.yilanVedioTime = data.getRedPacketSecond();
System.out.println("mcg __ 首页广告完成数:csjVedioAdCount:" + data.getVedioplan_csj_vedio_surplus() + " lyAdCount:" + data.getVedioplan_liyan_vedio_surplus() + " ylhAdCount:" + data.getVedioplan_lyh_vedio_surplus() + " csjFullAdCount:" + data.getVedioplan_csj_full_screen_video_surplus() + " hytechVedioAdCount:" + data.getVedioplan_hytech_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());
userManager.setAdShowFlag(data.isAdFlag());
......@@ -695,11 +693,6 @@ public class MainFragment extends BaseFragment
public void getUserTaskMsgFail() {
if (mainMainCrlRefresh != null)
mainMainCrlRefresh.finishRefresh(false);
AppConfig.csjVedioAdCount = 5;
AppConfig.csjFullAdCount = 5;
AppConfig.lyAdCount = 5;
AppConfig.ylhAdCount = 5;
userConfig = null;
}
......@@ -1245,9 +1238,9 @@ public class MainFragment extends BaseFragment
if (granted) {
getBaseApplication().initUm(getContext());
AmapLocationManager.getInstance().startLocation(mLocationHandler);
if (!AppConfig.lyAdSdkInitState) {
getBaseApplication().initGold(getBaseApplication().getApplicationContext());
}
// if (!AppConfig.lyAdSdkInitState) {
// getBaseApplication().initGold(getBaseApplication().getApplicationContext());
// }
} else {
showMissingPermissionDialog("设备、储存");
}
......
......@@ -5,13 +5,10 @@ import android.util.AttributeSet;
import android.view.View;
import cn.jzvd.JZDataSource;
import cn.jzvd.JZMediaSystem;
import cn.jzvd.JzvdStd;
public class JZVideoPlayerStandardLoopVideo extends JzvdStd {
JZMediaSystem jzMediaSystem = new JZMediaSystem(this);
private JZVedioStatusListener jzVedioStatusListener;
private boolean isVedioRestart = true;//true-重复播放视频
......
......@@ -107,7 +107,7 @@
android:id="@+id/iv_hytechvedio_back"
android:layout_width="50pt"
android:layout_height="50pt"
android:src="@mipmap/ic_drink_cancel"
android:src="@mipmap/ic_cancel"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
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