Commit 7c82de37 authored by mengcuiguang's avatar mengcuiguang

添加东方网,添加接口监听,代码优化

parent 30fcc72f
......@@ -10,8 +10,8 @@ android {
applicationId "com.mints.highgold"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 4
versionName "1.0.3"
versionCode 5
versionName "1.0.4"
flavorDimensions "default"
// dex突破65535的限制
......@@ -285,20 +285,23 @@ dependencies {
implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
// Mintegral 广告
// implementation 'com.mintegral.msdk:videojs:10.2.41'
// implementation 'com.mintegral.msdk:mtgjscommon:10.2.41'
// implementation 'com.mintegral.msdk:playercommon:10.2.41'
// implementation 'com.mintegral.msdk:reward:10.2.41'
// implementation 'com.mintegral.msdk:videocommon:10.2.41'
// implementation 'com.mintegral.msdk:optimizedata:10.2.41'
// implementation 'com.mintegral.msdk:common:10.2.41'
// implementation 'com.mintegral.msdk:alphab:10.2.41'
// implementation 'com.mintegral.msdk:mtgnative:10.2.41'
// implementation 'com.mintegral.msdk:nativeex:10.2.41'
// implementation 'com.mintegral.msdk:interstitial:10.2.41'
// implementation 'com.mintegral.msdk:interstitialvideo:10.2.41'
// // 开发者后台创建App勾选APK为YES则加上mtgdownloads依赖
// implementation 'com.mintegral.msdk:mtgdownloads:10.2.41'
implementation 'com.mintegral.msdk:videojs:10.2.41'
implementation 'com.mintegral.msdk:mtgjscommon:10.2.41'
implementation 'com.mintegral.msdk:playercommon:10.2.41'
implementation 'com.mintegral.msdk:reward:10.2.41'
implementation 'com.mintegral.msdk:videocommon:10.2.41'
implementation 'com.mintegral.msdk:optimizedata:10.2.41'
implementation 'com.mintegral.msdk:common:10.2.41'
implementation 'com.mintegral.msdk:alphab:10.2.41'
implementation 'com.mintegral.msdk:interstitial:10.2.41'
implementation 'com.mintegral.msdk:mtgbanner:10.2.41'
implementation 'com.mintegral.msdk:mtgnative:10.2.41'
implementation 'com.mintegral.msdk:nativeex:10.2.41'
implementation 'com.mintegral.msdk:interstitialvideo:10.2.41'
implementation 'com.mintegral.msdk:interactiveads:10.2.41'
// 开发者后台创建App勾选APK为YES则加上mtgdownloads依赖
implementation 'com.mintegral.msdk:mtgdownloads:10.2.41'
// 推啊广告
implementation('com.tuia:sdk:2.0.1.0') {
......
......@@ -396,52 +396,6 @@
# ======================= 猎豹游戏 END ================
# ===================== 愉悦推 START ================
# -dontwarn com.tencent.**
# #-- 微信sdk--
# -keep class com.tencent.** {
# *;
# }
# -keep class com.mdad.sdk.mduisdk.shouguan.** { *; }
# -keep class btmsdkobf.** { *; }
# -keep class com.tmsdk.** { *; }
# -keep class tmsdk.** { *; }
# -keep class mdbtmsdkobf.** { *; }
# -keep class com.mdtmsdk.** { *; }
# -keep class mdtmsdk.** { *; }
# -keep class android.support.v4.** { *; }
# -keep class android.support.v7.** { *; }
# -keep class com.mdad.sdk.mduisdk.AppInfo{ *; }
# ======================= 愉悦推 END ================
# ===================== 百度视频 START ================
#bdvsdk
-dontwarn com.baidu.video.**
-dontwarn com.xiaodutv.**
-keep class com.xiaodutv.bdvsdk.repackage.**
-keep class com.xiaodutv.libbdvsdk.SwipeActivity {
*;
}
-keep class com.xiaodutv.libbdvsdk.SwipeActivity$* {
*;
}
#bdvsdk:Baidu MTJ
-dontwarn com.baidu.mobstat.**
-keep class com.baidu.mobstat.** { *;}
-keep class * extends com.baidu.mobstat.**
-keep class com.baidu.kirin.** {*; }
-keep class com.baidu.bottom.** { *; }
# ======================= 百度视频 END ================
# ===================== 移动安全联盟 START ================
......@@ -449,20 +403,43 @@
# ======================= 移动安全联盟 END ================
# ===================== 一览视频 START ================
-keep class com.yilan.sdk.**{
*;
}
-dontwarn sun.misc.Unsafe
-dontwarn org.conscrypt.*
###阿里云混淆
-keep class com.alibaba.sdk.android.**{*;}
-keep class com.ut.**{*;}
-keep class com.ta.**{*;}
# ======================= 一览视频 END ================
# ===================== 推啊AD START ================
-dontwarn com.lechuan.midunovel.**
-keep class com.lechuan.midunovel.** { *; }
# ======================= 推啊AD END ================
# ===================== Mintegral START ================
-keep class com.mintegral.** {*; }
-keep interface com.mintegral.** {*; }
-keep class android.support.v4.** { *; }
-dontwarn com.mintegral.**
-keep class **.R$* { public static final int mintegral*; }
-keep class com.alphab.** {*; }
-keep interface com.alphab.** {*; }
# ======================= Mintegral END ================
......@@ -255,6 +255,40 @@
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
android:authorities="${applicationId}.TTMultiProvider"
android:exported="false" />
<!-- Mintegral广告 -->
<activity
android:name="com.mintegral.msdk.activity.MTGCommonActivity"
android:configChanges="keyboard|orientation"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<activity
android:name="com.mintegral.msdk.reward.player.MTGRewardVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="false"
android:theme="@style/mintegral_transparent_theme" />
<receiver android:name="com.mintegral.msdk.click.AppReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<service android:name="com.mintegral.msdk.shell.MTGService" >
<intent-filter>
<action android:name="com.mintegral.msdk.download.action" />
</intent-filter>
</service>
<provider
android:name="com.mintegral.msdk.base.utils.MTGFileProvider"
android:authorities="${applicationId}.mtgFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>
\ No newline at end of file
......@@ -17,6 +17,8 @@ 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;
......@@ -46,6 +48,8 @@ import com.yilan.sdk.ui.configs.CommentConfig;
import com.yilan.sdk.ui.configs.FeedConfig;
import com.yilan.sdk.ui.configs.YLUIConfig;
import java.util.Map;
import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import rx.Scheduler;
......@@ -205,6 +209,9 @@ public class MintsApplication extends MultiDexApplication {
// 推啊广告
initTuia();
// Mintegral广告
// initMintegral();
}
/**
......@@ -400,6 +407,14 @@ public class MintsApplication extends MultiDexApplication {
FoxSDK.init(this);
}
/**
* Mintegral广告
*/
private void initMintegral() {
MIntegralSDK sdk = MIntegralSDKFactory.getMIntegralSDK();
Map<String, String> map = sdk.getMTGConfigurationMap("128085", "658c1f4f75c448adb7d612694bde1a7d");
sdk.init(map, this);
}
/**
* app退出
......
......@@ -13,6 +13,7 @@ import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TTNativeExpressManager;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.mvp.presenters.CsjFullVedioAdPresenter;
import com.mints.highgold.mvp.views.LyVedioAdManagerView;
import com.mints.highgold.ui.widgets.LoadingDialog;
......@@ -121,6 +122,7 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
@Override
public void onError(int code, String message) {
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdFail();
......@@ -135,11 +137,15 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdShow() {
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ZERO, "", "");
}
@Override
public void onAdVideoBarClick() {
// System.out.println("mcg __ csjfull onAdVideoBarClick");
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_TWO, "", "");
isClickRunDownload = true;
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioDownload();
......@@ -148,6 +154,8 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_THREE, "", "");
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdSuccess();
}
......@@ -177,6 +185,7 @@ public class CsjFullVedioAdManager implements LyVedioAdManagerView {
mttFullVideoAd = null;
} else {
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdFail();
......
......@@ -15,6 +15,7 @@ import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TTNativeExpressManager;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.presenters.CsjVedioAdPresenter;
import com.mints.highgold.mvp.views.LyVedioAdManagerView;
......@@ -162,6 +163,9 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
public void onError(int code, String message) {
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
}
......@@ -178,6 +182,7 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
mttRewardVideoAd = null;
} else {
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
......@@ -194,6 +199,7 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdShow() {//视频广告展示回调
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ZERO, "", "");
// if (csjVedioAdListener != null) {
// csjVedioAdListener.csjVedioAdSuccess();
......@@ -203,6 +209,8 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdVideoBarClick() {//广告的下载bar点击回调
isClickRunDownload = true;
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_TWO, "", "");
// 内容是H5连接 点击后也给金币
try {
if (mttRewardVideoAd.getInteractionType() == 3) {
......@@ -221,6 +229,8 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
@Override
public void onAdClose() {//视频广告关闭回调
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", "");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdSuccess();
}
......@@ -234,6 +244,7 @@ public class CsjVedioAdManager implements LyVedioAdManagerView {
@Override
public void onVideoError() {//视频广告播完验证奖励有效性回调,参数分别为是否有效,奖励数量,奖励名称
// hideLoading();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "VideoError");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
......
......@@ -7,6 +7,7 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.common.DeviceInfo;
......@@ -17,8 +18,7 @@ import com.mints.highgold.mvp.model.HytechClientReq;
import com.mints.highgold.mvp.model.HytechDeviceReq;
import com.mints.highgold.mvp.model.HytechMediaReq;
import com.mints.highgold.mvp.model.HytechNetworkReq;
import com.mints.highgold.mvp.model.HytechVedioReq;
import com.mints.highgold.mvp.model.HytechVedioRsp;
import com.mints.highgold.mvp.model.HytechVedioAdRsp;
import com.mints.highgold.mvp.presenters.HytechVedioAdPresenter;
import com.mints.highgold.mvp.views.HytechVedioAdManagerView;
import com.mints.highgold.ui.activitys.HytechVedioActivity;
......@@ -26,10 +26,11 @@ import com.mints.highgold.ui.widgets.LoadingDialog;
import com.mints.highgold.utils.ToastUtil;
import com.mints.library.net.netstatus.NetUtils;
import com.mints.library.utils.ConstantUtil;
import com.mints.library.utils.json.JsonUtil;
import java.util.HashMap;
/**
* Hytech视频
* Hytech 东方网视频
*/
public class HytechVedioAdManager implements HytechVedioAdManagerView {
......@@ -85,12 +86,11 @@ public class HytechVedioAdManager implements HytechVedioAdManagerView {
this.curCoin = curCoin;
this.extraId = extraId;
System.out.println("mcg __ loanHytechAd:" + getHytechParam());
hytechVedioAdPresenter.getAdVedio(getHytechParam());
}
@Override
public void hytechSuc(HytechVedioRsp data) {
public void hytechSuc(HytechVedioAdRsp data) {
if (hytechVedioAdListener != null) {
hytechVedioAdListener.hytechVedioAdSuccess();
}
......@@ -99,14 +99,13 @@ public class HytechVedioAdManager implements HytechVedioAdManagerView {
bundle.putString(Constant.TRY_VEDIO_COIN, curCoin + "");
bundle.putString(Constant.TRY_TASK_H5DOWNLOADCOIN, downloadCoin + "");
bundle.putString(Constant.TRY_CARRIER, carrierType);
bundle.putInt(Constant.MAIN_CUR_COIN, curCoin);
bundle.putString(Constant.MAIN_EXTRA_ID, extraId);
bundle.putSerializable(Constant.HYTECH_DATA, data);
readyGo(HytechVedioActivity.class, bundle);
}
@Override
public void hytechFail() {
public void hytechFail(int code) {
if (hytechVedioAdListener != null) {
hytechVedioAdListener.hytechVedioAdFail();
}
......@@ -117,24 +116,28 @@ public class HytechVedioAdManager implements HytechVedioAdManagerView {
*
* @return
*/
private String getHytechParam() {
HytechVedioReq vedioReq = new HytechVedioReq();
vedioReq.setMedia(getMediaReq());
vedioReq.setDevice(getDeviceReq());
vedioReq.setNetwork(getNetworkReq());
vedioReq.setClient(getClientReq());
vedioReq.setAdslot(getAdslotReq());
return JsonUtil.toJson(vedioReq);
private HashMap<String, Object> getHytechParam() {
HashMap<String, Object> vo = new HashMap<>();
vo.put("media", getMediaReq());
vo.put("device", getDeviceReq());
vo.put("network", getNetworkReq());
vo.put("client", getClientReq());
vo.put("adslot", getAdslotReq());
return vo;
}
private HytechAdslotReq getAdslotReq() {
HytechAdslotReq adslotReq = new HytechAdslotReq();
adslotReq.setId("7268884");
if (BuildConfig.DEBUG) {
adslotReq.setId("7268884");//7268884-测试id
} else {
adslotReq.setId("7270307");//7270307-正式id
}
adslotReq.setType(1);
String[] densityInfo = deviceInfo.getDensityInfo();
adslotReq.setWidth(Integer.valueOf(densityInfo[0]));
adslotReq.setHeight(Integer.valueOf(densityInfo[1]));
return null;
return adslotReq;
}
private HytechClientReq getClientReq() {
......@@ -171,9 +174,20 @@ public class HytechVedioAdManager implements HytechVedioAdManagerView {
private HytechDeviceReq getDeviceReq() {
HytechDeviceReq deviceReq = new HytechDeviceReq();
deviceReq.setId_imei(deviceInfo.getIMEI());
try {
deviceReq.setId_imei(deviceInfo.getIMEI());
} catch (Exception e) {
e.printStackTrace();
deviceReq.setId_imei("");
}
try {
deviceReq.setId_imsi(deviceInfo.getIMSI());
} catch (Exception e) {
e.printStackTrace();
deviceReq.setId_imsi("");
}
deviceReq.setId_oaid(MintsApplication.getOaid());
deviceReq.setId_imsi(deviceInfo.getIMSI());
deviceReq.setId_androidid(deviceInfo.getAndroidId());
deviceReq.setId_mac(deviceInfo.getMacAddress(activity));
String[] densityInfo = deviceInfo.getDensityInfo();
......@@ -191,9 +205,6 @@ public class HytechVedioAdManager implements HytechVedioAdManagerView {
appReq.setPackage_name(Constant.MINTS_PKG_NAME);
appReq.setApp_version(ConstantUtil.getVersionName(activity));
// HytechSiteReq siteReq = new HytechSiteReq();
// siteReq.setDomain(NetUtils.getDomain(BuildConfig.MainIp));
HytechBrowserReq browserReq = new HytechBrowserReq();
browserReq.setUser_agent(deviceInfo.getUserAgent());
......
......@@ -8,6 +8,7 @@ import android.view.KeyEvent;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.manager.YlhAdManager;
import com.mints.highgold.mvp.presenters.YlhVedioAdPresenter;
import com.mints.highgold.mvp.views.LyVedioAdManagerView;
......@@ -121,6 +122,7 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
}
} catch (Exception e) {
e.printStackTrace();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, "999999", "Load Fail");
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail();
......@@ -136,6 +138,7 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
@Override
public void onADShow() {//激励视频广告页面展示,此后RewardVideoAD.hasShown()返回true
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ZERO, "", "");
}
......@@ -158,6 +161,8 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
@Override
public void onADClick() {//激励视频广告被点击
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_TWO, "", "");
System.out.println("mcg ylh 点击");
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdDownload();
......@@ -171,13 +176,17 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
@Override
public void onADClose() {//激励视频广告被关闭
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_THREE, "", "");
}
@Override
public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述
// hideLoading();
if (adError != null) {
// 0 成功 1失败 2点击 3-有效展示
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, String.valueOf(adError.getErrorCode()), adError.getErrorMsg());
}
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail();
}
......
......@@ -69,6 +69,14 @@ public class AppConfig {
* csjVedio 剩余广告播放数
*/
public static int csjVedioAdCount = 5;
/**
* mintegralVedio 剩余广告播放数
*/
public static int mintegralAdCount = 5;
/**
* hytechVedio 剩余广告播放数
*/
public static int hytechVedioAdCount = 5;
/**
* 一览视频 时间间隔 单位-秒
......
......@@ -146,8 +146,10 @@ public interface Constant {
String LY_VEDIO_AD = "LY_VEDIO_AD";
String CSJ_FULL_AD = "CSJ_FULL_AD";
String CSJ_VEDIO_AD = "CSJ_VEDIO_AD";
String YLH_VEDIO_AD= "YLH_VEDIO_AD";
String YILAN_VEDIO_AD= "YILAN_VEDIO_AD";
String YLH_VEDIO_AD = "YLH_VEDIO_AD";
String YILAN_VEDIO_AD = "YILAN_VEDIO_AD";
String HYTECH_VEDIO_AD = "HYTECH_VEDIO_AD";
String MINTEGRAL_VEDIO_AD = "MINTEGRAL_VEDIO_AD";
// 插屏广告类型
String CSJ_INTERACTION_AD = "CSJ_INTERACTION_AD";
......@@ -212,6 +214,9 @@ public interface Constant {
String AD_SOURCE_LY = "LIYAN";
String AD_SOURCE_CSJ = "CSJ";
String AD_SOURCE_YLH = "YLH";
String AD_SOURCE_CSJFULL = "CSJFULL";
String AD_SOURCE_MINTEGRAL = "MINTEGRAL";
String AD_SOURCE_HYTECH = "HYTECH";//东方网
// 页面
int PAGE_ONE = 1;
......@@ -279,4 +284,11 @@ public interface Constant {
// 穿山甲激励视频id
String CSJ_VEDIO_APPIP = "csj_vedio_appip";
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
String EVENT_TYPE_ZERO = "0";
String EVENT_TYPE_ONE = "1";
String EVENT_TYPE_TWO = "2";
String EVENT_TYPE_THREE = "3";
String EVENT_TYPE_FOUR = "4";
}
\ No newline at end of file
package com.mints.highgold.manager;
/**
* Mintegral视频
*/
public class MintegralManager {
/*激励视频*/
public static final String MINTEGRAL_AD_VEDIO_MOREDIALOG = "194665";// 高额版_Android_喝水_0422 签到、气泡、离线弹框
/*激励视频 UNITID*/
public static final String MINTEGRAL_AD_VEDIO_MOREDIALOG_UNITID = "249880";// 高额版_Android_喝水_0422 签到、气泡、离线弹框
}
......@@ -44,4 +44,13 @@ public class TrackManager {
trackPresenter.offline();
}
}
/**
* 广告事件
*/
public void addCallImp(String adSource, String eventType, String errorcode, String errormsg) {
if (trackPresenter != null) {
trackPresenter.addCallImp(adSource, eventType, errorcode, errormsg);
}
}
}
......@@ -11,6 +11,7 @@ import java.util.ArrayList;
*/
public class HytechVideoSnippetRsp implements Serializable {
private String ext_video_tag_title;//视频标题
private String title;//视频标题
private String logo_url;//视频封面图片地址
private String url;//视频地址
......@@ -44,6 +45,10 @@ public class HytechVideoSnippetRsp implements Serializable {
}
}
public String getExt_video_tag_title() {
return ext_video_tag_title;
}
public String getTitle() {
return title;
}
......
......@@ -69,10 +69,20 @@ public class UserTaskMsgBean implements Serializable {
private int vedioplan_csj_full_screen_video_rate;
private int vedioplan_lyh_vedio_rate;
private int vedioplan_liyan_vedio_rate;
private int vedioplan_hytech_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;
public int getVedioplan_hytech_vedio_rate() {
return vedioplan_hytech_vedio_rate;
}
public int getVedioplan_hytech_vedio_surplus() {
return vedioplan_hytech_vedio_surplus;
}
private String loanUrl;
private String appIp;// 穿山甲激励视频时传入
......
package com.mints.highgold.mvp.presenters;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.TrackManager;
import com.mints.highgold.mvp.model.BaseResponse;
import com.mints.highgold.mvp.model.HytechVedioAdRsp;
import com.mints.highgold.mvp.model.HytechVedioRsp;
import com.mints.highgold.mvp.views.HytechVedioAdManagerView;
import com.mints.highgold.net.HytechService;
......@@ -9,6 +12,7 @@ import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
......@@ -16,43 +20,67 @@ public class HytechVedioAdPresenter extends BasePresenter<HytechVedioAdManagerVi
private Subscription subscription;
public void getAdVedio(String adParam) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("", adParam);
public void getAdVedio(HashMap<String, Object> vo) {
HytechService hytechService = HytechService.Factory.create();
// loanApplication = (MintsApplication) activity.getApplication();
subscription = hytechService.getAdVedio(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<HytechVedioRsp>>() {
.subscribe(new Subscriber<HytechVedioAdRsp>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
public void onError(java.lang.Throwable e) {
if (isLinkView()) return;
// if (NetCommon.httpErrorCode(e) == 400) {
//
// try {
// if (e instanceof retrofit2.adapter.rxjava.HttpException) {
// retrofit2.adapter.rxjava.HttpException httpException = (retrofit2.adapter.rxjava.HttpException) e;
// // retrofit2.adapter.rxjava.HttpException: HTTP 400 Bad Request
// String s = httpException.response().errorBody().string();
// view.showToast(s);
// }
// } catch (Exception e2) {
// e2.printStackTrace();
// }
view.hytechFail();
try {
if (e instanceof retrofit2.adapter.rxjava.HttpException) {
retrofit2.adapter.rxjava.HttpException httpException = (retrofit2.adapter.rxjava.HttpException) e;
// retrofit2.adapter.rxjava.HttpException: HTTP 400 Bad Request
String s = httpException.response().errorBody().string();
// view.showToast(s);
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_ONE, String.valueOf(httpException.code()), s);
}
} catch (Exception e2) {
e2.printStackTrace();
}
view.hytechFail(403);
}
@Override
public void onNext(BaseResponse<HytechVedioRsp> baseResponse) {
public void onNext(HytechVedioAdRsp baseResponse) {
if (isLinkView()) return;
HytechVedioRsp data = baseResponse.getData();
if (data != null) {
if (data.isSuccess()) {
view.hytechSuc(data);
try {
HytechVedioAdRsp data = baseResponse;
if (data != null) {
if (data.isSuccess()) {
view.hytechSuc(data);
} else {
view.hytechFail(0);
}
} else {
view.hytechFail();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_HYTECH, Constant.EVENT_TYPE_ONE, "204", "没有广告返回");
view.hytechFail(204);
}
} catch (Exception e) {
e.printStackTrace();
view.hytechFail(500);
}
}
});
......
package com.mints.highgold.mvp.presenters;
import android.text.TextUtils;
import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.AppHttpManager;
import com.mints.highgold.mvp.model.AlipayBindBean;
import com.mints.highgold.mvp.model.BaseResponse;
import com.mints.highgold.mvp.views.HytechVedioView;
import com.mints.highgold.net.HytechService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class HytechVedioPresenter extends BasePresenter<HytechVedioView> {
public void getPayAccoutMsg() {
view.showLoading("加载中...");
private Subscription subscription;
private HytechService hytechService;
/**
* 通用接口
*/
public void reportAddCoinMsg(String tryCarrier, HashMap<String, Object> vo) {
Observable<BaseResponse<Object>> observable;
if (TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_DOWNLOAD) || TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_VIDEO)) {
// 每日任务
observable = loanService.reportTaskMsgV1(vo);
} else {
// 挑战
observable = loanService.reportAddCoinMsg(vo);
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.getPayAccoutMsg(),
new BaseSubscriber<BaseResponse<AlipayBindBean>>() {
.call(observable,
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
if (isLinkView()) return;
}
});
}
/**
* 下载接口
*/
public void reportDownloadTask(String tryCarrier, HashMap<String, Object> vo) {
Observable<BaseResponse<Object>> observable;
if (TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_DOWNLOAD) || TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_VIDEO)) {
// 每日任务
observable = loanService.reportTaskMsgV1(vo);
} else {
// 挑战
observable = loanService.reportAddCoinMsg(vo);
}
AppHttpManager.getInstance(loanApplication)
.call(observable,
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<AlipayBindBean> baseResponse) {
public void onError(Throwable e) {
if (isLinkView()) return;
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
break;
default:
view.showToast(message);
view.reportDownloadTask();
break;
}
}
});
}
public void createHytechCmtAdService() {
hytechService = HytechService.Factory.create();
}
/**
* 提交广告监测
*/
public void cmtHytechImp(String url) {
if (hytechService == null) {
hytechService = HytechService.Factory.create();
}
subscription = hytechService.cmtHytechImp(url)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new Subscriber<Object>() {
@Override
public void onCompleted() {
}
@Override
public void onError(java.lang.Throwable e) {
}
@Override
public void onNext(Object baseResponse) {
}
});
}
public void dispose() {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
hytechService = null;
}
}
......@@ -274,51 +274,6 @@ public class LoanPresenter extends BasePresenter<LoanView> {
}
/**
* 检验立言任务是否重复
*/
public void checkLYContext(String context) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("context", context);
AppHttpManager.getInstance(loanApplication)
.call(loanService.checkLYContext(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
view.checkLYContextSuc(true);
break;
case 611://重复
view.checkLYContextSuc(false);
break;
default:
view.showToast(message);
view.hideLoading();
break;
}
}
});
}
/**
* 穿山甲回调确认
*/
......
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.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 MintegralVedioAdPresenter extends BasePresenter<MintegralVedioAdManagerView> {
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();
}
......
......@@ -5,6 +5,8 @@ import com.mints.highgold.mvp.model.BaseResponse;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
public class TrackPresenter extends BaseTrackPresenter {
/**
......@@ -28,4 +30,34 @@ public class TrackPresenter extends BaseTrackPresenter {
}
});
}
/**
* 广告事件
* <p>
* eventType-0 成功 1失败 2点击 3-有效展示
*/
public void addCallImp(String adSource, String eventType, String errorcode, String errormsg) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adSource", adSource);
vo.put("eventType", eventType);
vo.put("errorCode", errorcode);
vo.put("errorMsg", errormsg);
AppHttpManager.getInstance(loanApplication)
.call(loanService.addCallImp(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
}
package com.mints.highgold.mvp.views;
import com.mints.highgold.mvp.model.HytechVedioAdRsp;
import com.mints.highgold.mvp.model.HytechVedioRsp;
public interface HytechVedioAdManagerView extends BaseView {
void hytechSuc(HytechVedioRsp data);
void hytechSuc(HytechVedioAdRsp data);
void hytechFail();
/**
*
* @param code 204无广告
*/
void hytechFail(int code);
}
......@@ -2,4 +2,5 @@ package com.mints.highgold.mvp.views;
public interface HytechVedioView extends BaseView {
void reportDownloadTask();
}
......@@ -24,13 +24,6 @@ public interface LoanView extends BaseView {
*/
void reportTaskMsgV1Suc(String carrierType);
/**
* 检验立言任务是否重复
*
* @param lyCmtFlag true-可以给用户显示
*/
void checkLYContextSuc(boolean lyCmtFlag);
/**
* 穿山甲回调确认
*/
......
package com.mints.highgold.net;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okio.Buffer;
import retrofit2.Converter;
import retrofit2.Retrofit;
/**
* 广告 gson
*/
public class AdGsonConverterFactory extends Converter.Factory {
private final Gson gson;
public static AdGsonConverterFactory create() {
return create(new Gson());
}
public static AdGsonConverterFactory create(Gson gson) {
return new AdGsonConverterFactory(gson);
}
private AdGsonConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
return new GsonResponseBodyConverter<>(gson, type);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type,
Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return new GsonRequestBodyConverter<>(gson, type);
}
// 这里创建从ResponseBody其它类型的Converter
// 主要用于对响应体的处理
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
GsonResponseBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public T convert(ResponseBody value) throws IOException {
Reader reader = value.charStream();
try {
T t = gson.fromJson(reader, type);
// loginInvalid(t);
return t;
} finally {
try {
if (reader != null)
reader.close();
} catch (IOException ignored) {
ignored.printStackTrace();
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
// 主要用于对Part、PartMap、Body注解的处理
final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
private final Charset UTF_8 = Charset.forName("UTF-8");
private final Gson gson;
private final Type type;
GsonRequestBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
gson.toJson(value, type, writer);
writer.flush();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
}
......@@ -4,8 +4,7 @@ package com.mints.highgold.net;
import android.text.TextUtils;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.mvp.model.BaseResponse;
import com.mints.highgold.mvp.model.HytechVedioRsp;
import com.mints.highgold.mvp.model.HytechVedioAdRsp;
import com.orhanobut.logger.Logger;
import java.util.Map;
......@@ -16,34 +15,38 @@ import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Url;
import rx.Observable;
/**
* 描述:Hytech 服务器交互
* 描述:Hytech 东方网 服务器交互
* 作者:孟崔广
* 时间:2020/4/7 11:14
*/
public interface HytechService {
String HYTECH_MAIN_IP = "https://api.hyrainbow.com/";//生产
String HYTECH_DEBUG_IP = "https://api.hyrainbow.com/";//测试
/**
* 获取验证码
* 请求广告
*
* @return
*/
@POST("api/v1")
Observable<BaseResponse<HytechVedioRsp>> getAdVedio(@Body Map<String, Object> vo);
Observable<HytechVedioAdRsp> getAdVedio(@Body Map<String, Object> vo);
/**
* 提交监测
*
* @return
*/
@GET
Observable<Object> cmtHytechImp(@Url String url);
class Factory {
public static HytechService create() {
String ipUrl = HYTECH_MAIN_IP;
if (BuildConfig.DEBUG) {
ipUrl = HYTECH_DEBUG_IP;
}
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.retryOnConnectionFailure(false);
......@@ -68,10 +71,16 @@ public interface HytechService {
builder.interceptors().add(logging);
}
// if (BuildConfig.DEBUG) {
// HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
// logging.setLevel(HttpLoggingInterceptor.Level.BODY);
// builder.interceptors().add(logging);
// }
Retrofit retrofit = new Retrofit.Builder()
.client(builder.build())
.baseUrl(ipUrl)
.addConverterFactory(HytechGsonConverterFactory.create())
.baseUrl(HYTECH_MAIN_IP)
.addConverterFactory(AdGsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
......
......@@ -436,6 +436,15 @@ public interface LoanService {
@POST("api/v127/addCoinMsgAndGetRes")
Observable<BaseResponse<JsonObject>> addCoinMsgAndGetRes(@Body Map<String, Object> vo);
/**
* 调用事件
*
* @return
*/
@POST("stasticis/adCall/add")
Observable<BaseResponse<Object>> addCallImp(@Body Map<String, Object> vo);
/**
* 默认http工厂
*/
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#90ffffff" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="14dip" />
</shape>
\ No newline at end of file
......@@ -4,28 +4,110 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mints.highgold.ui.activitys.HytechVedioActivity">
android:background="@color/black"
tools:context=".ui.activitys.HytechVedioActivity">
<ImageView
android:id="@+id/iv_hytechvideo_root"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.mints.highgold.ui.widgets.JZVideoPlayerStandardLoopVideo
android:id="@+id/jz_hytechvideo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tv_hytechvedio_time"
android:layout_width="50pt"
android:layout_height="50pt"
android:layout_alignParentRight="true"
android:layout_marginTop="70pt"
android:layout_marginRight="40pt"
android:background="@drawable/shape_loading_bg"
android:textColor="@color/white"
android:textSize="14sp" />
<FrameLayout
android:id="@+id/fl_hytechvedio_touch"
android:background="@color/full_transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:background="@color/full_transparent">
<LinearLayout
android:id="@+id/ll_hytechvedio_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="30pt"
android:layout_marginRight="30pt"
android:layout_marginBottom="100pt"
android:background="@drawable/shape_vedio_white"
android:orientation="horizontal"
android:paddingLeft="30pt"
android:paddingTop="30pt"
android:paddingRight="40pt"
android:paddingBottom="30pt"
android:visibility="invisible">
<com.shehuan.niv.NiceImageView
android:id="@+id/ic_hytechvideo"
android:layout_width="110pt"
android:layout_height="110pt"
android:src="@mipmap/ic_launcher"
app:corner_radius="10dp" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10pt"
android:layout_marginRight="10pt"
android:layout_weight="1"
android:paddingLeft="10pt">
<TextView
android:id="@+id/tv_hytechvideo_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="6pt"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_hytechvideo_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_hytechvideo_title"
android:textColor="@color/loan_tv_choose_paycash_text"
android:textSize="10sp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_hytechvideo_next"
android:layout_width="78dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_tv_gold"
android:gravity="center"
android:text="查看"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="70pt"
android:layout_marginRight="40pt">
<TextView
android:id="@+id/tv_hytechvedio_time"
android:layout_width="50pt"
android:layout_height="50pt"
android:background="@drawable/shape_back"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:id="@+id/iv_hytechvedio_back"
android:layout_width="50pt"
android:layout_height="50pt"
android:src="@mipmap/ic_drink_cancel"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -1266,6 +1266,7 @@
android:visibility="gone" />
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_versus_tryplay"
android:layout_width="match_parent"
android:layout_height="160pt"
......@@ -1361,6 +1362,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:id="@+id/view_versus_tryplay"
android:layout_width="match_parent"
android:layout_height="1pt"
......
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