Commit 2e5ae5df authored by jyx's avatar jyx

天卓激励视频

parent 15b989a1
...@@ -33,7 +33,7 @@ android { ...@@ -33,7 +33,7 @@ android {
UMENG_KEY : RELEASE_UMENG_KEY, UMENG_KEY : RELEASE_UMENG_KEY,
SHARE_KEY : RELEASE_SHARESDK_KEY, SHARE_KEY : RELEASE_SHARESDK_KEY,
SHARE_SECRET : RELEASE_SHARESDK_SECRET, SHARE_SECRET : RELEASE_SHARESDK_SECRET,
"APPLICATION_ID": applicationId] "APPLICATION_ID" : applicationId]
} }
...@@ -254,7 +254,7 @@ dependencies { ...@@ -254,7 +254,7 @@ dependencies {
// 枫岚 // 枫岚
implementation(name: 'mh-adsdk', ext: 'aar') implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar') implementation(name: 'mh-adsdk-ext', ext: 'aar')
implementation(name: 'ks_3.3.5.3', ext: 'aar') // implementation(name: 'ks_3.3.5.3', ext: 'aar')
// 聚乐云 // 聚乐云
implementation(name: 'okgo-2.2', ext: 'aar') implementation(name: 'okgo-2.2', ext: 'aar')
implementation(name: 'scenemodule-2.2', ext: 'aar') implementation(name: 'scenemodule-2.2', ext: 'aar')
...@@ -262,21 +262,26 @@ dependencies { ...@@ -262,21 +262,26 @@ dependencies {
implementation 'com.just.agentweb:agentweb:4.1.2' implementation 'com.just.agentweb:agentweb:4.1.2'
// 喜马拉雅 已集成 // 喜马拉雅 已集成
// 微转阅读 // 微转阅读
implementation (name:'articlesdk-v1.0.6.202012121917-x',ext:'aar') implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar')
//天卓SDK的珊瑚2.1组件 //天卓SDK的珊瑚2.0组件
//快手SDK 2.6.5之后的版本,SDK有依赖appcompat-v7 // implementation("com.android.support:support-v4:28.+")
// implementation 'com.android.support:appcompat-v7:28.0.0' // implementation(name: 'adapt-1.3.3', ext: 'aar')
// implementation 'com.android.support:recyclerview-v7:28.0.0' // implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'tzsdk_coral-2.1.0-20200807130815-release', 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')
// implementation(name: 'ks_adsdk-2.6.8', ext: 'aar')
implementation(name: 'adapt-1.3.3', ext: 'aar') implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar') implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.17', ext: 'aar') implementation(name: 'discovery-2.0.17', ext: 'aar')
implementation(name: 'shanhuAD-1.3.1', ext: 'aar') implementation(name: 'shanhuAD-1.3.1', ext: 'aar')
implementation(name: 'tzsdk_coral-2.1.0-20200807130815-release', ext: 'aar')
implementation(name: 'tzsdk_core-3.0.0-20200807130815-release', ext: 'aar') implementation(name: 'tzsdk_core-3.0.0-20200807130815-release', ext: 'aar')
implementation(name: 'tzsdk_reporter-3.0.0-20200807130815-release', ext: 'aar') implementation(name: 'tzsdk_reporter-3.0.0-20200807130815-release', ext: 'aar')
// testImplementation 'junit:junit:4.13' // testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2' // androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' // androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
......
...@@ -12,17 +12,11 @@ ...@@ -12,17 +12,11 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission <uses-permission android:name="android.permission.WRITE_SETTINGS" />
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<permission <permission android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE" />
android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
...@@ -30,17 +24,13 @@ ...@@ -30,17 +24,13 @@
<uses-permission android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE" /> <uses-permission android:name="com.mints.goodmoney.permission.JPUSH_MESSAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <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.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <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 <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<application <application
android:name=".MintsApplication" android:name=".MintsApplication"
...@@ -257,7 +247,7 @@ ...@@ -257,7 +247,7 @@
<receiver android:name=".service.PushMessageReceiver"> <receiver android:name=".service.PushMessageReceiver">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="${applicationId}"/> <category android:name="${applicationId}" />
</intent-filter> </intent-filter>
</receiver> </receiver>
......
...@@ -6,6 +6,8 @@ import android.content.Context ...@@ -6,6 +6,8 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import cn.jpush.android.api.BasicPushNotificationBuilder import cn.jpush.android.api.BasicPushNotificationBuilder
import cn.jpush.android.api.JPushInterface import cn.jpush.android.api.JPushInterface
import com.downloader.PRDownloader
import com.downloader.PRDownloaderConfig
import com.mints.goodmoney.manager.BxmManager.initBxm import com.mints.goodmoney.manager.BxmManager.initBxm
import com.mob.MobSDK import com.mob.MobSDK
import com.tencent.mm.opensdk.openapi.WXAPIFactory import com.tencent.mm.opensdk.openapi.WXAPIFactory
...@@ -64,6 +66,19 @@ class InitAppService : IntentService("InitializeService") { ...@@ -64,6 +66,19 @@ class InitAppService : IntentService("InitializeService") {
// 变现猫 // 变现猫
initBxm(this.application) initBxm(this.application)
// PR下载附件
initPRDownloader()
}
/**
* PR下载附件
*/
private fun initPRDownloader() {
val config = PRDownloaderConfig.newBuilder()
.setDatabaseEnabled(true)
.build()
PRDownloader.initialize(this, config)
} }
private fun initWzShare() { private fun initWzShare() {
......
...@@ -14,7 +14,6 @@ import com.downloader.PRDownloader; ...@@ -14,7 +14,6 @@ import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig; import com.downloader.PRDownloaderConfig;
import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.BxmManager;
import com.mints.goodmoney.manager.ChannelManager; import com.mints.goodmoney.manager.ChannelManager;
import com.mints.goodmoney.manager.LiebaoManager; import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager; import com.mints.goodmoney.manager.MhManager;
...@@ -101,7 +100,6 @@ public class MintsApplication extends MultiDexApplication { ...@@ -101,7 +100,6 @@ public class MintsApplication extends MultiDexApplication {
@Override @Override
protected void attachBaseContext(Context base) { protected void attachBaseContext(Context base) {
super.attachBaseContext(base); super.attachBaseContext(base);
// MultiDex.install(this);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前 // 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView(); androidPWebView();
...@@ -161,7 +159,7 @@ public class MintsApplication extends MultiDexApplication { ...@@ -161,7 +159,7 @@ public class MintsApplication extends MultiDexApplication {
bindLogger(); bindLogger();
// PR下载附件 // PR下载附件
initPRDownloader(); // initPRDownloader();
// 天卓 // 天卓
TzManager.INSTANCE.initTz(this); TzManager.INSTANCE.initTz(this);
......
package com.mints.goodmoney.ad.tz_ad;
public enum ADType {
CoralCard(102, "卡券", 1),
CoralDownload(103, "下载", 2),
CoralDownloadGdt(134, "下载", 3),
CoralRewardVideo(104, "视频", 4),
CoralRewardVideoGdt(131, "视频", 5),
CoralRewardVideoKs(132, "视频", 6),
CoralSplashImage(125, "开屏", 7),
CoralBanner(130, "横幅", 8),
CoralInfoFeed(128, "信息流", 9),
CoralFullScreenVideo(137, "全屏", 10),
CoralVideoFeed(138, "联盟", 11);
private int mTaskType;
private String mName;
private int mColumnIndex;
ADType(int taskType, String name, int columnIndex) {
mTaskType = taskType;
mName = name;
mColumnIndex = columnIndex;
}
static ADType of(int taskType) {
for (ADType adType : values()) {
if (adType.mTaskType == taskType) {
return adType;
}
}
return null;
}
public int getTaskType() {
return mTaskType;
}
public String getName() {
return mName;
}
public int getColumnIndex() {
return mColumnIndex;
}
public String getCombinedName() {
return mName + (mTaskType != 0 ? mTaskType : "");
}
}
\ No newline at end of file
...@@ -26,23 +26,12 @@ public final class CoralDownload { ...@@ -26,23 +26,12 @@ public final class CoralDownload {
private int mTaskType; private int mTaskType;
/** /**
*
* taskType 珊瑚的任务类型 103正式环境 134测试环境 * taskType 珊瑚的任务类型 103正式环境 134测试环境
*/ */
public CoralDownload(int taskType) { public CoralDownload(int taskType) {
mTaskType = taskType; mTaskType = taskType;
} }
// public boolean i = true;
/**
* i用于判断如果已经在下载了,那就在download回调里return false,不进行重复的下载
*
* @return
*/
// public com.mints.goodmoney.ad.tz_ad.ADType getADType() {
// return com.mints.goodmoney.ad.tz_ad.ADType.CoralDownload;
// }
public void pull() { public void pull() {
new ADLoader(MintsApplication.getContext()) new ADLoader(MintsApplication.getContext())
.get(ADType.APP_DOWNLOAD) .get(ADType.APP_DOWNLOAD)
...@@ -57,34 +46,63 @@ public final class CoralDownload { ...@@ -57,34 +46,63 @@ public final class CoralDownload {
} }
}) })
.load(new CoralADListener() { .load(new CoralADListener() {
/**
* 任务拉取成功
*
* @param rewardTask 积分任务
* @return true:继续拉取广告,false:不拉取广告。默认:继续拉取广告
*/
@Override @Override
public boolean onTaskAvailable(RewardTask rewardTask) { public boolean onTaskAvailable(RewardTask rewardTask) {
return super.onTaskAvailable(rewardTask); return super.onTaskAvailable(rewardTask);
} }
/**
* 任务拉取失败
*
* @param taskType 任务类型
* @param adError 错误信息
* @return true:继续拉取广告,false:不拉取广告。默认:继续拉取广告
*/
@Override @Override
public boolean onTaskNotAvailable(int taskType, ADError adError) { public boolean onTaskNotAvailable(int taskType, ADError adError) {
return super.onTaskNotAvailable(taskType, adError); return super.onTaskNotAvailable(taskType, adError);
} }
/**
* 跳转h5
*
* @param ad 广告
* @param h5Url h5地址
* @return true:使用sdk内部跳转,如果绑定了积分任务,sdk会自动提交任务。
* false:接入方自行跳转显示页面,如果绑定了积分任务,需要接入方手动提交任务。
*/
@Override @Override
public boolean openH5(CoralAD ad, String h5Url) { public boolean openH5(CoralAD ad, String h5Url) {
return super.openH5(ad, h5Url); return super.openH5(ad, h5Url);
} }
/**
* 非广点通的App下载被点击触发
*
* @param downloadProcess 下载数据
* @return true:使用sdk内部进行下载,并自动上报数据,如果绑定了积分任务,可以在后续事件中选择由sdk自动提交任务。
* false:接入方自行创建下载流程,但需要手动上报下载、安装、打开等事件,如果绑定了积分任务,还需要手动提交任务。
*/
@Override @Override
public boolean download(DownloadProcess downloadProcess) { public boolean download(DownloadProcess downloadProcess) {
// if (!i) {
// return false;
// }
if (mOnAdLoadListener != null) { if (mOnAdLoadListener != null) {
mOnAdLoadListener.onGetDownloadProcess(downloadProcess); mOnAdLoadListener.onGetDownloadProcess(downloadProcess);
} }
// downloadProcess.reportDownloadStart();
return false; return false;
} }
/**
* 广告拉取失败
*
* @param adError 错误信息 {@link ADError}
*/
@Override @Override
public void onAdFailed(ADError adError) { public void onAdFailed(ADError adError) {
super.onAdFailed(adError); super.onAdFailed(adError);
...@@ -93,6 +111,11 @@ public final class CoralDownload { ...@@ -93,6 +111,11 @@ public final class CoralDownload {
} }
} }
/**
* 广告拉取成功
*
* @param adList 广告列表
*/
@Override @Override
public void onAdLoaded(List<CoralAD> adList) { public void onAdLoaded(List<CoralAD> adList) {
if (adList != null && adList.size() > 0) { if (adList != null && adList.size() > 0) {
...@@ -106,36 +129,90 @@ public final class CoralDownload { ...@@ -106,36 +129,90 @@ public final class CoralDownload {
} }
} }
/**
* 广告已显示
*
* @param ad 广告(部分广告类型返回为空)
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override @Override
public boolean onAdShow(@Nullable CoralAD ad) { public boolean onAdShow(@Nullable CoralAD ad) {
return false; return false;
} }
/**
* 广告被点击
*
* @param ad 广告(部分广告类型返回为空)
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override @Override
public boolean onAdClicked(@Nullable CoralAD ad) { public boolean onAdClicked(@Nullable CoralAD ad) {
return false; return false;
} }
/**
* App开始下载
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override @Override
public boolean onAppDownloading(@Nullable CoralAD ad, @Nullable String downloadUrl) { public boolean onAppDownloading(@Nullable CoralAD ad, @Nullable String downloadUrl) {
// i = false; // i = false;
return false; return false;
} }
/**
* App下载完成
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override @Override
public boolean onAppDownloaded(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) { public boolean onAppDownloaded(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
// i = true;
return false; return false;
} }
/**
* App已安装
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override @Override
public boolean onAppInstalled(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) { public boolean onAppInstalled(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
return false; return false;
} }
/**
* App已打开激活
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:提交
*/
@Override @Override
public boolean onAppActivated(CoralAD ad, String downloadUrl, String localFile) { public boolean onAppActivated(CoralAD ad, String downloadUrl, String localFile) {
return super.onAppActivated(ad, downloadUrl, localFile); return false;
} }
}); });
} }
......
...@@ -58,9 +58,7 @@ open class BaseVedioAd(activity: Activity) : BaseView { ...@@ -58,9 +58,7 @@ open class BaseVedioAd(activity: Activity) : BaseView {
fun setProgressNoDismiss() { fun setProgressNoDismiss() {
if (progressDialog != null && progressDialog!!.isShowing()) { if (progressDialog != null && progressDialog!!.isShowing()) {
progressDialog!!.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event -> progressDialog!!.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) { keyCode == KeyEvent.KEYCODE_BACK
true
} else false
}) })
} }
} }
......
...@@ -10,14 +10,14 @@ import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter ...@@ -10,14 +10,14 @@ import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
private val TAG = MhVedioAdManager::class.java.simpleName
/** /**
* 枫岚广告视频 * 枫岚广告视频
*/ */
class MhVedioAdManager private constructor(activity: Activity) : class MhVedioAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView { BaseVedioAd(activity), VedioAdManagerView {
private val TAG = MhVedioAdManager::class.java.simpleName
private var mhVdedioAdPresenter: MhVedioAdPresenter? = null private var mhVdedioAdPresenter: MhVedioAdPresenter? = null
private var mhVedioAdListener: MhVedioAdListener? = null private var mhVedioAdListener: MhVedioAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null private var mRewardVideoAd: RewardVideoAd? = null
......
package com.mints.goodmoney.ad.vedio
import android.app.Activity
import androidx.annotation.Nullable
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.mvp.presenters.TzVideoAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.utils.LogUtil
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
private val TAG = TzVideoAdManager::class.java.simpleName
/**
* 天卓广告视频
*/
class TzVideoAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView {
private var isClickScreen: Boolean = true
private var tzVideoAdPresenter: TzVideoAdPresenter? = null
private var tzVideoAdListener: TzVideoAdListener? = null
companion object {
/**
* taskType 珊瑚的任务类型
* 104(正式环境使用,珊瑚和广点通、快手视频混出)
* 131(测试环境使用,广点通视频单出)
*/
const val TZ_REWRAD_TYPE = 132
private var _inst: TzVideoAdManager? = null
fun getInstance(activity: Activity): TzVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = TzVideoAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
tzVideoAdPresenter = TzVideoAdPresenter()
tzVideoAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
ADLoader(activity)
.get(ADType.REWARD_VIDEO)
.from(ADSource.CORAL)
.reward(true)
.count(1)
.with(object : HashMap<String?, Any?>() {
init {
put(CoralAD.Key.TASK_TYPE, TZ_REWRAD_TYPE)
put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().userID)
put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().tokenID)
// 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_TZ, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "")
if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdFail()
}
}
override fun onAdShow(@Nullable ad: CoralAD?): Boolean {
LogUtil.d(TAG, "onAdShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TZ, 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_FL, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdDownload()
}
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")
tzVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_TZ, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TZ, Constant.EVENT_TYPE_THREE, "", "")
if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdSuccess()
}
return super.onVideoClosed(coralAD, s)
}
})
}
fun setTzVedioAdListener(tzVideoAdListener: TzVideoAdListener?) {
this.tzVideoAdListener = tzVideoAdListener
}
interface TzVideoAdListener {
fun tzVideoAdSuccess()
fun tzVideoAdFail()
fun tzVideoAdDownload()
}
override fun onDestory() {
tzVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
activity = null
}
}
\ No newline at end of file
...@@ -138,6 +138,7 @@ object Constant { ...@@ -138,6 +138,7 @@ object Constant {
const val AD_SOURCE_YLH = "YLH" const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子 const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚 const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_TZ = "TZ" //天卓
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重 // 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0" const val EVENT_TYPE_ZERO = "0"
......
...@@ -17,13 +17,13 @@ object TzManager { ...@@ -17,13 +17,13 @@ object TzManager {
* 初始化 * 初始化
*/ */
fun initTz(application: Application) { fun initTz(application: Application) {
val td_channel_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
ADEngine.getInstance(application) ADEngine.getInstance(application)
.start(ADEngineConfig.Builder(application) .start(ADEngineConfig.Builder(application)
.appKey("547ffff6446c5a8acd4175fb7a71a0d1") .appKey("547ffff6446c5a8acd4175fb7a71a0d1")
.appSecret("1c00e59f2257bdfdd4ad9363b41621b5") .appSecret("1c00e59f2257bdfdd4ad9363b41621b5")
.appChannel(td_channel_id) .appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(BuildConfig.DEBUG) .forTest(BuildConfig.DEBUG)
.verbose(BuildConfig.DEBUG)
.build(), .build(),
object : IADEngineState { object : IADEngineState {
override fun onIdle() {} override fun onIdle() {}
......
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.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class TzVideoAdPresenter : BasePresenter<VedioAdManagerView>() {
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
...@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat ...@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat
import cn.sharesdk.framework.ShareSDK import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.TzVideoAdManager
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener import com.mints.goodmoney.login.OnLoginListener
...@@ -187,7 +188,9 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener, ...@@ -187,7 +188,9 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
submitInvitedCode() submitInvitedCode()
} }
R.id.item_cleanCache -> { R.id.item_cleanCache -> {
clearDialog() // clearDialog()
TzVideoAdManager.getInstance(this)?.loadAd(this,10,"A","0")
} }
R.id.item_userAgree -> { R.id.item_userAgree -> {
val bundle = Bundle() val bundle = Bundle()
......
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