Commit e21a92c9 authored by jyx's avatar jyx

Merge branch 'dev_tz' into dev_ad

# Conflicts:
#	GoodMoney/app/build.gradle
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/VedioAdingManager.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjFullVedioAdManager.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/common/AppConfig.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/common/Constant.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/VedioRulesBean.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/DrawcashActivity.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
parents f977ef6b 175d5a63
......@@ -33,7 +33,7 @@ android {
UMENG_KEY : RELEASE_UMENG_KEY,
SHARE_KEY : RELEASE_SHARESDK_KEY,
SHARE_SECRET : RELEASE_SHARESDK_SECRET,
"APPLICATION_ID": applicationId]
"APPLICATION_ID" : applicationId]
}
......@@ -260,17 +260,16 @@ dependencies {
implementation 'com.just.agentweb:agentweb:4.1.2'
// 喜马拉雅 已集成
// 微转阅读
implementation (name:'articlesdk-v1.0.6.202012121917-x',ext:'aar')
//天卓SDK的珊瑚2.1组件
implementation(name: 'tzsdk_coral-2.1.0-20200807130815-release', ext: 'aar')
implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar')
//天卓SDK的珊瑚2.0组件
implementation("com.android.support:support-v4:28.+")
implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.17', ext: 'aar')
implementation(name: 'shanhuAD-1.3.1', 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: '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'
......
......@@ -12,17 +12,11 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<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" />
......@@ -30,17 +24,13 @@
<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.VIBRATE" />
<uses-permission
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<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.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.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<application
android:name=".MintsApplication"
......@@ -257,7 +247,7 @@
<receiver android:name=".service.PushMessageReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="${applicationId}"/>
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
......
......@@ -6,6 +6,8 @@ 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.mob.MobSDK
import com.tencent.mm.opensdk.openapi.WXAPIFactory
......@@ -64,6 +66,19 @@ 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() {
......
......@@ -14,7 +14,6 @@ import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig;
import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.BxmManager;
import com.mints.goodmoney.manager.ChannelManager;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
......@@ -101,7 +100,6 @@ public class MintsApplication extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// MultiDex.install(this);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
......@@ -161,9 +159,9 @@ public class MintsApplication extends MultiDexApplication {
bindLogger();
// PR下载附件
initPRDownloader();
// initPRDownloader();
// 天卓
// 天卓珊瑚
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
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.ad.tz_ad;
import androidx.annotation.Nullable;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.UserManager;
import com.tz.sdk.coral.ad.CoralAD;
......@@ -21,29 +22,21 @@ import java.util.List;
*/
public final class CoralDownload {
public static final int RELEASE_TASK_TYPE = 103;
private int mTaskType;
/**
*
* taskType 珊瑚的任务类型 103正式环境 134测试环境
*/
public CoralDownload(int taskType) {
mTaskType = taskType;
}
public static final int RELEASE_TASK_TYPE_DEBUG = 134;
public static final int RELEASE_TASK_TYPE_RELEASE = 103;
// 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() {
int type;
if (BuildConfig.DEBUG) {
type = RELEASE_TASK_TYPE_DEBUG;
} else {
type = RELEASE_TASK_TYPE_RELEASE;
}
new ADLoader(MintsApplication.getContext())
.get(ADType.APP_DOWNLOAD)
.from(ADSource.CORAL)
......@@ -51,40 +44,69 @@ public final class CoralDownload {
.reward(true)
.with(new HashMap<String, Object>() {
{
put(CoralAD.Key.TASK_TYPE, mTaskType);
put(CoralAD.Key.TASK_TYPE, type);
put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().getUserID());
put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().getTokenID());
}
})
.load(new CoralADListener() {
/**
* 任务拉取成功
*
* @param rewardTask 积分任务
* @return true:继续拉取广告,false:不拉取广告。默认:继续拉取广告
*/
@Override
public boolean onTaskAvailable(RewardTask rewardTask) {
return super.onTaskAvailable(rewardTask);
}
/**
* 任务拉取失败
*
* @param taskType 任务类型
* @param adError 错误信息
* @return true:继续拉取广告,false:不拉取广告。默认:继续拉取广告
*/
@Override
public boolean onTaskNotAvailable(int taskType, ADError adError) {
return super.onTaskNotAvailable(taskType, adError);
}
/**
* 跳转h5
*
* @param ad 广告
* @param h5Url h5地址
* @return true:使用sdk内部跳转,如果绑定了积分任务,sdk会自动提交任务。
* false:接入方自行跳转显示页面,如果绑定了积分任务,需要接入方手动提交任务。
*/
@Override
public boolean openH5(CoralAD ad, String h5Url) {
return super.openH5(ad, h5Url);
}
/**
* 非广点通的App下载被点击触发
*
* @param downloadProcess 下载数据
* @return true:使用sdk内部进行下载,并自动上报数据,如果绑定了积分任务,可以在后续事件中选择由sdk自动提交任务。
* false:接入方自行创建下载流程,但需要手动上报下载、安装、打开等事件,如果绑定了积分任务,还需要手动提交任务。
*/
@Override
public boolean download(DownloadProcess downloadProcess) {
// if (!i) {
// return false;
// }
if (mOnAdLoadListener != null) {
mOnAdLoadListener.onGetDownloadProcess(downloadProcess);
}
// downloadProcess.reportDownloadStart();
return false;
}
/**
* 广告拉取失败
*
* @param adError 错误信息 {@link ADError}
*/
@Override
public void onAdFailed(ADError adError) {
super.onAdFailed(adError);
......@@ -93,6 +115,11 @@ public final class CoralDownload {
}
}
/**
* 广告拉取成功
*
* @param adList 广告列表
*/
@Override
public void onAdLoaded(List<CoralAD> adList) {
if (adList != null && adList.size() > 0) {
......@@ -106,36 +133,90 @@ public final class CoralDownload {
}
}
/**
* 广告已显示
*
* @param ad 广告(部分广告类型返回为空)
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override
public boolean onAdShow(@Nullable CoralAD ad) {
return false;
}
/**
* 广告被点击
*
* @param ad 广告(部分广告类型返回为空)
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override
public boolean onAdClicked(@Nullable CoralAD ad) {
return false;
}
/**
* App开始下载
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override
public boolean onAppDownloading(@Nullable CoralAD ad, @Nullable String downloadUrl) {
// i = false;
return false;
}
/**
* App下载完成
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override
public boolean onAppDownloaded(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
// i = true;
return false;
}
/**
* App已安装
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:不提交
*/
@Override
public boolean onAppInstalled(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
return false;
}
/**
* App已打开激活
*
* @param ad 广告(广点通下载类返回为空)
* @param downloadUrl 下载地址
* @param localFile 本地保存文件
* @return true:如果绑定了积分任务,则sdk立即提交任务,并忽略后续的提交。
* false:如果绑定了积分任务,不做提交,由后续事件决定。
* 默认:提交
*/
@Override
public boolean onAppActivated(CoralAD ad, String downloadUrl, String localFile) {
return super.onAppActivated(ad, downloadUrl, localFile);
return false;
}
});
}
......
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.vedio;
package com.mints.goodmoney.ad.video;
import android.app.Activity;
......@@ -8,18 +8,17 @@ 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.TTNativeExpressManager;
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.VedioAdManagerView;
import com.mints.goodmoney.mvp.views.VideoAdManagerView;
/**
* 穿山甲全屏广告
*/
public class CsjFullVedioAdManager extends BaseVedioAd implements VedioAdManagerView {
public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManagerView {
private static CsjFullVedioAdManager _inst;
private static CsjFullVideoAdManager _inst;
private CsjFullVedioAdPresenter csjFullVedioAdPresenter;
private CsjFullVedioAdListener csjFullVedioAdListener;
......@@ -30,16 +29,16 @@ public class CsjFullVedioAdManager extends BaseVedioAd implements VedioAdManager
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjFullVedioAdManager getInstance(Activity activity) {
public static CsjFullVideoAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
_inst = new CsjFullVedioAdManager(activity);
_inst = new CsjFullVideoAdManager(activity);
return _inst;
}
}
private CsjFullVedioAdManager(Activity activity) {
private CsjFullVideoAdManager(Activity activity) {
super(activity);
init(activity);
}
......@@ -58,7 +57,7 @@ public class CsjFullVedioAdManager extends BaseVedioAd implements VedioAdManager
*/
@SuppressWarnings("SameParameterValue")
@Override
public void loadAd(Activity activity,int curCoin, String carrierType, String extraId) {
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
if (mttFullVideoAd != null) {
mttFullVideoAd.setFullScreenVideoAdInteractionListener(null);
......@@ -143,7 +142,7 @@ public class CsjFullVedioAdManager extends BaseVedioAd implements VedioAdManager
}
@Override
public void onDestory() {
public void onDestroy() {
if (mttFullVideoAd != null) {
mttFullVideoAd.setFullScreenVideoAdInteractionListener(null);
}
......@@ -161,7 +160,9 @@ public class CsjFullVedioAdManager extends BaseVedioAd implements VedioAdManager
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;
......@@ -25,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;
......@@ -40,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);
}
......@@ -64,7 +64,7 @@ public class CsjVedioAdManager extends BaseVedioAd {
}
@Override
public void onDestory() {
public void onDestroy() {
if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(null);
}
......@@ -148,9 +148,9 @@ public class CsjVedioAdManager extends BaseVedioAd {
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();
}
}
......@@ -163,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();
}
}
}
......@@ -196,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();
}
}
......@@ -205,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();
}
}
......@@ -218,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();
}
}
......@@ -298,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
......@@ -6,32 +6,32 @@ 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
}
}
......@@ -43,8 +43,8 @@ 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?) {
......@@ -88,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()
}
}
......@@ -100,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()
}
}
......@@ -114,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()
}
}
......@@ -124,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 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.mvp.presenters.TzVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
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) :
BaseVideoAd(activity), VideoAdManagerView {
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_DEBUG = 131
const val TZ_REWRAD_TYPE_RELEASE = 104
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
val type = if (BuildConfig.DEBUG) {
TZ_REWRAD_TYPE_DEBUG
} else {
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, 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_SH, 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_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 (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_SH, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdSuccess()
}
return super.onVideoClosed(coralAD, s)
}
})
}
fun setTzVideoAdListener(tzVideoAdListener: TzVideoAdListener?) {
this.tzVideoAdListener = tzVideoAdListener
}
interface TzVideoAdListener {
fun tzVideoAdSuccess()
fun tzVideoAdFail()
fun tzVideoAdDownload()
}
override fun onDestroy() {
tzVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
activity = null
}
}
\ 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 = WnVedioAdManager::class.java.simpleName
private val TAG = WnVideoAdManager::class.java.simpleName
/**
* 闪电盒子视频
*/
class WnVedioAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView {
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
}
}
......@@ -43,8 +43,8 @@ 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?) {
......@@ -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()
}
}
......@@ -92,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()
}
}
......@@ -130,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;
......@@ -19,30 +17,30 @@ import com.qq.e.comm.util.AdError;
/**
* 优量汇视频
*/
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);
_inst = new YlhVideoAdManager(activity);
return _inst;
}
}
private YlhVedioAdManager(Activity activity) {
private YlhVideoAdManager(Activity activity) {
super(activity);
init(activity);
}
......@@ -50,15 +48,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
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;
......@@ -157,8 +155,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();
}
}
}
......@@ -182,7 +180,7 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
@Override
public void onReward() {//激励视频广告激励发放
// if (activity != null) {
// ylhVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
// ylhVideoAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
// }
}
......@@ -199,8 +197,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();
}
}
......@@ -213,10 +211,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();
}
}
......@@ -224,13 +222,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();
}
}
});
......@@ -238,15 +236,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();
}
}
......@@ -64,21 +64,26 @@ 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;
/**
* 高额试玩任务标识
......
......@@ -139,7 +139,7 @@ object Constant {
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "SH" //天卓
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -153,14 +153,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"
......
......@@ -9,7 +9,7 @@ import com.tz.sdk.core.engine.ADEngineConfig
import com.tz.sdk.core.engine.IADEngineState
/**
* 描述:天卓激励视频
* 描述:天卓珊瑚激励视频
*/
object TzManager {
......@@ -17,13 +17,13 @@ object TzManager {
* 初始化
*/
fun initTz(application: Application) {
val td_channel_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
ADEngine.getInstance(application)
.start(ADEngineConfig.Builder(application)
.appKey("547ffff6446c5a8acd4175fb7a71a0d1")
.appSecret("1c00e59f2257bdfdd4ad9363b41621b5")
.appChannel(td_channel_id)
.appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(BuildConfig.DEBUG)
.verbose(BuildConfig.DEBUG)
.build(),
object : IADEngineState {
override fun onIdle() {}
......
......@@ -85,7 +85,11 @@ public class DrawcashBean implements Serializable {
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;
}
......
......@@ -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;
......
......@@ -9,6 +9,7 @@ public class VedioRulesBean implements Serializable {
private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private boolean flVideoFlag;
public class CsjVedioBean implements Serializable {
......@@ -63,6 +64,19 @@ 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;
......@@ -74,6 +88,7 @@ public class VedioRulesBean implements Serializable {
public int getRate() {
return rate;
}
}
public FLVedioBean getFL_VEDIO() {
......@@ -92,6 +107,10 @@ public class VedioRulesBean implements Serializable {
return SDHZ_VEDIO;
}
public CORALVedioBean getCORAl_VIDEO() {
return CORAL_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
......
......@@ -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;
......
......@@ -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 CsjFullVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
class CsjFullVedioAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
......
......@@ -2,11 +2,10 @@ package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.*
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
......@@ -92,7 +91,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
}
......@@ -101,7 +100,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()
......
......@@ -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
......
......@@ -3,14 +3,14 @@ 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 WnVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
class TzVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
......
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 WnVideoAdPresenter : 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
......@@ -4,7 +4,7 @@ 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.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -14,7 +14,7 @@ import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class YlhVedioAdPresenter extends BasePresenter<VedioAdManagerView> {
public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> {
private MintsApplication loanApplication;
private LoanService loanService;
......
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
interface HomeView : BaseView {
fun getHallBaseMsgSuc(data: UserTaskMsgBean)
fun getHomeVedioMsgSuc(data: MainVedioMsgBean)
fun getHomeVedioMsgSuc(data: MainVideoMsgBean)
}
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
interface HorizChannelView : BaseView {
fun getHomeVedioMsgSuc(data: MainVedioMsgBean)
fun getHomeVedioMsgSuc(data: MainVideoMsgBean)
}
\ No newline at end of file
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.AccountMsgBean
interface KylVedioView : BaseView {
interface KylVideoView : BaseView {
}
\ No newline at end of file
package com.mints.goodmoney.mvp.views;
public interface VedioAdManagerView extends BaseView {
public interface VideoAdManagerView extends BaseView {
}
......@@ -13,7 +13,7 @@ import com.mints.goodmoney.mvp.model.FriendHallMsgBean;
import com.mints.goodmoney.mvp.model.GoldRecordBean;
import com.mints.goodmoney.mvp.model.KylTabBean;
import com.mints.goodmoney.mvp.model.KylVedioBean;
import com.mints.goodmoney.mvp.model.MainVedioMsgBean;
import com.mints.goodmoney.mvp.model.MainVideoMsgBean;
import com.mints.goodmoney.mvp.model.MealBean;
import com.mints.goodmoney.mvp.model.MorningClockBean;
import com.mints.goodmoney.mvp.model.MyInfo;
......@@ -292,7 +292,7 @@ public interface LoanService {
* @return
*/
@POST("api/getHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getHomeVedioMsg();
Observable<BaseResponse<MainVideoMsgBean>> getHomeVedioMsg();
/**
* 横版视频信息
......@@ -300,7 +300,7 @@ public interface LoanService {
* @return
*/
@POST("api/getSmallHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getSmallHomeVedioBaseMsg();
Observable<BaseResponse<MainVideoMsgBean>> getSmallHomeVedioBaseMsg();
/**
* 小说阅读时长
......
......@@ -6,12 +6,12 @@ import android.view.KeyEvent
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo.Companion.instance
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.VedioAdingBean
import com.mints.goodmoney.mvp.model.VideoAdingBean
import com.mints.goodmoney.mvp.presenters.AwardPresenter
import com.mints.goodmoney.mvp.views.AwardView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
......@@ -34,13 +34,13 @@ import java.util.*
*/
class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private lateinit var vedioAdingManager: VedioAdingManager
private lateinit var videoAdingManager: VideoAdingManager
private val awardPresenter by lazy { AwardPresenter() }
private var mTimer: CountDownTimerSupport? = null
private var curCoin = 0 //传入金币
private var extraId = ""//传入key
private var carrierType = ""//传入载体
private var loadVedioFailCount = 0 // 视频失败次数
private var loadVideoFailCount = 0 // 视频失败次数
override fun getContentViewLayoutID() = R.layout.activity_award
......@@ -53,7 +53,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
override fun initViewsAndEvents() {
awardPresenter.attachView(this)
vedioAdingManager = VedioAdingManager.getInstance(this)
videoAdingManager = VideoAdingManager.getInstance(this)
if (!AppConfig.app_black_flag) {
// 首次进行黑名单校验
......@@ -347,8 +347,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
PreLoadExpressManager.onDestroy()
flAwardAd?.removeAllViews()
vedioAdingManager.setVedioAdingListener(null)
vedioAdingManager.onDestory()
videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestory()
awardPresenter.detachView()
}
......@@ -371,12 +371,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_EATMEAL_SUBSIDY,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
awardVedio()
awardVideo()
}
Constant.CARRIER_BLESSINGBAG_DOUBLE, Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE,
Constant.CARRIER_HOMEVEDIO_DOUBLE, Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE, Constant.CARRIER_RUISHINEWS_DOUBLE -> {
pushUmengEvent()
awardVedio()
awardVideo()
}
Constant.CARRIER_NEW_VISITOR -> {
readyGoThenKill(WxLoginActivity::class.java)
......@@ -392,53 +392,53 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
/**
* 获取激励视频
*/
private fun awardVedio() {
if (vedioAdingManager.getVedioFinishFlag()) {
private fun awardVideo() {
if (videoAdingManager.getVideoFinishFlag()) {
showToast("今日视频已看完,请明天再来吧")
return
}
showLoading("加载中...")
val bean = VedioAdingBean()
val bean = VideoAdingBean()
bean.setCarrierType(carrierType)
bean.setCurCoin(curCoin)
bean.setExtraId(extraId)
loadVedio(vedioAdingManager, bean, true)
loadVideo(videoAdingManager, bean, true)
}
/**
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVedio(vedioAdingManager, bean, false)
loadVideo(videoAdingManager, bean, false)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
override fun videoAdingListenerSuccess(adType: String) {
hideLoading()
vedioAdingSuccess(adType)
videoAdingSuccess(adType)
}
})
if (isFirstLoad) {
// 首页按权重加载
vedioAdingManager.loadAding(this, bean)
videoAdingManager.loadAding(this, bean)
} else {
// 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean)
videoAdingManager.loadFailAding(this, bean)
}
}
......@@ -507,7 +507,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
/**
* 广告返回结果
*/
private fun vedioAdingSuccess(adType: String) {
private fun videoAdingSuccess(adType: String) {
setAdFinshLayout()
}
......
......@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
......@@ -21,7 +21,6 @@ import com.mints.goodmoney.mvp.views.DrawcashView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.DrawcashAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.DrawcashVideoDialog
import com.mints.goodmoney.ui.widgets.JDTintDialog
import com.mints.goodmoney.utils.LogUtil
......@@ -45,7 +44,7 @@ class DrawcashActivity : BaseActivity(),
private var drawcashVideoDialog: DrawcashVideoDialog? = null
private lateinit var vedioAdingManager: VedioAdingManager
private lateinit var vedioAdingManager: VideoAdingManager
private val drawcashPresenter by lazy { DrawcashPresenter() }
private lateinit var drawcashAdapter: DrawcashAdapter
private val userManager by lazy { UserManager.getInstance() }
......@@ -74,7 +73,7 @@ class DrawcashActivity : BaseActivity(),
tvDrawJd.setOnCheckedChangeListener(this)
view_title.text = "提现规则"
vedioAdingManager = VedioAdingManager.getInstance(this)
vedioAdingManager = VideoAdingManager.getInstance(this)
drawcashPresenter.attachView(this)
initListener()
}
......@@ -299,13 +298,24 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO, data.fL_VEDIO,data.csjfulL_VEDIO)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} ylhWeight:${data.ylH_VEDIO} sdhzWeight:${data.sdhZ_VEDIO} flWeight:${data.fL_VEDIO} csjfullWeight:${data.csjfulL_VEDIO}")
vedioAdingManager.initAdWeight(data.csJ_VEDIO,
data.ylH_VEDIO,
data.sdhZ_VEDIO,
data.fL_VEDIO,
data.coraL_VEDIO,
data.csjfulL_VEDIO)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
"ylhWeight:${data.ylH_VEDIO} " +
"sdhzWeight:${data.sdhZ_VEDIO} " +
"csjFullWeight:${data.csjfulL_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO}")
// 广告视频数
AppConfig.csjVedioAdCount = 10
AppConfig.csjVideoAdCount = 10
AppConfig.ylhAdCount = 10
AppConfig.wnVedioAdCount = 10
AppConfig.flVedioAdCount = 10
AppConfig.wnVideoAdCount = 10
AppConfig.flVideoAdCount = 10
AppConfig.shVideoAdCount = 10
AppConfig.csjFullVedioAdCount = 10
}
......
......@@ -9,72 +9,71 @@ import com.downloader.Error
import com.downloader.OnDownloadListener
import com.downloader.PRDownloader
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.VedioAdingBean
import com.mints.goodmoney.mvp.presenters.GamePresenter
import com.mints.goodmoney.mvp.presenters.KylVedioPresenter
import com.mints.goodmoney.mvp.views.KylVedioView
import com.mints.goodmoney.mvp.model.VideoAdingBean
import com.mints.goodmoney.mvp.presenters.KylVideoPresenter
import com.mints.goodmoney.mvp.views.KylVideoView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5
import kotlinx.android.synthetic.main.activity_kyl_vedio.*
import kotlinx.android.synthetic.main.activity_kyl_video.*
/**
* 描述:酷音乐视频
* 作者:孟崔广
* 时间:2021/1/4 15:09
*/
class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView {
companion object {
const val VEDIO_URL = "vedio_url"
const val VIDEO_URL = "video_url"
}
private lateinit var vedioUrl: String
private lateinit var videoUrl: String
private val kylVedioPresenter by lazy { KylVedioPresenter() }
private lateinit var vedioAdingManager: VedioAdingManager
private var loadVedioFailCount = 0
private val kylVideoPresenter by lazy { KylVideoPresenter() }
private lateinit var videoAdingManager: VideoAdingManager
private var loadVideoFailCount = 0
private val videoWallpaper by lazy { VideoWallpaper() }
private var downloadId: Int = -1//vedio下载id
private var downloadVedioSucFlag = false// 下载视频成功
private var downloadId: Int = -1//video下载id
private var downloadVideoSucFlag = false// 下载视频成功
private var cachePath = ""// cache路径
private var vedioName = ""// 视频名称
private var videoName = ""// 视频名称
override fun getContentViewLayoutID() = R.layout.activity_kyl_vedio
override fun getContentViewLayoutID() = R.layout.activity_kyl_video
override fun isApplyKitKatTranslucency() = false
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
vedioUrl = it.getString(VEDIO_URL, "")
videoUrl = it.getString(VIDEO_URL, "")
}
}
override fun initViewsAndEvents() {
if (TextUtils.isEmpty(vedioUrl)) {
if (TextUtils.isEmpty(videoUrl)) {
showToast("加载失败,请稍后重试.")
finish()
return
}
cachePath = cacheDir.path + "/"
vedioAdingManager = VedioAdingManager.getInstance(this)
videoAdingManager = VideoAdingManager.getInstance(this)
initListener()
loadVedio(vedioUrl)
loadVideo(videoUrl)
}
private fun loadVedio(vedioUrl: String) {
jzvdStd?.setUp(vedioUrl, "")
private fun loadVideo(videoUrl: String) {
jzvdStd?.setUp(videoUrl, "")
jzvdStd?.startVideo()
// jzvdStd.setVedioRestart(false)
// jzvdStd.setJzVedioStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVedioStatusListener {
// override fun jzVedioPlaying() {
// jzvdStd.setVideoRestart(false)
// jzvdStd.setJzVideoStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVideoStatusListener {
// override fun jzVideoPlaying() {
// }
// })
}
......@@ -112,22 +111,22 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
//删除缓存文件
CacheUtil.clearAllCache(context)
kylVedioPresenter.detachView()
kylVideoPresenter.detachView()
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.ivBack -> finish()
R.id.ivSetting -> {
awardVedio()
downloadVedioToCacheFile()
awardVideo()
downloadVideoToCacheFile()
}
}
}
private fun downloadVedioToCacheFile() {
vedioName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".mp4"
downloadId = PRDownloader.download(vedioUrl, cachePath, vedioName)
private fun downloadVideoToCacheFile() {
videoName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".mp4"
downloadId = PRDownloader.download(videoUrl, cachePath, videoName)
.build()
// .setOnStartOrResumeListener { }
// .setOnPauseListener {
......@@ -138,7 +137,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
// }
.start(object : OnDownloadListener {
override fun onDownloadComplete() {
downloadVedioSucFlag = true
downloadVideoSucFlag = true
}
override fun onError(error: Error) {
......@@ -155,59 +154,59 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
/**
* 获取激励视频
*/
private fun awardVedio() {
if (vedioAdingManager.vedioFinishFlag) {
private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧")
return
}
loadVedioFailCount = 0
loadVideoFailCount = 0
showLoading("加载中...")
val bean = VedioAdingBean()
val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_KUYINYUE_VEDIO
loadVedio(vedioAdingManager, bean, true)
loadVideo(videoAdingManager, bean, true)
}
/**
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVedio(vedioAdingManager, bean, false)
loadVideo(videoAdingManager, bean, false)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
override fun videoAdingListenerSuccess(adType: String) {
hideLoading()
vedioAdingSuccess(adType)
videoAdingSuccess(adType)
}
})
if (isFirstLoad) {
// 首页按权重加载
vedioAdingManager.loadAding(this, bean)
videoAdingManager.loadAding(this, bean)
} else {
// 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean)
videoAdingManager.loadFailAding(this, bean)
}
}
private fun vedioAdingSuccess(adType: String) {
if (downloadVedioSucFlag) {
LogUtil.d("KylVedioActivity", "name:-->" + cachePath + vedioName)
private fun videoAdingSuccess(adType: String) {
if (downloadVideoSucFlag) {
LogUtil.d("KylVideoActivity", "name:-->" + cachePath + videoName)
try {
showToast("设置壁纸成功")
videoWallpaper.setToWallPaper(this, cachePath + vedioName)
videoWallpaper.setToWallPaper(this, cachePath + videoName)
} catch (e: Exception) {
e.printStackTrace()
}
......
......@@ -10,7 +10,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
......@@ -72,8 +72,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
super.onDestroy()
TTPreLoadCarrierExpressManager.getInstance().onDestroy()
VedioAdingManager.getInstance(this).setVedioAdingListener(null)
VedioAdingManager.getInstance(this).onDestory()
VideoAdingManager.getInstance(this).setVideoAdingListener(null)
VideoAdingManager.getInstance(this).onDestory()
}
public override fun onSaveInstanceState(outState: Bundle) {
......
......@@ -4,12 +4,12 @@ import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.MorningClockBean
import com.mints.goodmoney.mvp.model.VedioAdingBean
import com.mints.goodmoney.mvp.model.VideoAdingBean
import com.mints.goodmoney.mvp.presenters.MorningClockPresenter
import com.mints.goodmoney.mvp.views.MorningClockView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
......@@ -29,8 +29,8 @@ class MorningClockActivity : BaseActivity()
private lateinit var morningClockAdapter: MorningClockAdapter
private var morningClockList: MutableList<MorningClockBean.MorningClockTargetBean>? = null
private lateinit var vedioAdingManager: VedioAdingManager
private var loadVedioFailCount = 0
private lateinit var videoAdingManager: VideoAdingManager
private var loadVideoFailCount = 0
private var morningClockBean: MorningClockBean? = null
override fun getContentViewLayoutID() = R.layout.activity_morning_clock
......@@ -38,7 +38,7 @@ class MorningClockActivity : BaseActivity()
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
vedioAdingManager = VedioAdingManager.getInstance(this)
videoAdingManager = VideoAdingManager.getInstance(this)
initListener()
morningClockPresenter.attachView(this)
......@@ -60,7 +60,7 @@ class MorningClockActivity : BaseActivity()
when (v?.id) {
R.id.ivMorningClockBack -> finish()
R.id.tvMorningClockClick -> {
awardVedio()
awardVideo()
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
......@@ -106,54 +106,54 @@ class MorningClockActivity : BaseActivity()
/**
* 获取激励视频
*/
private fun awardVedio() {
if (vedioAdingManager.vedioFinishFlag) {
private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧")
return
}
showLoading("加载中...")
val bean = VedioAdingBean()
val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_MORNING_CLOCK
loadVedio(vedioAdingManager, bean, true)
loadVideo(videoAdingManager, bean, true)
}
/**
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVedio(vedioAdingManager, bean, false)
loadVideo(videoAdingManager, bean, false)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
override fun videoAdingListenerSuccess(adType: String) {
hideLoading()
vedioAdingSuccess(adType)
videoAdingSuccess(adType)
}
})
if (isFirstLoad) {
// 首页按权重加载
vedioAdingManager.loadAding(this, bean)
videoAdingManager.loadAding(this, bean)
} else {
// 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean)
videoAdingManager.loadFailAding(this, bean)
}
}
private fun vedioAdingSuccess(adType: String) {
private fun videoAdingSuccess(adType: String) {
try {
if (morningClockList != null && morningClockList!!.size > 0) {
for (morningBean in morningClockList!!) {
......
......@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.TzVideoAdManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener
......@@ -187,7 +188,9 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
submitInvitedCode()
}
R.id.item_cleanCache -> {
clearDialog()
// clearDialog()
TzVideoAdManager.getInstance(this)?.loadAd(this,10,"A","0")
}
R.id.item_userAgree -> {
val bundle = Bundle()
......
......@@ -78,7 +78,7 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
mCoralDownload = CoralDownload(CoralDownload.RELEASE_TASK_TYPE).setOnAdLoadListener(this)
mCoralDownload = CoralDownload().setOnAdLoadListener(this)
CacheUtil.clearAllCache(context)
......
......@@ -14,7 +14,7 @@ import com.daimajia.androidanimations.library.YoYo
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.presenters.HorizChannelPresenter
import com.mints.goodmoney.mvp.views.HorizChannelView
import com.mints.goodmoney.ui.activitys.AwardActivity
......@@ -131,8 +131,8 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
rope = null
}
cdvvYilanTime?.setCountDownVedioListener(null)
cdvvYilanTime?.onDestory()
cdvvYilanTime?.setCountDownVideoListener(null)
cdvvYilanTime?.onDestroy()
super.onDestroyView()
}
......@@ -165,7 +165,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
}
override fun getHomeVedioMsgSuc(data: MainVedioMsgBean) {
override fun getHomeVedioMsgSuc(data: MainVideoMsgBean) {
if (activity == null || requireActivity().isFinishing) {
return
}
......@@ -208,7 +208,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
* 红包倒计时初始化
*/
private fun initTimeView() {
cdvvYilanTime.setCountDownVedioListener {
cdvvYilanTime.setCountDownVideoListener {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
vs_tips.visibility = View.VISIBLE
......
......@@ -7,14 +7,12 @@ import com.mints.goodmoney.mvp.model.Data
import com.mints.goodmoney.mvp.model.KylVedioBean
import com.mints.goodmoney.mvp.presenters.KuYinYuePagePresenter
import com.mints.goodmoney.mvp.views.KuYinYuePageView
import com.mints.goodmoney.ui.activitys.KylVedioActivity
import com.mints.goodmoney.ui.activitys.XmlyPlayActivity
import com.mints.goodmoney.ui.activitys.KylVideoActivity
import com.mints.goodmoney.ui.adapter.KylPageAdapter
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.ximalaya.ting.android.opensdk.model.album.Album
import kotlinx.android.synthetic.main.fragment_main_kyl_page.*
/**
......@@ -58,8 +56,8 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
override fun onItemClick(position: Int) {
if (kylData != null && kylData.size > 0) {
val bundle = Bundle()
bundle.putString(KylVedioActivity.VEDIO_URL, kylData[position].url)
readyGo(KylVedioActivity::class.java, bundle)
bundle.putString(KylVideoActivity.VIDEO_URL, kylData[position].url)
readyGo(KylVideoActivity::class.java, bundle)
}
}
......
......@@ -16,11 +16,11 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.presenters.HomePresenter
import com.mints.goodmoney.mvp.views.HomeView
......@@ -67,15 +67,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var rewardCoin = 0 // 小金币
private var littleVideoFragment: YLLittleVideoFragment? = null
private val videoMaxCount = 12 // 当前缓存视频id最大数
private val vedioIdList by lazy { ArrayList<String>() }//记录播放的视频id
private val videoIdList by lazy { ArrayList<String>() }//记录播放的视频id
private var isToCreateReward = true // 是否还有剩余红包 服务器返回
private var isFirstLoadVedio = true // 首次加载视频初始化 本地判断
private var isFirstLoadVideo = true // 首次加载视频初始化 本地判断
private var isAward = false // 是否可以领金币 本地判断
private var isFirstWatchVideo = true// 是否是第一次观看完视频
// 广告权重相关
private var vedioAdingManager: VedioAdingManager? = null
private var videoAdingManager: VideoAdingManager? = null
// 福袋相关
private var rope: YoYoString? = null
......@@ -88,7 +88,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun initViewsAndEvents() {
homePresenter.attachView(this)
vedioAdingManager = VedioAdingManager.getInstance(activity)
videoAdingManager = VideoAdingManager.getInstance(activity)
// 奖励页预加载 信息流广告
PreLoadExpressManager.loadADFrameLayout()
......@@ -139,7 +139,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) {
// 防止界面切换 重置红包动画
// 好兔视频已加载 且 红包已转满
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying) {
if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying) {
cdvvYilanTime.startAnim()
}
}
......@@ -174,7 +174,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) {
// 防止界面切换 重置红包动画
// 好兔视频已加载 且 红包已转满
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying) {
if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying) {
cdvvYilanTime.stopAnim()
}
}
......@@ -191,8 +191,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
rope = null
}
cdvvYilanTime?.onDestory()
cdvvYilanTime?.setCountDownVedioListener(null)
cdvvYilanTime?.onDestroy()
cdvvYilanTime?.setCountDownVideoListener(null)
super.onDestroyView()
}
......@@ -252,7 +252,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
override fun getHomeVedioMsgSuc(data: MainVedioMsgBean) {
override fun getHomeVedioMsgSuc(data: MainVideoMsgBean) {
if (activity == null || requireActivity().isFinishing) {
return
}
......@@ -266,7 +266,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) {
// 防止界面切换 重置倒计时
// 好兔视频已加载 且 红包已转满 且 奖励已领过
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying && !isAward) {
if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying && !isAward) {
cdvvYilanTime?.stopRedbox()
cdvvYilanTime?.reset()
cdvvYilanTime?.start()
......@@ -333,8 +333,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(pager: String, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVedio) {
isFirstLoadVedio = false
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(videoid)
......@@ -355,7 +355,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
// LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete")
addVedioIdList(videoID)
addVideoIdList(videoID)
pauseDownloadTime()
}
......@@ -445,12 +445,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
/**
* 将播放的id记录到list中
*/
private fun addVedioIdList(id: String) {
private fun addVideoIdList(id: String) {
// 达到12个视频时 删除前10个记录
if (vedioIdList.size >= videoMaxCount) {
vedioIdList.subList(0, 10).clear()
if (videoIdList.size >= videoMaxCount) {
videoIdList.subList(0, 10).clear()
}
if (!vedioIdList.contains(id)) vedioIdList.add(id)
if (!videoIdList.contains(id)) videoIdList.add(id)
}
/**
......@@ -465,7 +465,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
*/
private fun resumeDownloadTime(id: String) {
if (!TextUtils.isEmpty(id)) {
if (vedioIdList.contains(id)) {
if (videoIdList.contains(id)) {
cdvvYilanTime?.pause()
return
}
......@@ -488,7 +488,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 红包倒计时初始化
*/
private fun initTimeview() {
cdvvYilanTime?.setCountDownVedioListener {
cdvvYilanTime?.setCountDownVideoListener {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
vs_tips?.visibility = View.VISIBLE
......@@ -503,8 +503,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
cdvvYilanTime?.showRedbox()
stopDownloadTime()
}
val vedioTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime?.setTime(vedioTime)
val videoTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime?.setTime(videoTime)
cdvvYilanTime?.start()
}
......@@ -565,19 +565,31 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate, data.vedioRules.csjfulL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate}" +
" sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate} csjfulLWeight:${data.vedioRules.csjfulL_VEDIO.rate}")
videoAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount}" +
" sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount} csjfullCount:${AppConfig.csjFullVedioAdCount}")
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
}
/**
......
......@@ -13,13 +13,12 @@ import androidx.recyclerview.widget.DividerItemDecoration
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.vedio.CsjFullVedioAdManager
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.*
......@@ -58,6 +57,8 @@ import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal
import java.util.*
private val TAG = MyFragment::class.java.simpleName
/**
* 描述:我
* 作者:孟崔广
......@@ -71,12 +72,10 @@ class MyFragment : BaseFragment(),
View.OnClickListener,
AdapterView.OnItemClickListener {
private val TAG = MyFragment::class.java.simpleName
private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private lateinit var vedioAdingManager: VedioAdingManager
private lateinit var vedioAdingManager: VideoAdingManager
private var loadVedioFailCount = 0
private var userConfig: MyInfo? = null
......@@ -911,7 +910,7 @@ class MyFragment : BaseFragment(),
* 获取激励视频
*/
private fun awardVedio(coin: Int, carrierType: String) {
if (vedioAdingManager.vedioFinishFlag) {
if (vedioAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧")
return
}
......@@ -919,7 +918,7 @@ class MyFragment : BaseFragment(),
loadVedioFailCount = 0
showLoading("加载中...")
val bean = VedioAdingBean()
val bean = VideoAdingBean()
bean.carrierType = carrierType
bean.curCoin = coin
......@@ -929,14 +928,14 @@ class MyFragment : BaseFragment(),
/**
* 加载激励视频
*/
private fun loadVideo(videoAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
hideLoading()
......@@ -946,7 +945,7 @@ class MyFragment : BaseFragment(),
}
}
override fun vedioAdingListenerSuccess(adType: String) {
override fun videoAdingListenerSuccess(adType: String) {
hideLoading()
videoAdingSuccess(adType)
}
......@@ -997,7 +996,7 @@ class MyFragment : BaseFragment(),
private fun initManager() {
BannerManager.init()
vedioAdingManager = VedioAdingManager.getInstance(activity)
vedioAdingManager = VideoAdingManager.getInstance(activity)
if (!TextUtils.isEmpty(userManager.userID)) {
// 登录成功的用户初始化鱼丸盒子
......@@ -1047,18 +1046,31 @@ class MyFragment : BaseFragment(),
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate, data.vedioRules.csjfulL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate}" +
" sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate} csjfulLWeight:${data.vedioRules.csjfulL_VEDIO.rate}")
vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount}" +
" sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount} csjfullCount:${AppConfig.csjFullVedioAdCount}")
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
}
/**
......
......@@ -13,9 +13,9 @@ import com.daimajia.androidanimations.library.YoYo;
import com.mints.goodmoney.R;
public class CountDownVedioView extends LinearLayout {
public class CountDownVideoView extends LinearLayout {
private CountDownVedioListener countDownVedioListener;
private CountDownVideoListener countDownVideoListener;
private CountDownView cdCountVedioView;
private ImageView ivCountVedioRedbox;
......@@ -23,15 +23,15 @@ public class CountDownVedioView extends LinearLayout {
private boolean isPlaying = false;
private YoYo.YoYoString rope;
public CountDownVedioView(Context context) {
public CountDownVideoView(Context context) {
this(context, null);
}
public CountDownVedioView(Context context, @Nullable AttributeSet attrs) {
public CountDownVideoView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public CountDownVedioView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
public CountDownVideoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
......@@ -47,8 +47,8 @@ public class CountDownVedioView extends LinearLayout {
private void initListener() {
cdCountVedioView.setOnLoadingFinishListener(() -> {
if (countDownVedioListener != null) {
countDownVedioListener.finish();
if (countDownVideoListener != null) {
countDownVideoListener.finish();
}
});
}
......@@ -93,11 +93,11 @@ public class CountDownVedioView extends LinearLayout {
ivCountVedioRedbox.setImageResource(img);
}
public void setCountDownVedioListener(CountDownVedioListener countDownVedioListener) {
this.countDownVedioListener = countDownVedioListener;
public void setCountDownVideoListener(CountDownVideoListener countDownVideoListener) {
this.countDownVideoListener = countDownVideoListener;
}
public interface CountDownVedioListener {
public interface CountDownVideoListener {
void finish();
}
......@@ -135,7 +135,7 @@ public class CountDownVedioView extends LinearLayout {
}
}
public void onDestory() {
public void onDestroy() {
if (cdCountVedioView.callOnClick())
if (rope != null) {
......
......@@ -8,10 +8,10 @@ import android.view.View
import android.view.WindowManager
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.model.VedioAdingBean
import com.mints.goodmoney.mvp.model.VideoAdingBean
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.nodoubleclick.AntiShake
......@@ -23,8 +23,8 @@ class DrawcashVideoDialog(activity: Activity) :
private var onClickListener: OnClickListener? = null
private var vedioAdingManager: VedioAdingManager? = null
private var loadVedioFailCount = 0
private var videoAdingManager: VideoAdingManager? = null
private var loadVideoFailCount = 0
private var tvContent: TextView
private var tvNext: TextView
......@@ -39,7 +39,7 @@ class DrawcashVideoDialog(activity: Activity) :
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
vedioAdingManager = VedioAdingManager.getInstance(activity)
videoAdingManager = VideoAdingManager.getInstance(activity)
findViewById<View>(R.id.btn_dialog_drawcash_back).setOnClickListener(this)
tvContent = findViewById<View>(R.id.btn_dialog_drawcash_content) as TextView
......@@ -49,8 +49,8 @@ class DrawcashVideoDialog(activity: Activity) :
}
fun onDestory(){
vedioAdingManager?.setVedioAdingListener(null)
vedioAdingManager?.onDestory()
videoAdingManager?.setVideoAdingListener(null)
videoAdingManager?.onDestory()
activity = null
}
......@@ -63,7 +63,7 @@ class DrawcashVideoDialog(activity: Activity) :
onClickListener?.onClick()
dismiss()
} else {
awardVedio()
awardVideo()
}
}
R.id.btn_dialog_drawcash_back -> {
......@@ -83,40 +83,40 @@ class DrawcashVideoDialog(activity: Activity) :
/**
* 获取激励视频
*/
private fun awardVedio() {
private fun awardVideo() {
if (activity == null) return
loadVedioFailCount = 0
loadVideoFailCount = 0
ToastUtil.show(activity, "加载中...")
val bean = VedioAdingBean()
val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_DRAWCASH
vedioAdingManager?.let { loadVedio(it, bean, true) }
videoAdingManager?.let { loadVideo(it, bean, true) }
}
/**
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager?, bean: VedioAdingBean, isFirstLoad: Boolean) {
private fun loadVideo(videoAdingManager: VideoAdingManager?, bean: VideoAdingBean, isFirstLoad: Boolean) {
if (activity == null) return
vedioAdingManager?.let {
it.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
videoAdingManager?.let {
it.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
ToastUtil.show(activity, "加载超时,请休息一下")
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
ToastUtil.show(activity, "加载超时,请休息一下")
} else {
loadVedio(vedioAdingManager, bean, false)
loadVideo(videoAdingManager, bean, false)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
if (it.isVedioAdDownload) {
override fun videoAdingListenerSuccess(adType: String) {
if (it.isVideoAdDownload) {
TrackManager.getInstance().drawcashVideo()
}
}
......
......@@ -37,7 +37,7 @@
android:src="@mipmap/ic_main_box"
android:visibility="gone" />
<com.mints.goodmoney.ui.widgets.CountDownVedioView
<com.mints.goodmoney.ui.widgets.CountDownVideoView
android:id="@+id/cdvvYilanTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
......
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