Commit 0597cb5d authored by mengcuiguang's avatar mengcuiguang

代码优化

parents b1f4adc7 331e2978
......@@ -9,8 +9,8 @@ android {
applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 14
versionName "1.1.3"
versionCode 15
versionName "1.1.4"
flavorDimensions "default"
// dex突破65535的限制
......@@ -32,7 +32,8 @@ android {
JPUSH_CHANNEL : "goodmoney",
UMENG_KEY : RELEASE_UMENG_KEY,
SHARE_KEY : RELEASE_SHARESDK_KEY,
SHARE_SECRET : RELEASE_SHARESDK_SECRET]
SHARE_SECRET : RELEASE_SHARESDK_SECRET,
"APPLICATION_ID" : applicationId]
}
......@@ -181,13 +182,10 @@ dependencies {
// 圆角库
implementation 'com.github.SheHuan:NiceImageView:1.0.5'
// 工具类
// gson
implementation 'com.google.code.gson:gson:2.8.1'
// BASE64Decoder
// implementation files('libs/sun.misc.BASE64Decoder.jar')
// BASE64Decoder(已集成)
// 三方接入
// leakcanary
......@@ -196,7 +194,7 @@ dependencies {
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟
implementation(name: 'msa_mdid_1.0.13', ext: 'aar')
implementation(name: 'oaid_sdk_1.0.23', ext: 'aar')
// 穿山甲广告
implementation(name: 'open_ad_sdk', ext: 'aar')
// 广点通广告 腾讯
......@@ -209,8 +207,7 @@ dependencies {
implementation 'com.umeng.umsdk:common:9.1.0' // (必选)
implementation 'com.umeng.umsdk:asms:1.1.3' // asms包依赖(必选)
implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选)
// TalkingDada
// implementation files('libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar')
// TalkingDada(已集成)
// 一览视频
implementation("com.yilan.sdk:ui:3.1.0.4") {
exclude group: 'com.yilan.sdk', module: 'toutiao'
......@@ -232,7 +229,6 @@ dependencies {
implementation(name: 'cmgame-sdk-tt3251-2.0.7', ext: 'aar')
implementation(name: 'x5fit-2.0.7', ext: 'aar')
implementation(name: 'gdtfit-2.0.7', ext: 'aar')
// implementation files("libs/qq_x5.jar")
// 鱼丸盒子
implementation(name: 'xzzq_ywsdk_1.1.0', ext: 'aar')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0"
......@@ -245,7 +241,7 @@ dependencies {
implementation 'androidx.core:core:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
// 变现猫
implementation(name: 'bxmsdk-release-3.0.0-csj3300', ext: 'aar')
implementation(name: 'bxmsdk-release-3.3.1', ext: 'aar')
// 闪电盒子
implementation(name: 'wannuosili_ad_2.2.0', ext: 'aar')
// 瑞狮新闻
......@@ -261,8 +257,16 @@ dependencies {
implementation(name: 'scenead-2.2', ext: 'aar')
implementation 'com.just.agentweb:agentweb:4.1.2'
// 喜马拉雅 已集成
// 微转阅读
implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar')
//天卓SDK的珊瑚2.0组件
implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.14', ext: 'aar')
implementation(name: 'shanhuAD.1.2.0', ext: 'aar')
implementation(name: 'tzsdk_coral-2.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_core-3.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_reporter-3.0.0-20200807131516-release', ext: 'aar')
// testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
......@@ -474,8 +474,8 @@
public protected *;
}
-keep class com.bxm.sdk.ad.**{ *;}
-keep class com.bianxianmao.sdk.**{*;}
-keep class com.wgs.sdk.**{ *;}
-keep class com.dhcw.sdk.**{*;}
-keep class android.support.v4.app.NotificationCompat**{
public *;
......@@ -571,4 +571,89 @@
-keep class tv.danmaku.ijk.media.player.** {*; }
-dontwarn tv.danmaku.ijk.media.player.*
-keep interface tv.danmaku.ijk.media.player.** { *; }
# ======================= JZVedio END ================
\ No newline at end of file
# ======================= JZVedio END ================
# ===================== 微转分享 START ================
-keep class com.xiangzi.*{*;}
-dontwarn com.xiangzi.**
# x5浏览器混淆需要加
-dontwarn com.tencent.smtt.export.external.**
-keep class com.tencent.smtt.export.external.**{*;}
-keep class com.tencent.tbs.video.interfaces.IUserStateChangedListener {*;}
-keep class com.tencent.smtt.sdk.CacheManager {*;}
-keep class com.tencent.smtt.sdk.CookieManager {*;}
-keep class com.tencent.smtt.sdk.WebHistoryItem {*;}
-keep class com.tencent.smtt.sdk.WebViewDatabase {*;}
-keep class com.tencent.smtt.sdk.WebBackForwardList {*;}
-keep public class com.tencent.smtt.sdk.WebView {*;}
-keep public class com.tencent.smtt.sdk.WebView$HitTestResult{*;}
-keep public class com.tencent.smtt.sdk.WebView$WebViewTransport {*;}
-keep public class com.tencent.smtt.sdk.WebView$PictureListener {*;}
-keepattributes InnerClasses
-keep public enum com.tencent.smtt.sdk.WebSettings$** {*;}
-keep public enum com.tencent.smtt.sdk.QbSdk$** {*;}
-keep public class com.tencent.smtt.sdk.WebSettings {*;}
-keep public class com.tencent.smtt.sdk.ValueCallback{*;}
-keep public class com.tencent.smtt.sdk.WebViewClient {*;}
-keep public class com.tencent.smtt.sdk.DownloadListener {*;}
-keep public class com.tencent.smtt.sdk.WebChromeClient {*;}
-keep public class com.tencent.smtt.sdk.WebChromeClient$FileChooserParams {*;}
-keep class com.tencent.smtt.sdk.SystemWebChromeClient{*;}
# 1. extension interfaces should be apparent
-keep public class com.tencent.smtt.export.external.extension.interfaces.* {*;}
# 2. interfaces should be apparent
-keep public class com.tencent.smtt.export.external.interfaces.* {*;}
-keep public class com.tencent.smtt.sdk.WebViewCallbackClient {*;}
-keep public class com.tencent.smtt.sdk.WebStorage$QuotaUpdater {*;}
-keep public class com.tencent.smtt.sdk.WebIconDatabase {*;}
-keep public class com.tencent.smtt.sdk.WebStorage {*;}
-keep public class com.tencent.smtt.sdk.DownloadListener {*;}
-keep public class com.tencent.smtt.sdk.QbSdk {*;}
-keep public class com.tencent.smtt.sdk.QbSdk$PreInitCallback {*;}
-keep public class com.tencent.smtt.sdk.CookieSyncManager {*;}
-keep public class com.tencent.smtt.sdk.Tbs* {*;}
-keep public class com.tencent.smtt.utils.LogFileUtils {*;}
-keep public class com.tencent.smtt.utils.TbsLog {*;}
-keep public class com.tencent.smtt.utils.TbsLogClient {*;}
-keep public class com.tencent.smtt.sdk.CookieSyncManager {*;}
# Added for game demos
-keep public class com.tencent.smtt.sdk.TBSGamePlayer {*;}
-keep public class com.tencent.smtt.sdk.TBSGamePlayerClient* {*;}
-keep public class com.tencent.smtt.sdk.TBSGamePlayerClientExtension {*;}
-keep public class com.tencent.smtt.sdk.TBSGamePlayerService* {*;}
-keep public class com.tencent.smtt.utils.Apn {*;}
-keep class com.tencent.smtt.** {*;}
# end
-keep public class com.tencent.smtt.export.external.extension.proxy.ProxyWebViewClientExtension {*;}
-keep class MTT.ThirdAppInfoNew {*;}
-keep class com.tencent.mtt.MttTraceEvent {*;}
# Game related
-keep public class com.tencent.smtt.gamesdk.* {*;}
-keep public class com.tencent.smtt.sdk.TBSGameBooter {*;}
-keep public class com.tencent.smtt.sdk.TBSGameBaseActivity {*;}
-keep public class com.tencent.smtt.sdk.TBSGameBaseActivityProxy {*;}
-keep public class com.tencent.smtt.gamesdk.internal.TBSGameServiceClient {*;}
# webView处理,项目中没有使用到webView忽略即可,webview与JS交互内部类不能混淆
-keepclassmembers class com.show.you.WebVerfiedActivity$MyHandler {*;}
-keepattributes *JavascriptInterface*
# ======================= 微转分享 END ================
# ===================== OAID START ================
-keep class XI.CA.XI.**{*;}
-keep class XI.K0.XI.**{*;}
-keep class XI.XI.K0.**{*;}
-keep class XI.vs.K0.**{*;}
-keep class XI.xo.XI.XI.**{*;}
-keep class com.asus.msa.SupplementaryDID.**{*;}
-keep class com.asus.msa.sdid.**{*;}
-keep class com.bun.lib.**{*;}
-keep class com.bun.miitmdid.**{*;}
-keep class com.huawei.hms.ads.identifier.**{*;}
-keep class com.samsung.android.deviceidservice.**{*;}
-keep class org.json.**{*;}
-keep public class com.netease.nis.sdkwrapper.Utils {public <methods>;}
# ======================= OAID END ================
\ No newline at end of file
......@@ -14,13 +14,9 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<permission
android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
<permission android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
......@@ -33,7 +29,8 @@
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<!-- 来电秀 -->
<uses-permission android:name="android.permission.READ_CALL_LOG" />
......@@ -48,7 +45,7 @@
<application
android:name=".MintsApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher_main"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
......@@ -62,14 +59,6 @@
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="app_key"
android:value="ff71a11162f20808f9f349452dd9e141" />
<meta-data
android:name="pack_id"
android:value="com.mints.goodmoney" />
<!-- 适配小米(xiaomi)刘海屏 -->
<meta-data
android:name="android.max_aspect"
......@@ -221,10 +210,10 @@
android:name=".ui.activitys.XmlyPlayActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.XmlyActivity"
android:name=".ui.activitys.TaskActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.KylVedioActivity"
android:name=".ui.activitys.KylVideoActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
<activity android:name=".call.detail.DetailActivity"
......@@ -249,6 +238,11 @@
android:exported="true"
android:process=":player" />
<!-- 监听apk安装 -->
<service
android:name=".service.AppInstallService"
android:exported="false" />
<!-- JPUSH 用户自定义的广播接收器 -->
<receiver
android:name="com.mints.goodmoney.service.JpushReceiver"
......@@ -269,7 +263,7 @@
<receiver android:name=".service.PushMessageReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="${applicationId}"></category>
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
......@@ -367,7 +361,6 @@
android:screenOrientation="landscape"
tools:replace="android:screenOrientation" />
<!-- 闪电盒子广告 -->
<provider
android:name="com.wannuosili.sdk.ad.component.WNFileProvider"
......
......@@ -6,19 +6,12 @@ import android.content.Context
import android.content.Intent
import cn.jpush.android.api.BasicPushNotificationBuilder
import cn.jpush.android.api.JPushInterface
import com.downloader.PRDownloader
import com.downloader.PRDownloaderConfig
import com.mints.goodmoney.manager.BxmManager.initBxm
import com.mints.library.utils.CommonUtils
import com.mob.MobSDK
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import com.tendcloud.tenddata.TCAgent
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import com.ximalaya.ting.android.opensdk.constants.ConstantsOpenSdk
import com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.xiangzi.articlesdk.XzArticleSdk
/**
* 子线程初始化SDK
......@@ -62,6 +55,9 @@ class InitAppService : IntentService("InitializeService") {
* 子线程进行初始化SDK操作
*/
private fun initApplication() {
// 微转分享
initWzShare()
// 初始化ShareSDK
MobSDK.init(this)
......@@ -70,6 +66,29 @@ class InitAppService : IntentService("InitializeService") {
// 变现猫
initBxm(this.application)
// PR下载附件
initPRDownloader()
}
/**
* PR下载附件
*/
private fun initPRDownloader() {
val config = PRDownloaderConfig.newBuilder()
.setDatabaseEnabled(true)
.build()
PRDownloader.initialize(this, config)
}
/**
* 微转分享
*/
private fun initWzShare() {
val iwxapi = WXAPIFactory.createWXAPI(this, "wxc8ac2985f6a805e2", false)
iwxapi.registerApp("wxc8ac2985f6a805e2")
XzArticleSdk.get().init(this.application, iwxapi, "151", "haozhuanqian")
}
/**
......@@ -79,7 +98,7 @@ class InitAppService : IntentService("InitializeService") {
JPushInterface.setDebugMode(BuildConfig.LOG_DEBUG) // 设置开启日志,发布时请关闭日志
JPushInterface.init(this)
val builder = BasicPushNotificationBuilder(applicationContext)
builder.statusBarDrawable = R.mipmap.ic_launcher
builder.statusBarDrawable = R.mipmap.ic_launcher_main
builder.notificationFlags = Notification.FLAG_AUTO_CANCEL //设置为自动消失
builder.notificationDefaults = Notification.DEFAULT_SOUND or Notification.DEFAULT_VIBRATE or Notification.DEFAULT_LIGHTS // 设置为铃声与震动都要
JPushInterface.setDefaultPushNotificationBuilder(builder)
......
......@@ -10,9 +10,6 @@ import android.webkit.WebView;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig;
import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.ChannelManager;
......@@ -21,6 +18,7 @@ import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.RsNewsManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.TzManager;
import com.mints.goodmoney.manager.WnManager;
import com.mints.goodmoney.manager.YlVideoManager;
import com.mints.goodmoney.manager.YlhAdManager;
......@@ -100,28 +98,17 @@ public class MintsApplication extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// MultiDex.install(this);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 移动安全联盟
try {
JLibrary.InitEntry(base);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
/*
* 三方配置
*/
private void thirdConfig() {
try {
ToastUtils.init(this);
} catch (Exception e) {
e.printStackTrace();
}
// 初始化toast
initToast();
// 移动安全联盟 oaid
initMiitHelper();
......@@ -129,16 +116,6 @@ public class MintsApplication extends MultiDexApplication {
// 按渠道匹配代码位
ChannelManager.INSTANCE.updataCodeIdForRegisterChannel(null);
// 子线程初始化三方SDK
String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid());
if (processName != null) {
// 判断onCreate方法执行是否在当前应用的application上
boolean defaultProcess = TextUtils.equals(processName, Constant.MINTS_PKG_NAME);
if (defaultProcess) {
InitAppService.Companion.start(this); //初始化数据
}
}
// 优量汇
YlhAdManager.INSTANCE.initYlhAd(this);
......@@ -166,10 +143,23 @@ public class MintsApplication extends MultiDexApplication {
// 自定义logger
bindLogger();
// PR下载附件
initPRDownloader();
// 天卓珊瑚
TzManager.INSTANCE.initTz(this);
// 子线程初始化三方SDK
String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid());
if (processName != null) {
// 判断onCreate方法执行是否在当前应用的application上
boolean defaultProcess = TextUtils.equals(processName, Constant.MINTS_PKG_NAME);
if (defaultProcess) {
InitAppService.Companion.start(this); //初始化数据
}
}
}
/**
* 初始化喜马拉雅
*/
private void initXmly() {
XmPlayerConfig.getInstance(this).setDefualtNotificationNickNameAndInfo(Constant.MINTS_APP_NAME, Constant.MINTS_APP_NAME);
if (BaseUtil.isMainProcess(this)) {
......@@ -198,16 +188,6 @@ public class MintsApplication extends MultiDexApplication {
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
/**
* PR下载附件
*/
private void initPRDownloader() {
PRDownloaderConfig config = PRDownloaderConfig.newBuilder()
.setDatabaseEnabled(true)
.build();
PRDownloader.initialize(this, config);
}
private MiitHelper.AppIdsUpdater appIdsUpdater = ids -> OAID = ids;
/**
......@@ -243,7 +223,7 @@ public class MintsApplication extends MultiDexApplication {
*/
public void initUm(Context context) {
try {
/**
/*
* 参数4:设备类型,必须参数,传参数为UMConfigure.DEVICE_TYPE_PHONE则表示手机;传参数为UMConfigure.DEVICE_TYPE_BOX则表示盒子;默认为手机。
* 参数5:Push推送业务的secret,需要集成Push功能时必须传入Push的secret,否则传空。
*/
......@@ -304,4 +284,15 @@ public class MintsApplication extends MultiDexApplication {
return null;
}
/**
* 初始化toast
*/
private void initToast() {
try {
ToastUtils.init(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -8,7 +8,6 @@ import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.ToastUtil
/**
* banner管理
......@@ -29,8 +28,8 @@ object BannerManager {
* 获取穿山甲banner
*/
fun getTtBanner(codeId: String, frameLayout: FrameLayout?) {
var expressViewAcceptedSizeWidth: Float = 380f
var expressViewAcceptedSizeHeight: Float = 280f
var expressViewAcceptedSizeWidth = 380f
var expressViewAcceptedSizeHeight = 280f
when (codeId) {
TtCsjAdManager.TT_AD_BANNER_MY -> {
expressViewAcceptedSizeWidth = 380f
......@@ -40,7 +39,6 @@ object BannerManager {
// ToastUtil.showLong(MintsApplication.getContext(), "csj banner:$codeId")
adNative?.let {
val adSlot = AdSlot.Builder()
.setCodeId(codeId) //广告位id
......
package com.mints.goodmoney.ad.vedio
package com.mints.goodmoney.ad.video
import android.app.Activity
import android.content.DialogInterface
......@@ -11,7 +11,7 @@ import com.mints.goodmoney.ui.widgets.LoadingDialog
import com.mints.goodmoney.utils.ToastUtil
import java.util.HashMap
open class BaseVedioAd(activity: Activity) : BaseView {
open class BaseVideoAd(activity: Activity) : BaseView {
open var activity: Activity? = null
var progressDialog: LoadingDialog? = null
......@@ -58,9 +58,7 @@ open class BaseVedioAd(activity: Activity) : BaseView {
fun setProgressNoDismiss() {
if (progressDialog != null && progressDialog!!.isShowing()) {
progressDialog!!.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else false
keyCode == KeyEvent.KEYCODE_BACK
})
}
}
......@@ -113,5 +111,5 @@ open class BaseVedioAd(activity: Activity) : BaseView {
open fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {}
open fun onDestory() {}
open fun onDestroy() {}
}
\ No newline at end of file
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.mvp.presenters.CsjFullVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VideoAdManagerView;
/**
* 穿山甲全屏广告
*/
public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManagerView {
private static CsjFullVideoAdManager _inst;
private CsjFullVedioAdPresenter csjFullVedioAdPresenter;
private CsjFullVedioAdListener csjFullVedioAdListener;
Activity activity;
private TTAdNative ttAdNative;
private TTFullScreenVideoAd mttFullVideoAd;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjFullVideoAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
_inst = new CsjFullVideoAdManager(activity);
return _inst;
}
}
private CsjFullVideoAdManager(Activity activity) {
super(activity);
init(activity);
}
private void init(Activity activity) {
this.activity = activity;
ttAdNative = TTAdSdk.getAdManager().createAdNative(activity);
csjFullVedioAdPresenter = new CsjFullVedioAdPresenter();
csjFullVedioAdPresenter.attachView(this);
}
/**
* 全屏广告
*
* @param carrierType
*/
@SuppressWarnings("SameParameterValue")
@Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
if (mttFullVideoAd != null) {
mttFullVideoAd.setFullScreenVideoAdInteractionListener(null);
}
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(TtCsjAdManager.TT_AD_FULLVEDIO_ALL)
.setSupportDeepLink(true)
.setOrientation(TTAdConstant.VERTICAL)
.build();
ttAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() {
@Override
public void onError(int code, String message) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdFail();
}
}
@Override
public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ad) {
mttFullVideoAd = ad;
mttFullVideoAd.setFullScreenVideoAdInteractionListener(new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() {
@Override
public void onAdShow() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ZERO, "", "");
}
@Override
public void onAdVideoBarClick() {
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_TWO, "", "");
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioDownload();
}
}
@Override
public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_THREE, "", "");
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdSuccess();
}
if (activity != null) {
csjFullVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJFULL, extraId, curCoin));
}
}
@Override
public void onVideoComplete() {
}
@Override
public void onSkippedVideo() {
}
});
}
@Override
public void onFullScreenVideoCached() {
if (mttFullVideoAd != null) {
//step6:在获取到广告后展示
mttFullVideoAd.showFullScreenVideoAd(activity);
mttFullVideoAd = null;
} else {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (csjFullVedioAdListener != null) {
csjFullVedioAdListener.csjFullVedioAdFail();
}
}
}
});
}
@Override
public void onDestroy() {
if (mttFullVideoAd != null) {
mttFullVideoAd.setFullScreenVideoAdInteractionListener(null);
}
if (csjFullVedioAdPresenter != null) {
csjFullVedioAdPresenter.dispose();
csjFullVedioAdPresenter.detachView();
}
activity = null;
}
public void setCsjFullVedioAdListener(CsjFullVedioAdListener csjFullVedioAdListener) {
this.csjFullVedioAdListener = csjFullVedioAdListener;
}
public interface CsjFullVedioAdListener {
void csjFullVedioAdFail();
void csjFullVedioAdSuccess();
void csjFullVedioDownload();
}
}
package com.mints.goodmoney.ad.vedio;
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TrackManager;
......@@ -23,13 +25,13 @@ import java.util.HashMap;
/**
* 穿山甲激励视频广告
*/
public class CsjVedioAdManager extends BaseVedioAd {
public class CsjVideoAdManager extends BaseVideoAd {
private static CsjVedioAdManager _inst;
private static CsjVideoAdManager _inst;
private AppPreferences ps;
private int curCoin;
private String extraId;
private CsjVedioAdListener csjVedioAdListener;
private CsjVideoAdListener csjVideoAdListener;
Activity activity;
private TTAdNative ttAdNative;
......@@ -38,16 +40,16 @@ public class CsjVedioAdManager extends BaseVedioAd {
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjVedioAdManager getInstance(Activity activity) {
public static CsjVideoAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
_inst = new CsjVedioAdManager(activity);
_inst = new CsjVideoAdManager(activity);
return _inst;
}
}
private CsjVedioAdManager(Activity activity) {
private CsjVideoAdManager(Activity activity) {
super(activity);
init(activity);
}
......@@ -62,7 +64,7 @@ public class CsjVedioAdManager extends BaseVedioAd {
}
@Override
public void onDestory() {
public void onDestroy() {
if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(null);
}
......@@ -89,7 +91,11 @@ public class CsjVedioAdManager extends BaseVedioAd {
codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN;
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_OFFINELINE;
break;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_SIGN;
break;
case Constant.CARRIER_WALK_BUBBLE:// 汽泡
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
......@@ -103,7 +109,16 @@ public class CsjVedioAdManager extends BaseVedioAd {
case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
codeId = TtCsjAdManager.TT_AD_VEDIO_ERASE;
break;
default:// 在线收益翻倍
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
codeId = TtCsjAdManager.TT_AD_VEDIO_BLESSINGBAG;
break;
case Constant.CARRIER_HOMEVEDIO_DOUBLE:// 首页视频翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_HOMEVEDIO;
break;
case Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE:// 短视频翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_SMALLHOMEVEDIO;
break;
default:
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
}
......@@ -127,16 +142,15 @@ public class CsjVedioAdManager extends BaseVedioAd {
.build();
if (ttAdNative != null) {
ttAdNative.loadRewardVideoAd(adSlot, new TTAdNative.RewardVideoAdListener() {
@Override
public void onError(int code, String message) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
LogUtil.d("CsjVedioAdManager", "onError " + code + message);
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
LogUtil.d("csjVideoAdListener", "onError " + code + message);
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdFail();
}
}
......@@ -149,8 +163,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
} else {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdFail();
}
}
}
......@@ -171,6 +185,10 @@ public class CsjVedioAdManager extends BaseVedioAd {
@Override
public void onAdVideoBarClick() {//广告的下载bar点击回调
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent();
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
......@@ -178,8 +196,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioDownload();
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoDownload();
}
}
......@@ -187,8 +205,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", "");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdSuccess();
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdSuccess();
}
}
......@@ -200,8 +218,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
public void onVideoError() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "VideoError");
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdFail();
}
}
......@@ -213,6 +231,33 @@ public class CsjVedioAdManager extends BaseVedioAd {
public void onSkippedVideo() {
}
});
// 下载任务监听
mttRewardVideoAd.setDownloadListener(new TTAppDownloadListener() {
@Override
public void onIdle() {
}
@Override
public void onDownloadActive(long l, long l1, String s, String s1) {
}
@Override
public void onDownloadPaused(long l, long l1, String s, String s1) {
}
@Override
public void onDownloadFailed(long l, long l1, String s, String s1) {
}
@Override
public void onDownloadFinished(long l, String s, String s1) {
}
@Override
public void onInstalled(String s, String appName) {
}
});
}
}
});
......@@ -253,15 +298,15 @@ public class CsjVedioAdManager extends BaseVedioAd {
return vo;
}
public void setCsjVedioAdListener(CsjVedioAdListener csjVedioAdListener) {
this.csjVedioAdListener = csjVedioAdListener;
public void setCsjVideoAdListener(CsjVideoAdListener csjVideoAdListener) {
this.csjVideoAdListener = csjVideoAdListener;
}
public interface CsjVedioAdListener {
void csjVedioAdFail();
public interface CsjVideoAdListener {
void csjVideoAdFail();
void csjVedioAdSuccess();
void csjVideoAdSuccess();
void csjVedioDownload();
void csjVideoDownload();
}
}
package com.mints.goodmoney.ad.vedio
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.maplehaze.adsdk.video.RewardVideoAd
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.mvp.presenters.MhVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
private val TAG = MhVideoAdManager::class.java.simpleName
/**
* 枫岚广告视频
*/
class MhVedioAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView {
private val TAG = MhVedioAdManager::class.java.simpleName
class MhVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VideoAdManagerView {
private var mhVdedioAdPresenter: MhVedioAdPresenter? = null
private var mhVedioAdListener: MhVedioAdListener? = null
private var mhVideoAdPresenter: MhVideoAdPresenter? = null
private var mhVideoAdListener: MhVideoAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
companion object {
private var _inst: MhVedioAdManager? = null
fun getInstance(activity: Activity): MhVedioAdManager? {
private var _inst: MhVideoAdManager? = null
fun getInstance(activity: Activity): MhVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = MhVedioAdManager(activity)
_inst = MhVideoAdManager(activity)
_inst
}
}
......@@ -42,15 +43,15 @@ class MhVedioAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) {
this.activity = activity
mhVdedioAdPresenter = MhVedioAdPresenter()
mhVdedioAdPresenter?.attachView(this)
mhVideoAdPresenter = MhVideoAdPresenter()
mhVideoAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
var postId: String = when (carrierType) {
val postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> MhManager.POS_ID
Constant.CARRIER_HOMEWATER -> MhManager.POS_ID
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_DRAWCASH -> MhManager.POS_ID
......@@ -76,6 +77,10 @@ class MhVedioAdManager private constructor(activity: Activity) :
}
override fun onADClick() {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
......@@ -83,8 +88,8 @@ class MhVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdDownload()
if (mhVideoAdListener != null) {
mhVideoAdListener?.mhVideoAdDownload()
}
}
......@@ -95,12 +100,12 @@ class MhVedioAdManager private constructor(activity: Activity) :
override fun onADClose() {
LogUtil.d(TAG, "onADClose")
mhVdedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
mhVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdSuccess()
if (mhVideoAdListener != null) {
mhVideoAdListener?.mhVideoAdSuccess()
}
}
......@@ -109,8 +114,8 @@ class MhVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdFail()
if (mhVideoAdListener != null) {
mhVideoAdListener?.mhVideoAdFail()
}
}
......@@ -119,18 +124,18 @@ class MhVedioAdManager private constructor(activity: Activity) :
mRewardVideoAd?.loadAd()
}
fun setMhVedioAdListener(mhVedioAdListener: MhVedioAdListener?) {
this.mhVedioAdListener = mhVedioAdListener
fun setMhVideoAdListener(mhVideoAdListener: MhVideoAdListener?) {
this.mhVideoAdListener = mhVideoAdListener
}
interface MhVedioAdListener {
fun mhVedioAdSuccess()
fun mhVedioAdFail()
fun mhVedioAdDownload()
interface MhVideoAdListener {
fun mhVideoAdSuccess()
fun mhVideoAdFail()
fun mhVideoAdDownload()
}
override fun onDestory() {
mhVdedioAdPresenter?.let {
override fun onDestroy() {
mhVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import android.text.TextUtils
import androidx.annotation.Nullable
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5
import com.mints.library.utils.json.JsonUtil
import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.coral.callback.CoralVideoListener
import com.tz.sdk.core.ad.ADError
import com.tz.sdk.core.ad.ADSource
import com.tz.sdk.core.ad.ADType
import com.tz.sdk.core.loader.ADLoader
import net.grandcentrix.tray.AppPreferences
private val TAG = ShVideoAdManager::class.java.simpleName
/**
* 天卓珊瑚广告视频
*/
class ShVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity) {
private var isClickScreen: Boolean = true
private var shVideoAdListener: ShVideoAdListener? = null
private lateinit var ps: AppPreferences
companion object {
/**
* taskType 珊瑚的任务类型
* 104(正式环境使用,珊瑚和广点通、快手视频混出)
* 131(测试环境使用,广点通视频单出)
*/
const val TZ_REWRAD_TYPE_DEBUG = 131
const val TZ_REWRAD_TYPE_RELEASE = 104
private var _inst: ShVideoAdManager? = null
fun getInstance(activity: Activity): ShVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = ShVideoAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
ps = AppPreferences(activity)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
val type = TZ_REWRAD_TYPE_RELEASE
ADLoader(activity)
.get(ADType.REWARD_VIDEO)
.from(ADSource.CORAL)
.reward(true)
.count(1)
.with(object : HashMap<String?, Any?>() {
init {
put(CoralAD.Key.TASK_TYPE, type)
put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().userID)
put(CoralAD.Key.LOGIN_KEY, JsonUtil.toJson(getAdMapVO(curCoin, carrierType, extraId)))
// put(CoralAD.Key.VIDEO_AUTO_PLAY, true) //拉取成功后是否自动播放视频,非必须,默认true
}
})
.load(object : CoralVideoListener() {
override fun onAdLoaded(adList: List<CoralAD>?) {
LogUtil.d(TAG, "onAdLoaded")
// if (adList != null && adList.isNotEmpty()) {
// val ad = adList[0]
// ad.playVideo(activity)
// } else {
//
// }
}
override fun onAdFailed(adError: ADError) {
LogUtil.d(TAG, "onAdFailed")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "")
if (shVideoAdListener != null) {
shVideoAdListener?.shVideoAdFail()
}
}
override fun onAdShow(@Nullable ad: CoralAD?): Boolean {
LogUtil.d(TAG, "onAdShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ZERO, "", "")
return super.onAdShow(ad)
}
override fun onAdClicked(@Nullable ad: CoralAD?): Boolean {
LogUtil.d(TAG, "onADClick")
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (shVideoAdListener != null) {
shVideoAdListener?.shVideoAdDownload()
}
return super.onAdClicked(ad)
}
override fun onAppDownloading(@Nullable ad: CoralAD?, @Nullable downloadUrl: String?): Boolean {
LogUtil.d(TAG, "onAppDownloading")
return super.onAppDownloading(ad, downloadUrl)
}
override fun onAppDownloaded(@Nullable ad: CoralAD?, @Nullable downloadUrl: String?, @Nullable localFile: String?): Boolean {
LogUtil.d(TAG, "onAppDownloaded")
return super.onAppDownloaded(ad, downloadUrl, localFile)
}
override fun onAppInstalled(@Nullable ad: CoralAD?, @Nullable downloadUrl: String?, @Nullable localFile: String?): Boolean {
LogUtil.d(TAG, "onAppInstalled")
return super.onAppInstalled(ad, downloadUrl, localFile)
}
override fun onAppActivated(ad: CoralAD?, downloadUrl: String?, localFile: String?): Boolean {
LogUtil.d(TAG, "onAppActivated")
return super.onAppActivated(ad, downloadUrl, localFile)
}
override fun onVideoFinished(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean {
LogUtil.d(TAG, "onVideoFinished")
return super.onVideoFinished(coralAD, s)
}
override fun onVideoClosed(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean {
LogUtil.d(TAG, "onVideoClosed")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
if (shVideoAdListener != null) {
shVideoAdListener?.shVideoAdSuccess()
}
return super.onVideoClosed(coralAD, s)
}
})
}
fun setShVideoAdListener(shVideoAdListener: ShVideoAdListener?) {
this.shVideoAdListener = shVideoAdListener
}
interface ShVideoAdListener {
fun shVideoAdSuccess()
fun shVideoAdFail()
fun shVideoAdDownload()
}
override fun onDestroy() {
activity = null
}
private fun getAdMapVO(curCoin: Int, carrierType: String, extraId: String?): HashMap<String, Any> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO
vo["tid"] = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID)
vo["ip"] = ps.getString(Constant.CSJ_VEDIO_APPIP, "")!!
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin
Constant.CARRIER_OFFLINE_DOUBLE -> {
vo["offline_income"] = curCoin
vo["turntableKey"] = if (TextUtils.isEmpty(extraId)) "" else extraId!!
}
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = if (TextUtils.isEmpty(extraId)) "" else extraId!!
}
return vo
}
}
\ No newline at end of file
package com.mints.goodmoney.ad.vedio
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.WnManager
import com.mints.goodmoney.mvp.presenters.WnVedioAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.mvp.presenters.WnVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
import com.wannuosili.sdk.*
private val TAG = WnVideoAdManager::class.java.simpleName
/**
* 闪电盒子视频
*/
class WnVedioAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView {
private val TAG = WnVedioAdManager::class.java.simpleName
class WnVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VideoAdManagerView {
private var wnVedioAdPresenter: WnVedioAdPresenter? = null
private var wnVedioAdListener: WnVedioAdListener? = null
private var wnVideoAdPresenter: WnVideoAdPresenter? = null
private var wnVideoAdListener: WnVideoAdListener? = null
private var mRewardVideoAd: WNRewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
companion object {
private var _inst: WnVedioAdManager? = null
fun getInstance(activity: Activity): WnVedioAdManager? {
private var _inst: WnVideoAdManager? = null
fun getInstance(activity: Activity): WnVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = WnVedioAdManager(activity)
_inst = WnVideoAdManager(activity)
_inst
}
}
......@@ -42,21 +43,20 @@ class WnVedioAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) {
this.activity = activity
wnVedioAdPresenter = WnVedioAdPresenter()
wnVedioAdPresenter?.attachView(this)
wnVideoAdPresenter = WnVideoAdPresenter()
wnVideoAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
var postId: String = ""
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> postId = WnManager.WN_AD_VEDIO_MAIN_POSTID
Constant.CARRIER_HOMEWATER -> postId = WnManager.WN_AD_VEDIO_DRINK_POSTID
Constant.CARRIER_CHALLENGE_TURN,Constant.CARRIER_DRAWCASH -> postId = WnManager.WN_AD_VEDIO_TURNABLE_POSTID
Constant.CARRIER_CHALLENGE_CARD -> postId = WnManager.WN_AD_VEDIO_ERASE_POSTID
else -> postId = WnManager.WN_AD_VEDIO_MOREDIALOG_POSTID
val postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> WnManager.WN_AD_VEDIO_MAIN_POSTID
Constant.CARRIER_HOMEWATER -> WnManager.WN_AD_VEDIO_DRINK_POSTID
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_DRAWCASH -> WnManager.WN_AD_VEDIO_TURNABLE_POSTID
Constant.CARRIER_CHALLENGE_CARD -> WnManager.WN_AD_VEDIO_ERASE_POSTID
else -> WnManager.WN_AD_VEDIO_MOREDIALOG_POSTID
}
val slot = WNAdSlot.Builder()
.setSlotId(postId)
......@@ -69,8 +69,8 @@ class WnVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ONE, (code).toString(), message)
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdFail()
if (wnVideoAdListener != null) {
wnVideoAdListener?.wnVideoAdFail()
}
}
......@@ -81,6 +81,9 @@ class WnVedioAdManager private constructor(activity: Activity) :
}
override fun onAdClick() {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_TWO, "", "")
......@@ -89,18 +92,18 @@ class WnVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdDownload()
if (wnVideoAdListener != null) {
wnVideoAdListener?.wnVideoAdDownload()
}
}
override fun onAdClose() {
wnVedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SDHZ, extraId, curCoin))
wnVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SDHZ, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
if (wnVedioAdListener != null) {
wnVedioAdListener?.wnVedioAdSuccess()
if (wnVideoAdListener != null) {
wnVideoAdListener?.wnVideoAdSuccess()
}
}
......@@ -116,11 +119,9 @@ class WnVedioAdManager private constructor(activity: Activity) :
showToast("开始下载")
}
override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {
}
override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {}
override fun onDownloadFailed(fileName: String, appName: String) {
}
override fun onDownloadFailed(fileName: String, appName: String) {}
}
}
mRewardVideoAd = ad
......@@ -129,18 +130,18 @@ class WnVedioAdManager private constructor(activity: Activity) :
})
}
fun setWnVedioAdListener(wnVedioAdListener: WnVedioAdListener?) {
this.wnVedioAdListener = wnVedioAdListener
fun setWnVideoAdListener(wnVideoAdListener: WnVideoAdListener?) {
this.wnVideoAdListener = wnVideoAdListener
}
interface WnVedioAdListener {
fun wnVedioAdSuccess()
fun wnVedioAdFail()
fun wnVedioAdDownload()
interface WnVideoAdListener {
fun wnVideoAdSuccess()
fun wnVideoAdFail()
fun wnVideoAdDownload()
}
override fun onDestory() {
wnVedioAdPresenter?.let {
override fun onDestroy() {
wnVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
......
package com.mints.goodmoney.ad.vedio;
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import android.os.SystemClock;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.mvp.presenters.YlhVideoAdPresenter;
import com.mints.goodmoney.mvp.views.VideoAdManagerView;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError;
import java.lang.ref.WeakReference;
/**
* 优量汇视频
*/
public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView {
public class YlhVideoAdManager extends BaseVideoAd implements VideoAdManagerView {
private static YlhVedioAdManager _inst;
private static YlhVideoAdManager _inst;
// 优量汇激励视频
private RewardVideoAD rewardVideoAD;
private YlhVedioAdPresenter ylhVedioAdPresenter;
private YlhVedioAdListener ylhVedioAdListener;
private YlhVideoAdPresenter ylhVideoAdPresenter;
private YlhVideoAdListener ylhVideoAdListener;
Activity activity;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVedioAdManager getInstance(Activity activity) {
public static YlhVideoAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
_inst = new YlhVedioAdManager(activity);
WeakReference<Activity> activityWeakReference = new WeakReference<>(activity);
_inst = new YlhVideoAdManager(activityWeakReference);
return _inst;
}
}
private YlhVedioAdManager(Activity activity) {
super(activity);
init(activity);
private YlhVideoAdManager(WeakReference<Activity> activity) {
super(activity.get());
init(activity.get());
}
private void init(Activity activity) {
this.activity = activity;
ylhVedioAdPresenter = new YlhVedioAdPresenter();
ylhVedioAdPresenter.attachView(this);
ylhVideoAdPresenter = new YlhVideoAdPresenter();
ylhVideoAdPresenter.attachView(this);
}
@Override
public void onDestory() {
if (ylhVedioAdPresenter != null) {
ylhVedioAdPresenter.dispose();
ylhVedioAdPresenter.detachView();
public void onDestroy() {
if (ylhVideoAdPresenter != null) {
ylhVideoAdPresenter.dispose();
ylhVideoAdPresenter.detachView();
}
activity = null;
......@@ -98,7 +104,11 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MAIN_POSTID();
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_OFFINELINE_POSTID();
break;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_SIGN_POSTID();
break;
case Constant.CARRIER_WALK_BUBBLE:// 汽泡
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MOREDIALOG_POSTID();
break;
......@@ -112,15 +122,25 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_ERASE_POSTID();
break;
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_BLESSINGBAG_POSTID();
break;
case Constant.CARRIER_HOMEVEDIO_DOUBLE:// 首页视频翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_HOMEVEDIO_POSTID();
break;
case Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE:// 短视频翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID();
break;
default:// 在线收益翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MOREDIALOG_POSTID();
break;
}
// ToastUtil.showLong(MintsApplication.getContext(), "ylh vedio:" + ylhPostId);
// ToastUtil.show(MintsApplication.getContext(), "ylh vedio:" + ylhPostId);
if (rewardVideoAD != null) {
rewardVideoAD = null;
}
rewardVideoAD = new RewardVideoAD(activity, YlhAdManager.YLH_AD_APPID, ylhPostId, new RewardVideoADListener() {
@Override
public void onADLoad() {//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
......@@ -140,8 +160,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
e.printStackTrace();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, "999999", "Load Fail");
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail();
if (ylhVideoAdListener != null) {
ylhVideoAdListener.ylhVideoAdFail();
}
}
}
......@@ -165,12 +185,16 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
@Override
public void onReward() {//激励视频广告激励发放
// if (activity != null) {
// ylhVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
// ylhVideoAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
// }
}
@Override
public void onADClick() {//激励视频广告被点击
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent();
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
......@@ -178,8 +202,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdDownload();
if (ylhVideoAdListener != null) {
ylhVideoAdListener.ylhVideoAdDownload();
}
}
......@@ -192,10 +216,10 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
public void onADClose() {//激励视频广告被关闭
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_THREE, "", "");
ylhVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin));
ylhVideoAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin));
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdSuccess();
if (ylhVideoAdListener != null) {
ylhVideoAdListener.ylhVideoAdSuccess();
}
}
......@@ -203,13 +227,13 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述
if (adError != null) {
LogUtil.d("YlhVedioAdManager", "onError " + adError.getErrorCode() + adError.getErrorMsg());
LogUtil.d("YlhVideoAdManager", "onError " + adError.getErrorCode() + adError.getErrorMsg());
// 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();
if (ylhVideoAdListener != null) {
ylhVideoAdListener.ylhVideoAdFail();
}
}
});
......@@ -217,15 +241,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
rewardVideoAD.loadAD();
}
public void setYlhVedioAdListener(YlhVedioAdListener ylhVedioAdListener) {
this.ylhVedioAdListener = ylhVedioAdListener;
public void setYlhVideoAdListener(YlhVideoAdListener ylhVideoAdListener) {
this.ylhVideoAdListener = ylhVideoAdListener;
}
public interface YlhVedioAdListener {
void ylhVedioAdFail();
public interface YlhVideoAdListener {
void ylhVideoAdFail();
void ylhVedioAdSuccess();
void ylhVideoAdSuccess();
void ylhVedioAdDownload();
void ylhVideoAdDownload();
}
}
......@@ -57,14 +57,14 @@ public class PhoneListenService extends NotificationListenerService {
notification = new Notification.Builder(this, channelId)
.setContentTitle(getString(R.string.app_name))
.setContentText("来电秀")
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_launcher_main)
.setContentIntent(contentIntent)
.build();
} else {
notification = new Notification.Builder(this)
.setContentTitle(getString(R.string.app_name))
.setContentText("来电秀")
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_launcher_main)
.setContentIntent(contentIntent)
.build();
}
......
......@@ -33,6 +33,11 @@ public class AppConfig {
*/
public static String user_channel_ad = "";
/**
* 用户注册渠道
*/
public static String user_register_channel = "";
/**
* 趣步赚成功标记
*/
......@@ -48,6 +53,11 @@ public class AppConfig {
*/
public static boolean xmlyAdFlag = false;
/**
* 广告隐藏显示 true-走原有流程
*/
public static boolean showAdFlag = true;
/**
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
*/
......@@ -59,16 +69,35 @@ public class AppConfig {
*/
public static int ylhAdCount = 5;
/**
* csjVedio 剩余广告播放数
* csjVideo 剩余广告播放数
*/
public static int csjVedioAdCount = 5;
public static int csjVideoAdCount = 5;
/**
* wnVedio 剩余广告播放数
* wnVideo 剩余广告播放数
*/
public static int wnVedioAdCount = 5;
public static int wnVideoAdCount = 5;
/**
* flVedio 剩余广告播放数
* flVideo 剩余广告播放数
*/
public static int flVedioAdCount = 5;
/**
* csjFull 剩余广告播放数
*/
public static int csjFullVedioAdCount = 5;
public static int flVideoAdCount = 5;
/**
* shVideo 剩余广告播放数
*/
public static int shVideoAdCount = 5;
/**
* 高额试玩任务标识
*/
public static boolean isHighTask = false;
/**
* 是否需要上报点击广告
*/
public static boolean needReportClickAdEvent = false;
}
......@@ -115,8 +115,8 @@ object Constant {
const val CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE = "CHALLENGE_SHAREFRIEND_DOUBLE" //邀请好友翻倍
const val CARRIER_HOMEVEDIO = "HOMEVEDIO" //首页红包
const val CARRIER_HOMEVEDIO_DOUBLE = "HOMEVEDIO_DOUBLE" //首页红包翻倍
const val CARRIER_SMALLHOMEVEDIO = "SMALLHOMEVEDIO" //首页红包
const val CARRIER_SMALLHOMEVEDIO_DOUBLE = "SMALLHOMEVEDIO_DOUBLE" //首页红包翻倍
const val CARRIER_SMALLHOMEVEDIO = "SMALLHOMEVEDIO" //短视频红包
const val CARRIER_SMALLHOMEVEDIO_DOUBLE = "SMALLHOMEVEDIO_DOUBLE" //短视频红包翻倍
const val CARRIER_MORNING_CLOCK = "MORNING_CLOCK" //早上打卡
const val CARRIER_DRAWCASH = "DRAWCASH" //提现
const val CARRIER_BLACK = "BLACK" //黑名单
......@@ -127,7 +127,10 @@ object Constant {
const val CARRIER_BLESSINGBAG_DOUBLE = "BLESSINGBAG_DOUBLE" //首页福袋翻倍
const val CARRIER_XMLY_CHALLENGE = "XMLY_CHALLENGE" //喜马拉雅听书
const val CARRIER_KUYINYUE_VEDIO = "KUYINYUE_VEDIO" //酷音乐视频
const val CARRIER_HIGH_ACTIVITY = "HIGH_ACTIVITY" //高额任务
const val CARRIER_SHARE_NEWS = "SHARE_NEWS" //分享新闻
const val CARRIER_CPD = "CPD" //珊瑚CPD下载试玩任务
const val CARRIER_CPD_SYD = "CPD_SYD" //SYDCPD下载试玩任务
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......@@ -136,6 +139,8 @@ object Constant {
const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -149,13 +154,13 @@ object Constant {
// 穿山甲激励视频id
const val CSJ_VEDIO_APPIP = "csj_vedio_appip"
// 视频广告类型
const val CSJ_VEDIO_AD = "CSJ_VEDIO_AD"
const val YLH_VEDIO_AD = "YLH_VEDIO_AD"
const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD"
const val FL_VEDIO_AD = "Fl_VEDIO_AD"
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD"
// 游戏类型
const val EVENT_TYPE_CLICK = "CLICK"
......@@ -178,6 +183,8 @@ object Constant {
const val HOT_ACTIVITY_BOOK = "readBook"
const val HOT_ACTIVITY_NEWS = "TO_RUISHI"
const val HOT_ACTIVITY_DHGAME = "dhGame"
const val HOT_ACTIVITY_SHARE_NEWS = "TO_SHARE_NEWS"
const val HOT_ACTIVITY_CPD = "TO_CPD"
// 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag"
......@@ -187,7 +194,7 @@ object Constant {
var SHARE_CONTENT = "邀请码【${UserManager.getInstance().codeID}】,共享新模式,快来加入跟我一起赚钱吧"
// var SHARE_URL: String = BuildConfig.MainIp + "share/shareFriend.html?ruid=" + UserManager.getInstance().getUserID() + "&channel=" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
var SHARE_URL: String = BuildConfig.MainIp + "wxShare/toShare?shareId=" + UserManager.getInstance().getUserID()
var SHARE_URL: String = BuildConfig.MainIp + "wxShare/toShare?shareId=" + UserManager.getInstance().userID
// 首页视频时长 单位-秒
const val MAIN_VEDIO_TIME = "main_vedio_time"
......@@ -216,4 +223,13 @@ object Constant {
// 分页 条数
const val PAGE_SIZE = 15
// 是否是高额任务
const val IS_HIGH_TASK = "is_high_task"
// 高额任务分享包名变量存储
const val HIGH_TASK_PKG_NAME = "high_task_pkg_name"
// 外网IP地址
const val OUT_NET_IP = "out_net_ip"
}
......@@ -684,6 +684,38 @@ class DeviceInfo private constructor() {
return pkg
}
/**
*
*
* return:包名
*/
fun isLoadingPkg(pkg: String): Boolean {
var flag = false
try {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
pinfo = packageinfo[i]
val appInfo = pinfo.applicationInfo
if (appInfo.flags and ApplicationInfo.FLAG_SYSTEM > 0) {
//系统程序 忽略
} else {
//非系统程序
if (TextUtils.equals(pkg, pinfo.packageName)) {
return true
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return flag
}
/**
* Android ID
*
......
package com.mints.goodmoney.manager
import android.app.Activity
import android.content.Context
import android.view.View
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
import java.lang.ref.WeakReference
/**
* APP试玩管理类
*/
object AppTryPlayManager {
fun toTryPlay(pkg: String) {
AppUtil.openThirdApp(MintsApplication.getContext(), pkg)
}
fun getTryPlayIsOK(pkg: String, useTime: Int): Boolean {
val timePkgUsed = AppUtil.getTimePkgUsed(MintsApplication.getContext(), pkg)
LogUtil.d("AppTryPlayManager -> " + timePkgUsed)
return timePkgUsed >= useTime
}
private var cdaa: CustomDialogAsApple? = null
/**
* 打开应用使用记录授权弹框
*/
fun openAppUsageStats(activity: Activity) {
val weakReference = WeakReference<Activity>(activity)
cdaa = CustomDialogAsApple(weakReference.get(), object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
cdaa!!.dismiss()
}
R.id.dialog_btn_right -> {
cdaa!!.dismiss()
AppUtil.openUsageStats(weakReference.get() as Context)
}
}
}
})
cdaa?.let {
it.setTitle("提示")
it.setContent("该任务需要【应用使用记录】权限")
it.setLeft("取消")
it.setRight("打开授权")
it.show()
}
}
}
\ No newline at end of file
......@@ -2,12 +2,17 @@ package com.mints.goodmoney.manager
import android.app.Activity
import android.app.Application
import android.content.Intent
import android.view.ViewGroup
import com.bianxianmao.sdk.BDAdvanceButtonAd
import com.bianxianmao.sdk.manager.BDAdvanceConfig
import com.bianxianmao.sdk.manager.BDManager
import com.dhcw.sdk.BDAdvanceButtonAd
import com.dhcw.sdk.BDAdvanceButtonListener
import com.dhcw.sdk.BDAppNativeOnClickListener
import com.dhcw.sdk.manager.BDAdvanceConfig
import com.dhcw.sdk.manager.BDManager
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.WxLoginActivity
/**
* 描述:变现猫
......@@ -40,15 +45,62 @@ object BxmManager {
if (activity == null) return
try {
if (bdAdvanceButtonAd == null) {
bdAdvanceButtonAd = BDAdvanceButtonAd(activity, viewGroup, BUTTON_AD_SPOT_ID)
if (bdAdvanceButtonAd != null) {
bdAdvanceButtonAd!!.setBdAdvanceButtonListener(null)
bdAdvanceButtonAd!!.setBdAppNativeOnClickListener(null)
bdAdvanceButtonAd = null
}
bdAdvanceButtonAd = BDAdvanceButtonAd(activity, viewGroup, BUTTON_AD_SPOT_ID)
bdAdvanceButtonAd?.setBdAdvanceButtonListener(object : BDAdvanceButtonListener {
override fun onActivityClosed() {
// Toast.makeText(activity, "活动页关闭 ", Toast.LENGTH_LONG).show()
}
override fun onAdShow() {
// Toast.makeText(activity, "广告展示 ", Toast.LENGTH_LONG).show()
}
override fun onAdFailed() {
// Toast.makeText(activity, "广告加载失败 ", Toast.LENGTH_LONG).show()
}
override fun onAdClicked() {
// Toast.makeText(activity, "广告点击 ", Toast.LENGTH_LONG).show()
}
})
bdAdvanceButtonAd?.setBdAppNativeOnClickListener(object : BDAppNativeOnClickListener {
override fun onActivityClosed() {
// Toast.makeText(activity, "float onActivityClosed ", Toast.LENGTH_SHORT).show()
}
override fun onClick(type: Int, adid: String) {
// Toast.makeText(activity, "float onClick:$type", Toast.LENGTH_SHORT).show()
//type=1 加载视频 type=2 播放视频
if (type == 1) {
//bdAdvanceFloatIconAd 绑定激励视频回调
BxmPlayVideo.getInstance().load(bdAdvanceButtonAd)
} else if (type == 2) {
BxmPlayVideo.getInstance().play(activity)
}
}
})
bdAdvanceButtonAd?.loadAd()
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 登录后绑定用户信息
*/
fun bindUserData() {
try {
BDManager.getStance().bindUserData(MintsApplication.getContext(), APP_ID, "cuid=${UserManager.getInstance().userID}")
} catch (e: Exception) {
e.printStackTrace()
}
}
fun onDestory() {
bdAdvanceButtonAd = null
}
......
package com.mints.goodmoney.manager;
import android.app.Activity;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.dhcw.sdk.BDAdvanceBaseAppNative;
public class BxmPlayVideo {
static BxmPlayVideo instance = new BxmPlayVideo();
public static BxmPlayVideo getInstance() {
return instance;
}
//一、加载穿山甲激励视频
//BDAdvanceBaseAppNative 绑定激励视频回调
public void load(final BDAdvanceBaseAppNative appNative) {
try {
TTNativeExpressManager ttNativeExpressManager = null;
TTAdNative adNative = null;
if (ttNativeExpressManager == null) {
ttNativeExpressManager = new TTNativeExpressManager();
adNative = ttNativeExpressManager.initTTAd(false);
}
//模版渲染请求AdSlot
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(TtCsjAdManager.TT_AD_VEDIO_BIANXIANMAO)
.setSupportDeepLink(true)
.setAdCount(1)
.setExpressViewAcceptedSize(500, 500)//个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可。仅模板广告需要设置此参数
.setImageAcceptedSize(1080, 1920)
.setOrientation(TTAdConstant.VERTICAL)
.setMediaExtra("media_extra")
.setUserID(UserManager.getInstance().getUserID())
.build();
//加载激励视频广告
adNative.loadRewardVideoAd(adSlot, new TTAdNative.RewardVideoAdListener() {
@Override
public void onError(int i, String s) {
appNative.onError(i);
}
@Override
public void onRewardVideoAdLoad(TTRewardVideoAd ttRewardVideoAd) {
if (ttRewardVideoAd == null) {
appNative.onError(0);
} else {
bindRewardListener(ttRewardVideoAd, appNative);
appNative.onADLoad();
}
}
@Override
public void onRewardVideoCached() {
}
});
} catch (Throwable e) {
appNative.onError(0);
}
}
//二、绑定穿山甲激励视频回调
//BDAdvanceBaseAppNative 绑定激励视频回调
TTRewardVideoAd mttRewardVideoAd;
private void bindRewardListener(TTRewardVideoAd ttRewardVideoAd, final BDAdvanceBaseAppNative appNative) {
mttRewardVideoAd = ttRewardVideoAd;
mttRewardVideoAd.setRewardAdInteractionListener(new TTRewardVideoAd.RewardAdInteractionListener() {
@Override
public void onAdShow() {
appNative.onADShow();
}
@Override
public void onAdVideoBarClick() {
appNative.onADClick();
}
@Override
public void onAdClose() {
appNative.onADClose();
}
@Override
public void onVideoComplete() {
appNative.onVideoComplete();
}
@Override
public void onVideoError() {
appNative.onError(0);
}
@Override
public void onRewardVerify(boolean b, int i, String s, int i1, String s1) {
appNative.onReward();
}
@Override
public void onSkippedVideo() {
appNative.onSkipped();
}
});
}
//三、播放穿山甲激励视频
public void play(Activity activity) {
if (mttRewardVideoAd != null) {
mttRewardVideoAd.showRewardVideoAd(activity);
}
}
}
package com.mints.goodmoney.manager
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.net.CpdService
import com.mints.goodmoney.utils.MD5
import com.mints.goodmoney.utils.rxutil.CommonRxTask
import com.mints.goodmoney.utils.rxutil.RxjavaUtil
import com.mints.library.net.netstatus.NetUtils
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import org.json.JSONException
import org.json.JSONObject
/**
* Cpd下载
*/
object CpdManager {
const val BUSINESS_ID = "m8908"
const val KEY = "sywnTAWBilog6LYancoe8wQFxK070X7B"
fun getCpdUrl(): String {
val currentTimeMillis = System.currentTimeMillis().toString()
val token = MD5.GetMD5Code(BUSINESS_ID + KEY + currentTimeMillis)
// token=MD5(id + apikey+ timestamp)
return CpdService.CPD_IP + "?businessId=" + BUSINESS_ID +
"&token=" + token +
"&timestamp=" + currentTimeMillis
}
fun getCpdBody(ip: String): RequestBody {
val deviceInfo = DeviceInfo.instance
val param = JSONObject()
val application = JSONObject()
val equipment = JSONObject()
try {
application.put("app_pkg_name", "com.mints.goodmoney")
application.put("app_ver_code", deviceInfo.versionCode)
application.put("app_ver_name", deviceInfo.versionName)
// 设备类型 4-手机
equipment.put("type", "4")
// 系统类型 1:android
equipment.put("os_type", "1")
equipment.put("android_id", deviceInfo.androidId)
equipment.put("imei", deviceInfo.iMEI)
equipment.put("mac", deviceInfo.getMacAddress())
equipment.put("net_type", NetUtils.getNetworkStateForCpd(MintsApplication.getContext()))
equipment.put("ip", ip)
equipment.put("brand", deviceInfo.brand)
equipment.put("model", deviceInfo.mobileModel)
param.put("application", application)
param.put("equipment", equipment)
} catch (e: JSONException) {
e.printStackTrace()
}
return RequestBody.create("application/json".toMediaTypeOrNull(), param.toString())
}
}
\ No newline at end of file
package com.mints.goodmoney.manager
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.net.Uri
import android.os.Build
import android.provider.Settings
import androidx.annotation.RequiresApi
import androidx.core.content.FileProvider
import com.downloader.Error
import com.downloader.OnDownloadListener
import com.downloader.PRDownloader
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.DownloadProgressDialog
import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.MD5
import java.io.File
/**
* apk下载管理
*/
object DownloadApkManager {
private var downloadProgressDialog: DownloadProgressDialog? = null
private var mDownloadListener: OnMyDownloadListener? = null
private var apkName = ""
private var cachePath = MintsApplication.getContext().externalCacheDir?.path + "/Download/"
private var canOnceInstallApk = false//8.0以上系统 防止首次授权时 未安装apk调用
private var activity: Activity? = null
/**
* 下载apk
*
* url:下载地址
*/
fun downloadApk(activity: Activity, url: String) {
this.activity = activity
apkName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".apk"
mDownloadListener?.onDownloadStart()
this.download(url)
}
/**
* 下载apk
*
* url:下载地址
* name:应用名称
*/
fun downloadApk(activity: Activity, url: String, name: String) {
this.activity = activity
this.apkName = "$name.apk"
// 判断apk是否存在
if (isFileExist("$name.apk")) {
preInstallApk()
return
}
mDownloadListener?.onDownloadStart()
this.download(url)
}
private fun isFileExist(apkName: String): Boolean {
val file = File(cachePath + apkName)
return file.exists()
}
/**
* 防止首次授权未知来源权限时 未安装apk调用
*/
fun tryOnceInstallApk() {
try {
if (canOnceInstallApk && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val context = MintsApplication.getContext()
val haveInstallPermission = context.packageManager.canRequestPackageInstalls()
if (haveInstallPermission) {
installApk()
canOnceInstallApk = false
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun download(url: String) {
if (activity == null) return
downloadProgressDialog = DownloadProgressDialog(activity!!)
downloadProgressDialog!!.show()
val context = MintsApplication.getContext()
// cachePath = context.externalCacheDir?.path + "/Download/"
PRDownloader.download(url, cachePath, apkName)
.build()
.setOnProgressListener { progress ->
downloadProgressDialog?.setProgress(progress)
}
.start(object : OnDownloadListener {
override fun onDownloadComplete() {
downloadProgressDialog?.dismiss()
try {
mDownloadListener?.onDownloadSuccess(cachePath + apkName)
preInstallApk()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onError(error: Error) {
downloadProgressDialog?.dismiss()
CacheUtil.clearAllCache(context)
}
})
}
/**
* 预安装,授权校验
*/
private fun preInstallApk() {
if (activity == null) return
val context = MintsApplication.getContext()
// 8.0以上系统设置安装未知来源权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val haveInstallPermission = context.packageManager.canRequestPackageInstalls()
if (!haveInstallPermission) {
showAlert(activity!!, "安装权限", "需要打开允许来自此来源,请去设置中开启此权限",
DialogInterface.OnClickListener { dialog, which ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//此方法需要API>=26才能使用
toInstallPermissionSettingIntent()
}
})
return
}
}
installApk()
}
/**
* 授权提示框
*/
private fun showAlert(context: Context, title: String, message: String, listener: DialogInterface.OnClickListener?) {
val builder = AlertDialog.Builder(context)
builder.setTitle(title)
builder.setMessage(message)
builder.setPositiveButton("确定", listener)
builder.setCancelable(false)
builder.setIcon(R.mipmap.ic_launcher_main)
val dialog = builder.create()
dialog.show()
}
/**
* 跳转安装未知来源权限页面
*/
@RequiresApi(api = Build.VERSION_CODES.O)
private fun toInstallPermissionSettingIntent() {
if (activity == null) return
canOnceInstallApk = true
val context = activity!!
val packageURI = Uri.parse("package:" + context.packageName)
val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI)
context.startActivity(intent)
}
/**
* 安装apk包
*/
private fun installApk() {
if (activity == null) return
try {
val context = activity!!
val intent = Intent(Intent.ACTION_VIEW)
val file = File(cachePath + apkName)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
val apkUri: Uri
if (Build.VERSION.SDK_INT >= 24) {
apkUri = FileProvider.getUriForFile(context, context.packageName + ".fileprovider", file)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
} else {
apkUri = Uri.fromFile(file)
}
intent.setDataAndType(apkUri, "application/vnd.android.package-archive")
// 华为手机适配
// 查询所有符合 intent 跳转目标应用类型的应用,注意此方法必须放置在 setDataAndType 方法之后
val resolveLists: List<ResolveInfo> = context.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
// 然后全部授权
for (resolveInfo in resolveLists) {
val packageName = resolveInfo.activityInfo.packageName
context.grantUriPermission(packageName, apkUri, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun destroy() {
this.downloadProgressDialog = null
this.mDownloadListener = null
this.activity = null
}
fun setOnMyDownloadListener(onMyDownloadListener: OnMyDownloadListener?) {
this.mDownloadListener = onMyDownloadListener
}
interface OnMyDownloadListener {
fun onDownloadStart()
fun onDownloadSuccess(path: String)
}
}
\ No newline at end of file
......@@ -5,16 +5,9 @@ import android.util.Log;
import androidx.annotation.NonNull;
import com.bun.miitmdid.core.ErrorCode;
import com.bun.miitmdid.core.MdidSdk;
import com.bun.miitmdid.core.MdidSdkHelper;
import com.bun.supplier.IIdentifierListener;
import com.bun.supplier.IdSupplier;
import com.mints.goodmoney.MintsApplication;
/**
* Created by zheng on 2019/8/22.
*/
import com.bun.miitmdid.interfaces.IIdentifierListener;
import com.bun.miitmdid.interfaces.IdSupplier;
public class MiitHelper implements IIdentifierListener {
......@@ -56,17 +49,6 @@ public class MiitHelper implements IIdentifierListener {
return MdidSdkHelper.InitSdk(cxt, true, this);
}
/*
* 直接java调用,如果这样调用,在android 9以前没有题,在android 9以后会抛找不到so方法的异常
* 解决办法是和JLibrary.InitEntry(cxt),分开调用,比如在A类中调用JLibrary.InitEntry(cxt),在B类中调用MdidSdk的方法
* A和B不能存在直接和间接依赖关系,否则也会报错
*
* */
private int DirectCall(Context cxt) {
MdidSdk sdk = new MdidSdk();
return sdk.InitSdk(cxt, this);
}
@Override
public void OnSupport(boolean isSupport, IdSupplier _supplier) {
if (_supplier == null) {
......
......@@ -65,7 +65,7 @@ public class NotifyManager {
.setContentTitle("")
.setContentText("")
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_launcher_main)
.setContent(getRemoteViews(water, step))
.setVibrate(new long[]{0})
.build();
......@@ -98,7 +98,7 @@ public class NotifyManager {
// PendingIntent waterPendingIntent = PendingIntent.getActivity(activity, 0, new Intent(activity, WaterActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews = new RemoteViews(activity.getPackageName(), R.layout.remoteview);
// remoteViews.setTextViewText(R.id.notify_step, "今日步数 " + step + " 步");
remoteViews.setImageViewResource(R.id.icon, R.mipmap.ic_launcher);
remoteViews.setImageViewResource(R.id.icon, R.mipmap.ic_launcher_main);
remoteViews.setOnClickPendingIntent(R.id.notify_root, mainPendingIntent);
// remoteViews.setOnClickPendingIntent(R.id.notify_drink, waterPendingIntent);
return remoteViews;
......
package com.mints.goodmoney.manager
import android.content.Context
import com.bun.miitmdid.core.MdidSdkHelper
import com.bun.supplier.IIdentifierListener
import com.bun.supplier.IdSupplier
/**
* 移动安全联盟 oaid
*/
class OaidManager(val _listener: AppIdsUpdater?) : IIdentifierListener {
fun InitSdk(cxt: Context) {
CallFromReflect(cxt)
}
/*
* 通过反射调用,解决android 9以后的类加载升级,导至找不到so中的方法
*
* */
private fun CallFromReflect(cxt: Context): Int {
return MdidSdkHelper.InitSdk(cxt, true, this)
}
override fun OnSupport(isSupport: Boolean, _supplier: IdSupplier) {
if (_supplier == null) {
return
}
/* String oaid=_supplier.getOaid();
String vaid=_supplier.getVAID();
String aaid=_supplier.getAAID();
String udid=_supplier.getUDID();
StringBuilder builder=new StringBuilder();
builder.append("support: ").append(isSupport?"true":"false").append("\n");
builder.append("UDID: ").append(udid).append("\n");
builder.append("OAID: ").append(oaid).append("\n");
builder.append("VAID: ").append(vaid).append("\n");
builder.append("AAID: ").append(aaid).append("\n");
String idstext=builder.toString();*/
val oaid = _supplier.oaid
_listener?.OnIdsAvalid(oaid)
}
interface AppIdsUpdater {
fun OnIdsAvalid(ids: String)
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ package com.mints.goodmoney.manager;
import android.text.TextUtils;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.mvp.presenters.TrackPresenter;
/**
......@@ -55,6 +56,25 @@ public class TrackManager {
}
}
/**
* 激励视频点击
*/
public void reportClickAdEvent() {
if (trackPresenter != null) {
trackPresenter.reportClickAdEvent();
}
}
/**
* 每日任务是否刷新任务数
*/
public void innerApp() {
if (trackPresenter != null) {
trackPresenter.innerApp();
}
}
/**
* 提现看视频
*/
......@@ -72,4 +92,10 @@ public class TrackManager {
trackPresenter.addCarrierTypeTime(second);
}
}
public void getCommonHallBaseMsg() {
if (trackPresenter != null) {
trackPresenter.getCommonHallBaseMsg();
}
}
}
package com.mints.goodmoney.manager;
import android.content.Context;
import android.text.TextUtils;
import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.mvp.model.AdcodeBean;
import com.mints.goodmoney.mvp.model.UserMsgBean;
......@@ -25,13 +27,23 @@ public class TtCsjAdManager {
public static String TT_AD_BANNER_JULEYUN = "945675532";// 聚乐云
/*激励视频*/
public static String TT_AD_VEDIO_MAIN_DEV = "945561938";// 开发使用
public static String TT_AD_VEDIO_DRINK = "945562032";//喝水打卡
public static String TT_AD_VEDIO_MAIN = "945562036";// 我的界面视频
public static String TT_AD_VEDIO_ERASE = "945562037";// 刮刮乐
public static String TT_AD_VEDIO_TURNABLE = "945562039";// 大转盘
public static String TT_AD_VEDIO_MOREDIALOG = "945562040";// 签到、气泡、离线弹框
public static String TT_AD_VEDIO_DRINK = "945562040";//喝水打卡
public static String TT_AD_VEDIO_MAIN = "945562040";// 我的界面视频
public static String TT_AD_VEDIO_ERASE = "945562040";// 刮刮乐
public static String TT_AD_VEDIO_TURNABLE = "945562040";// 大转盘
public static String TT_AD_VEDIO_MOREDIALOG = "945562040";// 气泡
public static String TT_AD_VEDIO_SIGN = "945562040";// 签到
public static String TT_AD_VEDIO_OFFINELINE = "945562040";// 离线弹框
public static String TT_AD_VEDIO_GAME = "945562067";// 猎豹
public static String TT_AD_VEDIO_JULEYUN = "945675529";// 聚乐云
public static String TT_AD_VEDIO_BIANXIANMAO = "945743459";// 变现猫
public static String TT_AD_VEDIO_BLESSINGBAG = "945730117";// 福袋
public static String TT_AD_VEDIO_HOMEVEDIO = "945744137";// 首页视频翻倍
public static String TT_AD_VEDIO_SMALLHOMEVEDIO = "945744186";// 短视频翻倍
/*全屏视频*/
public static String TT_AD_FULLVEDIO_ALL = "945752969";// 通用
/*信息流*/
public static String TT_AD_NATIVEEXPRESS_XMLY = "945700753";//喜马拉雅信息流
public static String TT_AD_NATIVEEXPRESS_AWARD = "945562047";//信息流弹窗
......@@ -101,19 +113,24 @@ public class TtCsjAdManager {
if (idBean != null) {
// 后台返回 用户注册渠道
// 信息流
TT_AD_NATIVEEXPRESS_AWARD = idBean.getCsj().getCsjv1();
TT_AD_NATIVEEXPRESS_WALK = idBean.getCsj().getCsjv2();
TT_AD_NATIVEEXPRESS_WATER = idBean.getCsj().getCsjv2();
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = idBean.getCsj().getCsjv2();
TT_AD_NATIVEEXPRESS_EAT = idBean.getCsj().getCsjv2();
TT_AD_NATIVEEXPRESS_AWARD = idBean.getCsjv1();
TT_AD_NATIVEEXPRESS_WALK = idBean.getCsjv2();
TT_AD_NATIVEEXPRESS_WATER = idBean.getCsjv2();
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = idBean.getCsjv2();
TT_AD_NATIVEEXPRESS_EAT = idBean.getCsjv2();
// 激励视频
TT_AD_VEDIO_DRINK = idBean.getCsj().getCsjv3();
TT_AD_VEDIO_MAIN = idBean.getCsj().getCsjv3();
TT_AD_VEDIO_ERASE = idBean.getCsj().getCsjv3();
TT_AD_VEDIO_TURNABLE = idBean.getCsj().getCsjv3();
TT_AD_VEDIO_MOREDIALOG = idBean.getCsj().getCsjv3();
TT_AD_VEDIO_DRINK = idBean.getCsjv3();
TT_AD_VEDIO_MAIN = idBean.getCsjv3();
TT_AD_VEDIO_ERASE = idBean.getCsjv3();
TT_AD_VEDIO_TURNABLE = idBean.getCsjv3();
TT_AD_VEDIO_MOREDIALOG = idBean.getCsjv3();
TT_AD_VEDIO_OFFINELINE = idBean.getCsjv3();
TT_AD_VEDIO_BLESSINGBAG = idBean.getCsjv3();
TT_AD_VEDIO_SIGN = idBean.getCsjv3();
TT_AD_VEDIO_HOMEVEDIO = idBean.getCsjv3();
TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getCsjv3();
// banner
TT_AD_BANNER_MY = idBean.getCsj().getCsjv4();
TT_AD_BANNER_MY = idBean.getCsjv4();
return;
}
......@@ -121,6 +138,7 @@ public class TtCsjAdManager {
loadLocalChannel();
}
/**
* 加载本地渠道
*/
......@@ -139,6 +157,11 @@ public class TtCsjAdManager {
TT_AD_VEDIO_ERASE = "945666029";
TT_AD_VEDIO_TURNABLE = "945666029";
TT_AD_VEDIO_MOREDIALOG = "945666029";
TT_AD_VEDIO_OFFINELINE = "945666029";
TT_AD_VEDIO_SIGN = "945666029";
TT_AD_VEDIO_BLESSINGBAG = "945666029";
TT_AD_VEDIO_HOMEVEDIO = "945666029";
TT_AD_VEDIO_SMALLHOMEVEDIO = "945666029";
// banner
TT_AD_BANNER_MY = "945666042";
......@@ -154,12 +177,38 @@ public class TtCsjAdManager {
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = "945627921";
TT_AD_NATIVEEXPRESS_EAT = "945627922";
// 激励视频
TT_AD_VEDIO_DRINK = "945562032";
TT_AD_VEDIO_MAIN = "945562036";
TT_AD_VEDIO_ERASE = "945562037";
TT_AD_VEDIO_TURNABLE = "945562039";
TT_AD_VEDIO_DRINK = "945562040";
TT_AD_VEDIO_MAIN = "945562040";
TT_AD_VEDIO_ERASE = "945562040";
TT_AD_VEDIO_TURNABLE = "945562040";
TT_AD_VEDIO_MOREDIALOG = "945562040";
TT_AD_VEDIO_OFFINELINE = "945562040";
TT_AD_VEDIO_SIGN = "945562040";
TT_AD_VEDIO_BLESSINGBAG = "945730117";
TT_AD_VEDIO_HOMEVEDIO = "945744137";
TT_AD_VEDIO_SMALLHOMEVEDIO = "945744186";
// banner
TT_AD_BANNER_MY = "945661050";
}
/**
* 分享用户代码位
*
* @param idBean
*/
private static void loadShareChannel(AdcodeBean idBean) {
if (idBean != null) {
if (!TextUtils.isEmpty(AppConfig.user_register_channel) &&
AppConfig.user_register_channel.contains("share")) {
TT_AD_VEDIO_BLESSINGBAG = idBean.getSharecsjv1();
TT_AD_VEDIO_OFFINELINE = idBean.getSharecsjv2();
TT_AD_VEDIO_SIGN = idBean.getSharecsjv3();
}
} else {
TT_AD_VEDIO_OFFINELINE = "945730111";
TT_AD_VEDIO_BLESSINGBAG = "945730117";
TT_AD_VEDIO_SIGN = "945730109";
}
}
}
package com.mints.goodmoney.manager
import android.app.Application
import com.mints.goodmoney.MintsApplication
import com.mints.library.utils.CommonUtils
import com.tz.sdk.core.engine.ADEngine
import com.tz.sdk.core.engine.ADEngineConfig
import com.tz.sdk.core.engine.IADEngineState
/**
* 描述:天卓珊瑚激励视频
*/
object TzManager {
/**
* 初始化
*/
fun initTz(application: Application) {
ADEngine.getInstance(application)
.start(ADEngineConfig.Builder(application)
.appKey("547ffff6446c5a8acd4175fb7a71a0d1")
.appSecret("1c00e59f2257bdfdd4ad9363b41621b5")
.appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(false)
.build(),
object : IADEngineState {
override fun onIdle() {}
override fun onStarting() {}
override fun onStarted() {}
override fun onFailed(p0: Int, p1: String?) {}
})
}
}
\ No newline at end of file
......@@ -406,6 +406,4 @@ public class UserManager {
ps.removeByKey(WX_HEADER);
_inst = null;
}
}
package com.mints.goodmoney.manager
import android.content.Context
import android.text.TextUtils
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.mvp.model.AdcodeBean
import com.mints.library.utils.CommonUtils
import com.qq.e.comm.managers.GDTADManager
......@@ -20,13 +22,19 @@ object YlhAdManager {
var YLH_AD_SPLASH_POSTID = "7021944730189381"
/* vedio-postid */
var YLH_AD_VEDIO_DRINK_POSTID = "2031043750380462" //喝水打卡
var YLH_AD_VEDIO_MAIN_POSTID = "8081940760988417" //我的界面视频
var YLH_AD_VEDIO_ERASE_POSTID = "9061142700180449" //挑战刮刮乐
var YLH_AD_VEDIO_TURNABLE_POSTID = "5051746700185561" //大转盘
var YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626" //签到、气泡、离线弹框
var YLH_AD_VEDIO_DRINK_POSTID = "9001346780383626" //喝水打卡
var YLH_AD_VEDIO_MAIN_POSTID = "9001346780383626" //我的界面视频
var YLH_AD_VEDIO_ERASE_POSTID = "9001346780383626" //挑战刮刮乐
var YLH_AD_VEDIO_TURNABLE_POSTID = "9001346780383626" //大转盘
var YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626" //气泡
var YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626" //签到
var YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626" //离线弹框
var YLH_AD_VEDIO_GAME_POSTID = "9051646750686770" //猎豹游戏
var YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云
var YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388" //福袋
var YLH_AD_VEDIO_HOMEVEDIO_POSTID= "4051451341464487" // 首页视频翻倍
var YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID= "9051152341362610" // 短视频翻倍
/*信息流*/
var YLH_AD_NATIVEEXPRESS_JULEYUN = "8041941770890627" //聚乐云
......@@ -51,13 +59,18 @@ object YlhAdManager {
if (idBean != null) {
// 后台返回 用户注册渠道
// 开屏
YLH_AD_SPLASH_POSTID = idBean.ylh.ylhv1
YLH_AD_SPLASH_POSTID = idBean.ylhv1
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID = idBean.ylh.ylhv2
YLH_AD_VEDIO_MAIN_POSTID = idBean.ylh.ylhv2
YLH_AD_VEDIO_ERASE_POSTID = idBean.ylh.ylhv2
YLH_AD_VEDIO_TURNABLE_POSTID = idBean.ylh.ylhv2
YLH_AD_VEDIO_MOREDIALOG_POSTID = idBean.ylh.ylhv2
YLH_AD_VEDIO_DRINK_POSTID = idBean.ylhv2
YLH_AD_VEDIO_MAIN_POSTID = idBean.ylhv2
YLH_AD_VEDIO_ERASE_POSTID = idBean.ylhv2
YLH_AD_VEDIO_TURNABLE_POSTID = idBean.ylhv2
YLH_AD_VEDIO_MOREDIALOG_POSTID = idBean.ylhv2
YLH_AD_VEDIO_BLESSINGBAG_POSTID = idBean.ylhv2
YLH_AD_VEDIO_SIGN_POSTID = idBean.ylhv2
YLH_AD_VEDIO_OFFINELINE_POSTID = idBean.ylhv2
YLH_AD_VEDIO_HOMEVEDIO_POSTID = idBean.ylhv2
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = idBean.ylhv2
return
}
......@@ -67,6 +80,7 @@ object YlhAdManager {
loadLocalChannel()
}
private fun loadLocalChannel() {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (channel.contains(ChannelManager.CHANNEL_TOUTIAO)) {
......@@ -74,11 +88,16 @@ object YlhAdManager {
// 开屏
YLH_AD_SPLASH_POSTID = "4031840694338658"
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID = "7091944614237712"
YLH_AD_VEDIO_MAIN_POSTID = "7091944614237712"
YLH_AD_VEDIO_ERASE_POSTID = "7091944614237712"
YLH_AD_VEDIO_TURNABLE_POSTID = "7091944614237712"
YLH_AD_VEDIO_MOREDIALOG_POSTID = "7091944614237712"
YLH_AD_VEDIO_DRINK_POSTID = "1031552263176415"
YLH_AD_VEDIO_MAIN_POSTID = "1031552263176415"
YLH_AD_VEDIO_ERASE_POSTID = "1031552263176415"
YLH_AD_VEDIO_TURNABLE_POSTID = "1031552263176415"
YLH_AD_VEDIO_MOREDIALOG_POSTID = "1031552263176415"
YLH_AD_VEDIO_SIGN_POSTID = "1031552263176415"
YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1031552263176415"
YLH_AD_VEDIO_OFFINELINE_POSTID = "1031552263176415"
YLH_AD_VEDIO_HOMEVEDIO_POSTID = "1031552263176415"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = "1031552263176415"
return
}
......@@ -87,11 +106,40 @@ object YlhAdManager {
// 开屏
YLH_AD_SPLASH_POSTID = "7021944730189381"
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID = "2031043750380462"
YLH_AD_VEDIO_MAIN_POSTID = "8081940760988417"
YLH_AD_VEDIO_ERASE_POSTID = "9061142700180449"
YLH_AD_VEDIO_TURNABLE_POSTID = "5051746700185561"
YLH_AD_VEDIO_DRINK_POSTID = "9001346780383626"
YLH_AD_VEDIO_MAIN_POSTID = "9001346780383626"
YLH_AD_VEDIO_ERASE_POSTID = "9001346780383626"
YLH_AD_VEDIO_TURNABLE_POSTID = "9001346780383626"
YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626"
YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626"
YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626"
YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388"
YLH_AD_VEDIO_HOMEVEDIO_POSTID = "4051451341464487"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = "9051152341362610"
}
/**
* 分享用户代码位
*
* @param idBean
*/
private fun loadShareChannel(idBean: AdcodeBean?) {
if (idBean != null) {
if (!TextUtils.isEmpty(AppConfig.user_register_channel) &&
AppConfig.user_register_channel.contains("share")) {
YLH_AD_VEDIO_BLESSINGBAG_POSTID = idBean.shareylhv1
YLH_AD_VEDIO_OFFINELINE_POSTID = idBean.shareylhv2
YLH_AD_VEDIO_SIGN_POSTID = idBean.shareylhv3
}
} else {
if (!TextUtils.isEmpty(AppConfig.user_register_channel) &&
AppConfig.user_register_channel.contains("share")) {
YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388"
YLH_AD_VEDIO_SIGN_POSTID = "2091354158635490"
YLH_AD_VEDIO_OFFINELINE_POSTID = "2031954198632389"
}
}
}
}
\ No newline at end of file
......@@ -7,56 +7,72 @@ import java.io.Serializable;
*/
public class AdcodeBean implements Serializable {
private CsjBean csj;
private YlhBean ylh;
private String csjv1;//奖励弹框信息流
private String csjv2;//喝水等 通用信息流
private String csjv3;//激励视频
private String csjv4;//Banner
private String ylhv1;//开屏
private String ylhv2;//激励
private String shareylhv1;
private String shareylhv2;
private String shareylhv3;
private String sharecsjv1;
private String sharecsjv2;
private String sharecsjv3;
private String key;
public CsjBean getCsj() {
return csj;
public String getCsjv1() {
return csjv1;
}
public YlhBean getYlh() {
return ylh;
public String getCsjv2() {
return csjv2;
}
public String getKey() {
return key;
public String getCsjv3() {
return csjv3;
}
public String getCsjv4() {
return csjv4;
}
public class CsjBean implements Serializable {
private String csjv1;//奖励弹框信息流
private String csjv2;//喝水等 通用信息流
private String csjv3;//激励视频
private String csjv4;//Banner
public String getYlhv1() {
return ylhv1;
}
public String getCsjv1() {
return csjv1;
}
public String getYlhv2() {
return ylhv2;
}
public String getCsjv2() {
return csjv2;
}
public String getShareylhv1() {
return shareylhv1;
}
public String getCsjv3() {
return csjv3;
}
public String getShareylhv2() {
return shareylhv2;
}
public String getCsjv4() {
return csjv4;
}
public String getShareylhv3() {
return shareylhv3;
}
public class YlhBean implements Serializable {
private String ylhv1;//开屏
private String ylhv2;//激励
public String getSharecsjv1() {
return sharecsjv1;
}
public String getYlhv1() {
return ylhv1;
}
public String getSharecsjv2() {
return sharecsjv2;
}
public String getYlhv2() {
return ylhv2;
}
public String getSharecsjv3() {
return sharecsjv3;
}
public String getKey() {
return key;
}
}
......@@ -15,11 +15,24 @@ public class BaseResponse<T> implements Serializable {
*/
private int status;
/**
* 状态码
*/
private int code;
/**
* 内容
*/
private String message="";
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
/**
* 结果
*/
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class CommonParamBean implements Serializable {
private boolean showSomeodular = true;
public boolean isShowSomeodular() {
return showSomeodular;
}
}
......@@ -81,14 +81,23 @@ public class DrawcashBean implements Serializable {
public class VedioRules implements Serializable {
private int SDHZ_VEDIO;
private int CSJFULL_VEDIO;
private int CSJ_VEDIO;
private int YLH_VEDIO;
private int FL_VEDIO;
private int CORAL_VEDIO;
public int getCORAL_VEDIO() {
return CORAL_VEDIO;
}
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
public int getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
public int getCSJ_VEDIO() {
return CSJ_VEDIO;
}
......@@ -106,6 +115,7 @@ public class DrawcashBean implements Serializable {
private int vedio;
private double money;
private boolean canCashOut;
private String remark;
public void setCanCashOut(boolean canCashOut) {
this.canCashOut = canCashOut;
......@@ -123,5 +133,8 @@ public class DrawcashBean implements Serializable {
return canCashOut;
}
public String getRemark() {
return remark;
}
}
}
......@@ -9,6 +9,11 @@ public class EventMessage<T> {
this.message = message;
}
public EventMessage(String message, T content) {
this.message = message;
this.content = content;
}
public String getMessage() {
return message;
}
......
......@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class MainVedioMsgBean implements Serializable {
public class MainVideoMsgBean implements Serializable {
private boolean toCreateReward;
private int rewardDoubleCoin;
......
......@@ -202,6 +202,24 @@ public class MyInfo implements Serializable {
private int complete;
private int status = 0;
private int coin;
private int readCoin;
private int needSeconds;
public int getNeedSeconds() {
return needSeconds;
}
public void setNeedSeconds(int needSeconds) {
this.needSeconds = needSeconds;
}
public int getReadCoin() {
return readCoin;
}
public void setReadCoin(int readCoin) {
this.readCoin = readCoin;
}
public int getDoubleCoin() {
return doubleCoin;
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class PanActionInfo implements Serializable {
private int actionType;//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
private String emark;
private int max;
private int complete;
private int time;
private int coin;
public int getActionType() {
return actionType;
}
public String getEmark() {
return emark;
}
public int getMax() {
return max;
}
public int getComplete() {
return complete;
}
public int getTime() {
return time;
}
public int getCoin() {
return coin;
}
}
package com.mints.goodmoney.mvp.model;
import com.tz.sdk.coral.ad.CoralAD;
public class TzTaskBean {
private String icon;
private String title;
private String description;
private String app_url;
private boolean isShCpd;
private CoralAD coralAd;
private CpdModelBean.DataBean.MaterialsBean.TrackerBean trackerBean;
private int coin;
private int state;
private String currentPkgName;
public TzTaskBean(String icon, String title,String description, boolean isShCpd,int coin, int state, String currentPkgName) {
this.icon = icon;
this.title = title;
this.description = description;
this.isShCpd = isShCpd;
this.coralAd = coralAd;
this.coin = coin;
this.state = state;
this.currentPkgName = currentPkgName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public CoralAD getCoralAd() {
return coralAd;
}
public String getApp_url() {
return app_url;
}
public void setApp_url(String app_url) {
this.app_url = app_url;
}
public CpdModelBean.DataBean.MaterialsBean.TrackerBean getTrackerBean() {
return trackerBean;
}
public void setTrackerBean(CpdModelBean.DataBean.MaterialsBean.TrackerBean trackerBean) {
this.trackerBean = trackerBean;
}
public void setCoralAd(CoralAD coralAd) {
this.coralAd = coralAd;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public boolean isShCpd() {
return isShCpd;
}
public void setShCpd(boolean shCpd) {
isShCpd = shCpd;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getCurrentPkgName() {
return currentPkgName;
}
public void setCurrentPkgName(String currentPkgName) {
this.currentPkgName = currentPkgName;
}
}
......@@ -10,9 +10,20 @@ public class UserTaskMsgBean implements Serializable {
private VedioRulesBean vedioRules;
private BlessingBigMsgBean blessingBigMsg;
private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode=null;
private AdcodeBean adcode_v1 = null;
private String ip;
private String channel;
private boolean needReportClickAdEvent;
public boolean isNeedReportClickAdEvent() {
return needReportClickAdEvent;
}
public void setNeedReportClickAdEvent(boolean needReportClickAdEvent) {
this.needReportClickAdEvent = needReportClickAdEvent;
}
public BlessingBigMsgBean getBlessingBigMsgBean() {
return blessingBigMsg;
......@@ -82,6 +93,10 @@ public class UserTaskMsgBean implements Serializable {
}
public AdcodeBean getAdcode() {
return adcode;
return adcode_v1;
}
public String getChannel() {
return channel;
}
}
......@@ -8,6 +8,8 @@ public class VedioRulesBean implements Serializable {
private YlhVedioBean YLH_VEDIO;
private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private boolean flVideoFlag;
public class CsjVedioBean implements Serializable {
......@@ -62,6 +64,33 @@ public class VedioRulesBean implements Serializable {
}
}
public class CORALVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class CsjfullVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public FLVedioBean getFL_VEDIO() {
return FL_VEDIO;
}
......@@ -78,6 +107,14 @@ public class VedioRulesBean implements Serializable {
return SDHZ_VEDIO;
}
public CORALVedioBean getCORAl_VIDEO() {
return CORAL_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
public boolean isFlVideoFlag() {
return flVideoFlag;
}
......
......@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class VedioAdingBean implements Serializable {
public class VideoAdingBean implements Serializable {
private int downloadCoin;
private int curCoin;
private String carrierType;
......
......@@ -57,7 +57,18 @@ public class AwardPresenter extends BasePresenter<AwardView> {
if (riskinfoRateElement != null) {
riskFlag = data.get("riskinfoRate").getAsBoolean();
}
view.getUserTaskMsgSuc(data.get("coin").getAsInt(),riskFlag );
boolean showHigh = false;
JsonElement showHighElement = data.get("showHigh");
if (showHighElement != null) {
showHigh = data.get("showHigh").getAsBoolean();
}
int highCoin = 3000;
JsonElement highCoinElement = data.get("highCoin");
if (highCoinElement != null) {
highCoin = data.get("highCoin").getAsInt();
}
view.getUserTaskMsgSuc(data.get("coin").getAsInt(), riskFlag, showHigh, highCoin);
}
break;
default:
......@@ -154,6 +165,39 @@ public class AwardPresenter extends BasePresenter<AwardView> {
});
}
/**
* 设置高额任务状态
* <p>
* value
*/
public void setHighTaskType(String value) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("carrierType", Constant.CARRIER_HIGH_ACTIVITY);
vo.put("value", value);
AppHttpManager.getInstance(loanApplication)
.call(loanService.setStatusInOneDayByCarrierType(vo), new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onError(Throwable e) {
}
@Override
public void onCompleted() {
super.onCompleted();
}
@Override
public void onNext(BaseResponse<Object> objectBaseResponse) {
if (isLinkView()) return;
switch (objectBaseResponse.getStatus()) {
// if (!TextUtils.equals(value, "3")) {
//// getAutoUserHallBaseMsg()
// }
}
}
});
}
public void riskinfo() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
......
......@@ -56,8 +56,8 @@ class BookPresenter : BasePresenter<BookView>() {
when (code) {
200 -> {
if (data != null) {
val msg=data.getAsJsonObject("msg")
view.readInfo(msg["needSecods"].asInt,msg["coin"].asInt,msg["completeSeconds"].asInt)
val msg = data.getAsJsonObject("msg")
view.readInfo(msg["needSecods"].asInt, msg["coin"].asInt, msg["completeSeconds"].asInt)
}
}
else -> view.showToast(baseResponse.getMessage())
......
package com.mints.goodmoney.mvp.presenters
import android.app.Activity
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class CsjFullVedioAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
package com.mints.goodmoney.mvp.presenters;
import android.text.TextUtils;
import android.view.animation.AccelerateDecelerateInterpolator;
import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.Constant;
......@@ -277,6 +274,43 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
});
}
/**
* 获取京东跳转链接
*/
public void getCommonJdUrl() {
view.showLoading("加载中...");
AppHttpManager.getInstance(loanApplication)
.call(loanService.getCommonJdUrl(),
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.getStatus();
view.showToast(baseResponse.getMessage());
switch (code) {
case 200://成功
view.getCommonJdUrlSuc(baseResponse.getData().get("JDUrl").getAsString());
break;
}
}
});
}
/**
* 风控信息
*/
......
......@@ -5,15 +5,17 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.goodmoney.utils.IPUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.SPUtil
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import net.grandcentrix.tray.AppPreferences
......@@ -84,7 +86,7 @@ class HomePresenter : BasePresenter<HomeView>() {
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHallBaseMsgSuc(baseResponse.getData())
else ->{
else -> {
view.showToast(message)
}
}
......@@ -95,7 +97,7 @@ class HomePresenter : BasePresenter<HomeView>() {
fun getHomeVedioMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHomeVedioMsg(),
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() {
object : BaseSubscriber<BaseResponse<MainVideoMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
......@@ -104,7 +106,7 @@ class HomePresenter : BasePresenter<HomeView>() {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) {
override fun onNext(baseResponse: BaseResponse<MainVideoMsgBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
......@@ -194,4 +196,23 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
/**
* 获取外网ip地址
*/
fun getNetWorkIp() {
if (loanApplication == null) {
return
}
val spUtil = SPUtil.getInstance(loanApplication)
if (spUtil.getString(Constant.OUT_NET_IP).isEmpty()) {
Thread {
val outNetIp: String? = IPUtil.getOutNetIp()
if (outNetIp != null) {
LogUtil.d("AA -> " + outNetIp)
spUtil.putString(Constant.OUT_NET_IP, outNetIp)
}
}.start()
}
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.presenters
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.views.HorizChannelView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
......@@ -13,7 +13,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() {
fun getSmallHomeVedioBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.smallHomeVedioBaseMsg,
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() {
object : BaseSubscriber<BaseResponse<MainVideoMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
......@@ -22,7 +22,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) {
override fun onNext(baseResponse: BaseResponse<MainVideoMsgBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
......
......@@ -3,13 +3,12 @@ package com.mints.goodmoney.mvp.presenters
import com.google.gson.JsonObject
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.mvp.views.KylVedioView
import com.mints.goodmoney.mvp.views.KylVideoView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import java.util.*
class KylVedioPresenter : BasePresenter<KylVedioView>() {
class KylVideoPresenter : BasePresenter<KylVideoView>() {
fun addReadSeconds(seconds: Int) {
val vo = HashMap<String, Any>()
......
......@@ -3,14 +3,13 @@ package com.mints.goodmoney.mvp.presenters
import android.app.Activity
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class MhVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
class MhVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
......
......@@ -14,7 +14,7 @@ import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import java.util.*
class MyPresenter : BasePresenter<MyView>() {
open class MyPresenter : BasePresenter<MyView>() {
/**
* 获取签到内容
......@@ -36,10 +36,8 @@ class MyPresenter : BasePresenter<MyView>() {
override fun onNext(baseResponse: BaseResponse<SignCardBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
when (baseResponse.status) {
200 -> view.getSignInHomePageMsgSuc(baseResponse.data)
}
}
......@@ -67,8 +65,7 @@ class MyPresenter : BasePresenter<MyView>() {
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.status
when (code) {
when (baseResponse.status) {
200 -> view.signInHomePageSuc()
}
}
......@@ -246,10 +243,41 @@ class MyPresenter : BasePresenter<MyView>() {
})
}
/**
* 设置高额任务状态
*
* value
*/
fun setHighTaskType(value: String) {
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CARRIER_HIGH_ACTIVITY
vo["value"] = value
AppHttpManager.getInstance(loanApplication)
.call(loanService.setStatusInOneDayByCarrierType(vo), object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
when (baseResponse.status) {
200 -> {
if (!TextUtils.equals(value, "3")) {
getAutoUserHallBaseMsg()
}
}
}
}
})
}
fun getHallBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHallBaseMsg(),
.call(loanService.hallBaseMsg,
object : BaseSubscriber<BaseResponse<UserTaskMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
......
......@@ -19,4 +19,6 @@ public interface DrawcashView extends BaseView {
void checkJDNewUsersSuc(boolean isJdNewUser, String JDUrl);
void checkJDNewUsersFail();
void getCommonJdUrlSuc(String jdUrl);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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