Commit 175d5a63 authored by jyx's avatar jyx

珊瑚激励视频集成

parent 2e5ae5df
...@@ -254,7 +254,7 @@ dependencies { ...@@ -254,7 +254,7 @@ dependencies {
// 枫岚 // 枫岚
implementation(name: 'mh-adsdk', ext: 'aar') implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar') implementation(name: 'mh-adsdk-ext', ext: 'aar')
// implementation(name: 'ks_3.3.5.3', ext: 'aar') implementation(name: 'ks_3.3.5.3', ext: 'aar')
// 聚乐云 // 聚乐云
implementation(name: 'okgo-2.2', ext: 'aar') implementation(name: 'okgo-2.2', ext: 'aar')
implementation(name: 'scenemodule-2.2', ext: 'aar') implementation(name: 'scenemodule-2.2', ext: 'aar')
...@@ -264,23 +264,23 @@ dependencies { ...@@ -264,23 +264,23 @@ dependencies {
// 微转阅读 // 微转阅读
implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar') implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar')
//天卓SDK的珊瑚2.0组件 //天卓SDK的珊瑚2.0组件
// implementation("com.android.support:support-v4:28.+") 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.14', ext: 'aar')
// implementation(name: 'shanhuAD.1.2.0', ext: 'aar')
// implementation(name: 'tzsdk_coral-2.0.0-20200807131516-release', ext: 'aar')
// implementation(name: 'tzsdk_core-3.0.0-20200807131516-release', ext: 'aar')
// implementation(name: 'tzsdk_reporter-3.0.0-20200807131516-release', ext: 'aar')
// implementation(name: 'ks_adsdk-2.6.8', ext: 'aar')
implementation(name: 'adapt-1.3.3', ext: 'aar') implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar') implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.17', ext: 'aar') implementation(name: 'discovery-2.0.14', ext: 'aar')
implementation(name: 'shanhuAD-1.3.1', ext: 'aar') implementation(name: 'shanhuAD.1.2.0', ext: 'aar')
implementation(name: 'tzsdk_coral-2.1.0-20200807130815-release', ext: 'aar') implementation(name: 'tzsdk_coral-2.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_core-3.0.0-20200807130815-release', ext: 'aar') implementation(name: 'tzsdk_core-3.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_reporter-3.0.0-20200807130815-release', ext: 'aar') implementation(name: 'tzsdk_reporter-3.0.0-20200807131516-release', ext: 'aar')
// implementation(name: 'ks_adsdk-2.6.8', ext: 'aar')
// implementatiion(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_coral-2.1.0-20200807130815-release', ext: 'aar')
// implementaton(name: 'tzsdk_core-3.0.0-20200807130815-release', ext: 'aar')
// implementation(name: 'tzsdk_reporter-3.0.0-20200807130815-release', ext: 'aar')
// testImplementation 'junit:junit:4.13' // testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2' // androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
...@@ -161,7 +161,7 @@ public class MintsApplication extends MultiDexApplication { ...@@ -161,7 +161,7 @@ public class MintsApplication extends MultiDexApplication {
// PR下载附件 // PR下载附件
// initPRDownloader(); // initPRDownloader();
// 天卓 // 天卓珊瑚
TzManager.INSTANCE.initTz(this); TzManager.INSTANCE.initTz(this);
} }
......
...@@ -2,6 +2,7 @@ package com.mints.goodmoney.ad.tz_ad; ...@@ -2,6 +2,7 @@ package com.mints.goodmoney.ad.tz_ad;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication; import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
import com.tz.sdk.coral.ad.CoralAD; import com.tz.sdk.coral.ad.CoralAD;
...@@ -21,18 +22,21 @@ import java.util.List; ...@@ -21,18 +22,21 @@ import java.util.List;
*/ */
public final class CoralDownload { public final class CoralDownload {
public static final int RELEASE_TASK_TYPE = 103;
private int mTaskType;
/** /**
* taskType 珊瑚的任务类型 103正式环境 134测试环境 * taskType 珊瑚的任务类型 103正式环境 134测试环境
*/ */
public CoralDownload(int taskType) { public static final int RELEASE_TASK_TYPE_DEBUG = 134;
mTaskType = taskType; public static final int RELEASE_TASK_TYPE_RELEASE = 103;
}
public void pull() { public void pull() {
int type;
if (BuildConfig.DEBUG) {
type = RELEASE_TASK_TYPE_DEBUG;
} else {
type = RELEASE_TASK_TYPE_RELEASE;
}
new ADLoader(MintsApplication.getContext()) new ADLoader(MintsApplication.getContext())
.get(ADType.APP_DOWNLOAD) .get(ADType.APP_DOWNLOAD)
.from(ADSource.CORAL) .from(ADSource.CORAL)
...@@ -40,7 +44,7 @@ public final class CoralDownload { ...@@ -40,7 +44,7 @@ public final class CoralDownload {
.reward(true) .reward(true)
.with(new HashMap<String, Object>() { .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.ACCOUNT_ID, UserManager.getInstance().getUserID());
put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().getTokenID()); put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().getTokenID());
} }
......
package com.mints.goodmoney.ad.vedio package com.mints.goodmoney.ad.video
import android.app.Activity import android.app.Activity
import android.content.DialogInterface import android.content.DialogInterface
...@@ -11,7 +11,7 @@ import com.mints.goodmoney.ui.widgets.LoadingDialog ...@@ -11,7 +11,7 @@ import com.mints.goodmoney.ui.widgets.LoadingDialog
import com.mints.goodmoney.utils.ToastUtil import com.mints.goodmoney.utils.ToastUtil
import java.util.HashMap import java.util.HashMap
open class BaseVedioAd(activity: Activity) : BaseView { open class BaseVideoAd(activity: Activity) : BaseView {
open var activity: Activity? = null open var activity: Activity? = null
var progressDialog: LoadingDialog? = null var progressDialog: LoadingDialog? = null
...@@ -111,5 +111,5 @@ open class BaseVedioAd(activity: Activity) : BaseView { ...@@ -111,5 +111,5 @@ open class BaseVedioAd(activity: Activity) : BaseView {
open fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {} 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; import android.app.Activity;
...@@ -25,13 +25,13 @@ import java.util.HashMap; ...@@ -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 AppPreferences ps;
private int curCoin; private int curCoin;
private String extraId; private String extraId;
private CsjVedioAdListener csjVedioAdListener; private CsjVideoAdListener csjVideoAdListener;
Activity activity; Activity activity;
private TTAdNative ttAdNative; private TTAdNative ttAdNative;
...@@ -40,16 +40,16 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -40,16 +40,16 @@ public class CsjVedioAdManager extends BaseVedioAd {
private boolean isClickScreen = true; // 是否点击屏幕跳转广告 private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjVedioAdManager getInstance(Activity activity) { public static CsjVideoAdManager getInstance(Activity activity) {
if (_inst != null) { if (_inst != null) {
return _inst; return _inst;
} else { } else {
_inst = new CsjVedioAdManager(activity); _inst = new CsjVideoAdManager(activity);
return _inst; return _inst;
} }
} }
private CsjVedioAdManager(Activity activity) { private CsjVideoAdManager(Activity activity) {
super(activity); super(activity);
init(activity); init(activity);
} }
...@@ -64,7 +64,7 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -64,7 +64,7 @@ public class CsjVedioAdManager extends BaseVedioAd {
} }
@Override @Override
public void onDestory() { public void onDestroy() {
if (mttRewardVideoAd != null) { if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(null); mttRewardVideoAd.setRewardAdInteractionListener(null);
} }
...@@ -148,9 +148,9 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -148,9 +148,9 @@ public class CsjVedioAdManager extends BaseVedioAd {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
LogUtil.d("CsjVedioAdManager", "onError " + code + message); LogUtil.d("csjVideoAdListener", "onError " + code + message);
if (csjVedioAdListener != null) { if (csjVideoAdListener != null) {
csjVedioAdListener.csjVedioAdFail(); csjVideoAdListener.csjVideoAdFail();
} }
} }
...@@ -163,8 +163,8 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -163,8 +163,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
} else { } else {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail"); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (csjVedioAdListener != null) { if (csjVideoAdListener != null) {
csjVedioAdListener.csjVedioAdFail(); csjVideoAdListener.csjVideoAdFail();
} }
} }
} }
...@@ -196,8 +196,8 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -196,8 +196,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_FOUR, "", ""); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false; isClickScreen = false;
} }
if (csjVedioAdListener != null) { if (csjVideoAdListener != null) {
csjVedioAdListener.csjVedioDownload(); csjVideoAdListener.csjVideoDownload();
} }
} }
...@@ -205,8 +205,8 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -205,8 +205,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
public void onAdClose() { public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", ""); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", "");
if (csjVedioAdListener != null) { if (csjVideoAdListener != null) {
csjVedioAdListener.csjVedioAdSuccess(); csjVideoAdListener.csjVideoAdSuccess();
} }
} }
...@@ -218,8 +218,8 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -218,8 +218,8 @@ public class CsjVedioAdManager extends BaseVedioAd {
public void onVideoError() { public void onVideoError() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "VideoError"); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, "999999", "VideoError");
if (csjVedioAdListener != null) { if (csjVideoAdListener != null) {
csjVedioAdListener.csjVedioAdFail(); csjVideoAdListener.csjVideoAdFail();
} }
} }
...@@ -298,15 +298,15 @@ public class CsjVedioAdManager extends BaseVedioAd { ...@@ -298,15 +298,15 @@ public class CsjVedioAdManager extends BaseVedioAd {
return vo; return vo;
} }
public void setCsjVedioAdListener(CsjVedioAdListener csjVedioAdListener) { public void setCsjVideoAdListener(CsjVideoAdListener csjVideoAdListener) {
this.csjVedioAdListener = csjVedioAdListener; this.csjVideoAdListener = csjVideoAdListener;
} }
public interface CsjVedioAdListener { public interface CsjVideoAdListener {
void csjVedioAdFail(); 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 android.app.Activity
import com.maplehaze.adsdk.video.RewardVideoAd import com.maplehaze.adsdk.video.RewardVideoAd
...@@ -6,32 +6,32 @@ import com.mints.goodmoney.common.AppConfig ...@@ -6,32 +6,32 @@ import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter import com.mints.goodmoney.mvp.presenters.MhVideoAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
private val TAG = MhVedioAdManager::class.java.simpleName private val TAG = MhVideoAdManager::class.java.simpleName
/** /**
* 枫岚广告视频 * 枫岚广告视频
*/ */
class MhVedioAdManager private constructor(activity: Activity) : class MhVideoAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView { BaseVideoAd(activity), VideoAdManagerView {
private var mhVdedioAdPresenter: MhVedioAdPresenter? = null private var mhVideoAdPresenter: MhVideoAdPresenter? = null
private var mhVedioAdListener: MhVedioAdListener? = null private var mhVideoAdListener: MhVideoAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
override var activity: Activity? = null override var activity: Activity? = null
companion object { companion object {
private var _inst: MhVedioAdManager? = null private var _inst: MhVideoAdManager? = null
fun getInstance(activity: Activity): MhVedioAdManager? { fun getInstance(activity: Activity): MhVideoAdManager? {
return if (_inst != null) { return if (_inst != null) {
_inst _inst
} else { } else {
_inst = MhVedioAdManager(activity) _inst = MhVideoAdManager(activity)
_inst _inst
} }
} }
...@@ -43,8 +43,8 @@ class MhVedioAdManager private constructor(activity: Activity) : ...@@ -43,8 +43,8 @@ class MhVedioAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) { private fun init(activity: Activity) {
this.activity = activity this.activity = activity
mhVdedioAdPresenter = MhVedioAdPresenter() mhVideoAdPresenter = MhVideoAdPresenter()
mhVdedioAdPresenter?.attachView(this) mhVideoAdPresenter?.attachView(this)
} }
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) { override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
...@@ -88,8 +88,8 @@ class MhVedioAdManager private constructor(activity: Activity) : ...@@ -88,8 +88,8 @@ class MhVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false isClickScreen = false
} }
if (mhVedioAdListener != null) { if (mhVideoAdListener != null) {
mhVedioAdListener?.mhVedioAdDownload() mhVideoAdListener?.mhVideoAdDownload()
} }
} }
...@@ -100,12 +100,12 @@ class MhVedioAdManager private constructor(activity: Activity) : ...@@ -100,12 +100,12 @@ class MhVedioAdManager private constructor(activity: Activity) :
override fun onADClose() { override fun onADClose() {
LogUtil.d(TAG, "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, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
if (mhVedioAdListener != null) { if (mhVideoAdListener != null) {
mhVedioAdListener?.mhVedioAdSuccess() mhVideoAdListener?.mhVideoAdSuccess()
} }
} }
...@@ -114,8 +114,8 @@ class MhVedioAdManager private constructor(activity: Activity) : ...@@ -114,8 +114,8 @@ class MhVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ONE, (p0).toString(), "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
if (mhVedioAdListener != null) { if (mhVideoAdListener != null) {
mhVedioAdListener?.mhVedioAdFail() mhVideoAdListener?.mhVideoAdFail()
} }
} }
...@@ -124,18 +124,18 @@ class MhVedioAdManager private constructor(activity: Activity) : ...@@ -124,18 +124,18 @@ class MhVedioAdManager private constructor(activity: Activity) :
mRewardVideoAd?.loadAd() mRewardVideoAd?.loadAd()
} }
fun setMhVedioAdListener(mhVedioAdListener: MhVedioAdListener?) { fun setMhVideoAdListener(mhVideoAdListener: MhVideoAdListener?) {
this.mhVedioAdListener = mhVedioAdListener this.mhVideoAdListener = mhVideoAdListener
} }
interface MhVedioAdListener { interface MhVideoAdListener {
fun mhVedioAdSuccess() fun mhVideoAdSuccess()
fun mhVedioAdFail() fun mhVideoAdFail()
fun mhVedioAdDownload() fun mhVideoAdDownload()
} }
override fun onDestory() { override fun onDestroy() {
mhVdedioAdPresenter?.let { mhVideoAdPresenter?.let {
it.dispose() it.dispose()
it.detachView() it.detachView()
} }
......
package com.mints.goodmoney.ad.vedio package com.mints.goodmoney.ad.video
import android.app.Activity import android.app.Activity
import androidx.annotation.Nullable import androidx.annotation.Nullable
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.presenters.TzVideoAdPresenter import com.mints.goodmoney.mvp.presenters.TzVideoAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
import com.tz.sdk.coral.ad.CoralAD import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.coral.callback.CoralVideoListener import com.tz.sdk.coral.callback.CoralVideoListener
...@@ -19,10 +20,10 @@ import com.tz.sdk.core.loader.ADLoader ...@@ -19,10 +20,10 @@ import com.tz.sdk.core.loader.ADLoader
private val TAG = TzVideoAdManager::class.java.simpleName private val TAG = TzVideoAdManager::class.java.simpleName
/** /**
* 天卓广告视频 * 天卓珊瑚广告视频
*/ */
class TzVideoAdManager private constructor(activity: Activity) : class TzVideoAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView { BaseVideoAd(activity), VideoAdManagerView {
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
...@@ -36,7 +37,8 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -36,7 +37,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
* 104(正式环境使用,珊瑚和广点通、快手视频混出) * 104(正式环境使用,珊瑚和广点通、快手视频混出)
* 131(测试环境使用,广点通视频单出) * 131(测试环境使用,广点通视频单出)
*/ */
const val TZ_REWRAD_TYPE = 132 const val TZ_REWRAD_TYPE_DEBUG = 131
const val TZ_REWRAD_TYPE_RELEASE = 104
private var _inst: TzVideoAdManager? = null private var _inst: TzVideoAdManager? = null
fun getInstance(activity: Activity): TzVideoAdManager? { fun getInstance(activity: Activity): TzVideoAdManager? {
...@@ -63,6 +65,12 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -63,6 +65,12 @@ class TzVideoAdManager private constructor(activity: Activity) :
this.activity = activity this.activity = activity
isClickScreen = true isClickScreen = true
val type = if (BuildConfig.DEBUG) {
TZ_REWRAD_TYPE_DEBUG
} else {
TZ_REWRAD_TYPE_RELEASE
}
ADLoader(activity) ADLoader(activity)
.get(ADType.REWARD_VIDEO) .get(ADType.REWARD_VIDEO)
.from(ADSource.CORAL) .from(ADSource.CORAL)
...@@ -70,7 +78,7 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -70,7 +78,7 @@ class TzVideoAdManager private constructor(activity: Activity) :
.count(1) .count(1)
.with(object : HashMap<String?, Any?>() { .with(object : HashMap<String?, Any?>() {
init { init {
put(CoralAD.Key.TASK_TYPE, TZ_REWRAD_TYPE) put(CoralAD.Key.TASK_TYPE, type)
put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().userID) put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().userID)
put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().tokenID) put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().tokenID)
// put(CoralAD.Key.VIDEO_AUTO_PLAY, true) //拉取成功后是否自动播放视频,非必须,默认true // put(CoralAD.Key.VIDEO_AUTO_PLAY, true) //拉取成功后是否自动播放视频,非必须,默认true
...@@ -80,18 +88,18 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -80,18 +88,18 @@ class TzVideoAdManager private constructor(activity: Activity) :
override fun onAdLoaded(adList: List<CoralAD>?) { override fun onAdLoaded(adList: List<CoralAD>?) {
LogUtil.d(TAG, "onAdLoaded") LogUtil.d(TAG, "onAdLoaded")
if (adList != null && adList.isNotEmpty()) { // if (adList != null && adList.isNotEmpty()) {
val ad = adList[0] // val ad = adList[0]
// ad.playVideo(activity) // ad.playVideo(activity)
} else { // } else {
//
} // }
} }
override fun onAdFailed(adError: ADError) { override fun onAdFailed(adError: ADError) {
LogUtil.d(TAG, "onAdFailed") LogUtil.d(TAG, "onAdFailed")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TZ, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "")
if (tzVideoAdListener != null) { if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdFail() tzVideoAdListener?.tzVideoAdFail()
...@@ -101,7 +109,7 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -101,7 +109,7 @@ class TzVideoAdManager private constructor(activity: Activity) :
override fun onAdShow(@Nullable ad: CoralAD?): Boolean { override fun onAdShow(@Nullable ad: CoralAD?): Boolean {
LogUtil.d(TAG, "onAdShow") LogUtil.d(TAG, "onAdShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TZ, Constant.EVENT_TYPE_ZERO, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ZERO, "", "")
return super.onAdShow(ad) return super.onAdShow(ad)
} }
...@@ -114,7 +122,7 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -114,7 +122,7 @@ class TzVideoAdManager private constructor(activity: Activity) :
if (isClickScreen) { if (isClickScreen) {
// 防止重复 // 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false isClickScreen = false
} }
if (tzVideoAdListener != null) { if (tzVideoAdListener != null) {
...@@ -157,9 +165,9 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -157,9 +165,9 @@ class TzVideoAdManager private constructor(activity: Activity) :
override fun onVideoClosed(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean { override fun onVideoClosed(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean {
LogUtil.d(TAG, "onVideoClosed") LogUtil.d(TAG, "onVideoClosed")
tzVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_TZ, extraId, curCoin)) tzVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SH, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TZ, Constant.EVENT_TYPE_THREE, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
if (tzVideoAdListener != null) { if (tzVideoAdListener != null) {
tzVideoAdListener?.tzVideoAdSuccess() tzVideoAdListener?.tzVideoAdSuccess()
...@@ -171,7 +179,7 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -171,7 +179,7 @@ class TzVideoAdManager private constructor(activity: Activity) :
} }
fun setTzVedioAdListener(tzVideoAdListener: TzVideoAdListener?) { fun setTzVideoAdListener(tzVideoAdListener: TzVideoAdListener?) {
this.tzVideoAdListener = tzVideoAdListener this.tzVideoAdListener = tzVideoAdListener
} }
...@@ -181,7 +189,7 @@ class TzVideoAdManager private constructor(activity: Activity) : ...@@ -181,7 +189,7 @@ class TzVideoAdManager private constructor(activity: Activity) :
fun tzVideoAdDownload() fun tzVideoAdDownload()
} }
override fun onDestory() { override fun onDestroy() {
tzVideoAdPresenter?.let { tzVideoAdPresenter?.let {
it.dispose() it.dispose()
it.detachView() it.detachView()
......
package com.mints.goodmoney.ad.vedio package com.mints.goodmoney.ad.video
import android.app.Activity import android.app.Activity
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.WnManager import com.mints.goodmoney.manager.WnManager
import com.mints.goodmoney.mvp.presenters.WnVedioAdPresenter import com.mints.goodmoney.mvp.presenters.WnVideoAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
import com.wannuosili.sdk.* import com.wannuosili.sdk.*
private val TAG = WnVedioAdManager::class.java.simpleName private val TAG = WnVideoAdManager::class.java.simpleName
/** /**
* 闪电盒子视频 * 闪电盒子视频
*/ */
class WnVedioAdManager private constructor(activity: Activity) : class WnVideoAdManager private constructor(activity: Activity) :
BaseVedioAd(activity), VedioAdManagerView { BaseVideoAd(activity), VideoAdManagerView {
private var wnVedioAdPresenter: WnVedioAdPresenter? = null private var wnVideoAdPresenter: WnVideoAdPresenter? = null
private var wnVedioAdListener: WnVedioAdListener? = null private var wnVideoAdListener: WnVideoAdListener? = null
private var mRewardVideoAd: WNRewardVideoAd? = null private var mRewardVideoAd: WNRewardVideoAd? = null
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
override var activity: Activity? = null override var activity: Activity? = null
companion object { companion object {
private var _inst: WnVedioAdManager? = null private var _inst: WnVideoAdManager? = null
fun getInstance(activity: Activity): WnVedioAdManager? { fun getInstance(activity: Activity): WnVideoAdManager? {
return if (_inst != null) { return if (_inst != null) {
_inst _inst
} else { } else {
_inst = WnVedioAdManager(activity) _inst = WnVideoAdManager(activity)
_inst _inst
} }
} }
...@@ -43,8 +43,8 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -43,8 +43,8 @@ class WnVedioAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) { private fun init(activity: Activity) {
this.activity = activity this.activity = activity
wnVedioAdPresenter = WnVedioAdPresenter() wnVideoAdPresenter = WnVideoAdPresenter()
wnVedioAdPresenter?.attachView(this) wnVideoAdPresenter?.attachView(this)
} }
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) { override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
...@@ -69,8 +69,8 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -69,8 +69,8 @@ class WnVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ONE, (code).toString(), message) TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ONE, (code).toString(), message)
if (wnVedioAdListener != null) { if (wnVideoAdListener != null) {
wnVedioAdListener?.wnVedioAdFail() wnVideoAdListener?.wnVideoAdFail()
} }
} }
...@@ -92,18 +92,18 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -92,18 +92,18 @@ class WnVedioAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_FOUR, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false isClickScreen = false
} }
if (wnVedioAdListener != null) { if (wnVideoAdListener != null) {
wnVedioAdListener?.wnVedioAdDownload() wnVideoAdListener?.wnVideoAdDownload()
} }
} }
override fun onAdClose() { 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, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
if (wnVedioAdListener != null) { if (wnVideoAdListener != null) {
wnVedioAdListener?.wnVedioAdSuccess() wnVideoAdListener?.wnVideoAdSuccess()
} }
} }
...@@ -130,18 +130,18 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -130,18 +130,18 @@ class WnVedioAdManager private constructor(activity: Activity) :
}) })
} }
fun setWnVedioAdListener(wnVedioAdListener: WnVedioAdListener?) { fun setWnVideoAdListener(wnVideoAdListener: WnVideoAdListener?) {
this.wnVedioAdListener = wnVedioAdListener this.wnVideoAdListener = wnVideoAdListener
} }
interface WnVedioAdListener { interface WnVideoAdListener {
fun wnVedioAdSuccess() fun wnVideoAdSuccess()
fun wnVedioAdFail() fun wnVideoAdFail()
fun wnVedioAdDownload() fun wnVideoAdDownload()
} }
override fun onDestory() { override fun onDestroy() {
wnVedioAdPresenter?.let { wnVideoAdPresenter?.let {
it.dispose() it.dispose()
it.detachView() it.detachView()
} }
......
package com.mints.goodmoney.ad.vedio; package com.mints.goodmoney.ad.video;
import android.app.Activity; import android.app.Activity;
import android.os.SystemClock; import android.os.SystemClock;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig; import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager; import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.YlhAdManager; import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVedioAdPresenter; import com.mints.goodmoney.mvp.presenters.YlhVideoAdPresenter;
import com.mints.goodmoney.mvp.views.VedioAdManagerView; import com.mints.goodmoney.mvp.views.VideoAdManagerView;
import com.mints.goodmoney.utils.LogUtil; 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.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener; import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError; import com.qq.e.comm.util.AdError;
...@@ -19,30 +17,30 @@ 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 RewardVideoAD rewardVideoAD;
private YlhVedioAdPresenter ylhVedioAdPresenter; private YlhVideoAdPresenter ylhVideoAdPresenter;
private YlhVedioAdListener ylhVedioAdListener; private YlhVideoAdListener ylhVideoAdListener;
Activity activity; Activity activity;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告 private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVedioAdManager getInstance(Activity activity) { public static YlhVideoAdManager getInstance(Activity activity) {
if (_inst != null) { if (_inst != null) {
return _inst; return _inst;
} else { } else {
_inst = new YlhVedioAdManager(activity); _inst = new YlhVideoAdManager(activity);
return _inst; return _inst;
} }
} }
private YlhVedioAdManager(Activity activity) { private YlhVideoAdManager(Activity activity) {
super(activity); super(activity);
init(activity); init(activity);
} }
...@@ -50,15 +48,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -50,15 +48,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
private void init(Activity activity) { private void init(Activity activity) {
this.activity = activity; this.activity = activity;
ylhVedioAdPresenter = new YlhVedioAdPresenter(); ylhVideoAdPresenter = new YlhVideoAdPresenter();
ylhVedioAdPresenter.attachView(this); ylhVideoAdPresenter.attachView(this);
} }
@Override @Override
public void onDestory() { public void onDestroy() {
if (ylhVedioAdPresenter != null) { if (ylhVideoAdPresenter != null) {
ylhVedioAdPresenter.dispose(); ylhVideoAdPresenter.dispose();
ylhVedioAdPresenter.detachView(); ylhVideoAdPresenter.detachView();
} }
activity = null; activity = null;
...@@ -157,8 +155,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -157,8 +155,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
e.printStackTrace(); e.printStackTrace();
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, "999999", "Load Fail"); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, "999999", "Load Fail");
if (ylhVedioAdListener != null) { if (ylhVideoAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail(); ylhVideoAdListener.ylhVideoAdFail();
} }
} }
} }
...@@ -182,7 +180,7 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -182,7 +180,7 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
@Override @Override
public void onReward() {//激励视频广告激励发放 public void onReward() {//激励视频广告激励发放
// if (activity != null) { // if (activity != null) {
// ylhVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType)); // ylhVideoAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
// } // }
} }
...@@ -199,8 +197,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -199,8 +197,8 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_FOUR, "", ""); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false; isClickScreen = false;
} }
if (ylhVedioAdListener != null) { if (ylhVideoAdListener != null) {
ylhVedioAdListener.ylhVedioAdDownload(); ylhVideoAdListener.ylhVideoAdDownload();
} }
} }
...@@ -213,10 +211,10 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -213,10 +211,10 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
public void onADClose() {//激励视频广告被关闭 public void onADClose() {//激励视频广告被关闭
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_THREE, "", ""); 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) { if (ylhVideoAdListener != null) {
ylhVedioAdListener.ylhVedioAdSuccess(); ylhVideoAdListener.ylhVideoAdSuccess();
} }
} }
...@@ -224,13 +222,13 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -224,13 +222,13 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述 public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述
if (adError != null) { if (adError != null) {
LogUtil.d("YlhVedioAdManager", "onError " + adError.getErrorCode() + adError.getErrorMsg()); LogUtil.d("YlhVideoAdManager", "onError " + adError.getErrorCode() + adError.getErrorMsg());
// 0 成功 1失败 2点击 3-有效展示 // 0 成功 1失败 2点击 3-有效展示
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, String.valueOf(adError.getErrorCode()), adError.getErrorMsg()); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, String.valueOf(adError.getErrorCode()), adError.getErrorMsg());
} }
if (ylhVedioAdListener != null) { if (ylhVideoAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail(); ylhVideoAdListener.ylhVideoAdFail();
} }
} }
}); });
...@@ -238,15 +236,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView ...@@ -238,15 +236,15 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
rewardVideoAD.loadAD(); rewardVideoAD.loadAD();
} }
public void setYlhVedioAdListener(YlhVedioAdListener ylhVedioAdListener) { public void setYlhVideoAdListener(YlhVideoAdListener ylhVideoAdListener) {
this.ylhVedioAdListener = ylhVedioAdListener; this.ylhVideoAdListener = ylhVideoAdListener;
} }
public interface YlhVedioAdListener { public interface YlhVideoAdListener {
void ylhVedioAdFail(); void ylhVideoAdFail();
void ylhVedioAdSuccess(); void ylhVideoAdSuccess();
void ylhVedioAdDownload(); void ylhVideoAdDownload();
} }
} }
...@@ -64,17 +64,21 @@ public class AppConfig { ...@@ -64,17 +64,21 @@ public class AppConfig {
*/ */
public static int ylhAdCount = 5; 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; public static int flVideoAdCount = 5;
/**
* shVideo 剩余广告播放数
*/
public static int shVideoAdCount = 5;
/** /**
* 高额试玩任务标识 * 高额试玩任务标识
......
...@@ -138,7 +138,7 @@ object Constant { ...@@ -138,7 +138,7 @@ object Constant {
const val AD_SOURCE_YLH = "YLH" const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子 const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚 const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_TZ = "TZ" //天卓 const val AD_SOURCE_SH = "SH" //天卓
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重 // 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0" const val EVENT_TYPE_ZERO = "0"
...@@ -158,6 +158,7 @@ object Constant { ...@@ -158,6 +158,7 @@ object Constant {
const val YLH_VEDIO_AD = "YLH_VEDIO_AD" const val YLH_VEDIO_AD = "YLH_VEDIO_AD"
const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD" const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD"
const val FL_VEDIO_AD = "Fl_VEDIO_AD" const val FL_VEDIO_AD = "Fl_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD"
// 游戏类型 // 游戏类型
......
...@@ -9,7 +9,7 @@ import com.tz.sdk.core.engine.ADEngineConfig ...@@ -9,7 +9,7 @@ import com.tz.sdk.core.engine.ADEngineConfig
import com.tz.sdk.core.engine.IADEngineState import com.tz.sdk.core.engine.IADEngineState
/** /**
* 描述:天卓激励视频 * 描述:天卓珊瑚激励视频
*/ */
object TzManager { object TzManager {
......
...@@ -84,7 +84,11 @@ public class DrawcashBean implements Serializable { ...@@ -84,7 +84,11 @@ public class DrawcashBean implements Serializable {
private int CSJ_VEDIO; private int CSJ_VEDIO;
private int YLH_VEDIO; private int YLH_VEDIO;
private int FL_VEDIO; private int FL_VEDIO;
private int CORAL_VEDIO;
public int getCORAL_VEDIO() {
return CORAL_VEDIO;
}
public int getSDHZ_VEDIO() { public int getSDHZ_VEDIO() {
return SDHZ_VEDIO; return SDHZ_VEDIO;
} }
......
...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model; ...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model;
import java.io.Serializable; import java.io.Serializable;
public class MainVedioMsgBean implements Serializable { public class MainVideoMsgBean implements Serializable {
private boolean toCreateReward; private boolean toCreateReward;
private int rewardDoubleCoin; private int rewardDoubleCoin;
......
...@@ -8,6 +8,7 @@ public class VedioRulesBean implements Serializable { ...@@ -8,6 +8,7 @@ public class VedioRulesBean implements Serializable {
private YlhVedioBean YLH_VEDIO; private YlhVedioBean YLH_VEDIO;
private SdhzVedioBean SDHZ_VEDIO; private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO; private FLVedioBean FL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private boolean flVideoFlag; private boolean flVideoFlag;
public class CsjVedioBean implements Serializable { public class CsjVedioBean implements Serializable {
...@@ -62,6 +63,19 @@ public class VedioRulesBean implements Serializable { ...@@ -62,6 +63,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 FLVedioBean getFL_VEDIO() { public FLVedioBean getFL_VEDIO() {
return FL_VEDIO; return FL_VEDIO;
} }
...@@ -78,6 +92,8 @@ public class VedioRulesBean implements Serializable { ...@@ -78,6 +92,8 @@ public class VedioRulesBean implements Serializable {
return SDHZ_VEDIO; return SDHZ_VEDIO;
} }
public CORALVedioBean getCORAl_VIDEO() { return CORAL_VEDIO; }
public boolean isFlVideoFlag() { public boolean isFlVideoFlag() {
return flVideoFlag; return flVideoFlag;
} }
......
...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model; ...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.model;
import java.io.Serializable; import java.io.Serializable;
public class VedioAdingBean implements Serializable { public class VideoAdingBean implements Serializable {
private int downloadCoin; private int downloadCoin;
private int curCoin; private int curCoin;
private String carrierType; private String carrierType;
......
...@@ -2,11 +2,10 @@ package com.mints.goodmoney.mvp.presenters ...@@ -2,11 +2,10 @@ package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils import android.text.TextUtils
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.* import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.BaseResponse 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.UserBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.views.HomeView import com.mints.goodmoney.mvp.views.HomeView
...@@ -92,7 +91,7 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -92,7 +91,7 @@ class HomePresenter : BasePresenter<HomeView>() {
fun getHomeVedioMsg() { fun getHomeVedioMsg() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.getHomeVedioMsg(), .call(loanService.getHomeVedioMsg(),
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() { object : BaseSubscriber<BaseResponse<MainVideoMsgBean>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
} }
...@@ -101,7 +100,7 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -101,7 +100,7 @@ class HomePresenter : BasePresenter<HomeView>() {
if (isLinkView) return if (isLinkView) return
} }
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) { override fun onNext(baseResponse: BaseResponse<MainVideoMsgBean>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.getStatus() val code = baseResponse.getStatus()
......
...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.presenters ...@@ -2,7 +2,7 @@ package com.mints.goodmoney.mvp.presenters
import com.mints.goodmoney.manager.AppHttpManager import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse 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.goodmoney.mvp.views.HorizChannelView
import com.mints.library.net.neterror.BaseSubscriber import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
...@@ -13,7 +13,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() { ...@@ -13,7 +13,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() {
fun getSmallHomeVedioBaseMsg() { fun getSmallHomeVedioBaseMsg() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.smallHomeVedioBaseMsg, .call(loanService.smallHomeVedioBaseMsg,
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() { object : BaseSubscriber<BaseResponse<MainVideoMsgBean>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
} }
...@@ -22,7 +22,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() { ...@@ -22,7 +22,7 @@ class HorizChannelPresenter : BasePresenter<HorizChannelView>() {
if (isLinkView) return if (isLinkView) return
} }
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) { override fun onNext(baseResponse: BaseResponse<MainVideoMsgBean>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.getStatus() val code = baseResponse.getStatus()
......
...@@ -3,13 +3,12 @@ package com.mints.goodmoney.mvp.presenters ...@@ -3,13 +3,12 @@ package com.mints.goodmoney.mvp.presenters
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.mints.goodmoney.manager.AppHttpManager import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.BookView import com.mints.goodmoney.mvp.views.KylVideoView
import com.mints.goodmoney.mvp.views.KylVedioView
import com.mints.library.net.neterror.BaseSubscriber import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import java.util.* import java.util.*
class KylVedioPresenter : BasePresenter<KylVedioView>() { class KylVideoPresenter : BasePresenter<KylVideoView>() {
fun addReadSeconds(seconds: Int) { fun addReadSeconds(seconds: Int) {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
......
...@@ -3,14 +3,13 @@ package com.mints.goodmoney.mvp.presenters ...@@ -3,14 +3,13 @@ package com.mints.goodmoney.mvp.presenters
import android.app.Activity import android.app.Activity
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse 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.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import java.util.* import java.util.*
class MhVedioAdPresenter : BasePresenter<VedioAdManagerView>() { class MhVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) { fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return if (activity == null) return
......
...@@ -3,14 +3,14 @@ package com.mints.goodmoney.mvp.presenters ...@@ -3,14 +3,14 @@ package com.mints.goodmoney.mvp.presenters
import android.app.Activity import android.app.Activity
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse 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.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import java.util.* import java.util.*
class TzVideoAdPresenter : BasePresenter<VedioAdManagerView>() { class TzVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) { fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return if (activity == null) return
......
...@@ -3,14 +3,13 @@ package com.mints.goodmoney.mvp.presenters ...@@ -3,14 +3,13 @@ package com.mints.goodmoney.mvp.presenters
import android.app.Activity import android.app.Activity
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse 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.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import java.util.* import java.util.*
class WnVedioAdPresenter : BasePresenter<VedioAdManagerView>() { class WnVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) { fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return if (activity == null) return
......
...@@ -4,7 +4,7 @@ import android.app.Activity; ...@@ -4,7 +4,7 @@ import android.app.Activity;
import com.mints.goodmoney.MintsApplication; import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.model.BaseResponse; 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.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber; import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable; import com.mints.library.net.neterror.Throwable;
...@@ -14,7 +14,7 @@ import java.util.HashMap; ...@@ -14,7 +14,7 @@ import java.util.HashMap;
import rx.Subscription; import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers; import rx.android.schedulers.AndroidSchedulers;
public class YlhVedioAdPresenter extends BasePresenter<VedioAdManagerView> { public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> {
private MintsApplication loanApplication; private MintsApplication loanApplication;
private LoanService loanService; private LoanService loanService;
......
package com.mints.goodmoney.mvp.views 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 import com.mints.goodmoney.mvp.model.UserTaskMsgBean
interface HomeView : BaseView { interface HomeView : BaseView {
fun getHallBaseMsgSuc(data: UserTaskMsgBean) fun getHallBaseMsgSuc(data: UserTaskMsgBean)
fun getHomeVedioMsgSuc(data: MainVedioMsgBean) fun getHomeVedioMsgSuc(data: MainVideoMsgBean)
} }
package com.mints.goodmoney.mvp.views package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.MainVedioMsgBean import com.mints.goodmoney.mvp.model.MainVideoMsgBean
interface HorizChannelView : BaseView { interface HorizChannelView : BaseView {
fun getHomeVedioMsgSuc(data: MainVedioMsgBean) fun getHomeVedioMsgSuc(data: MainVideoMsgBean)
} }
\ No newline at end of file
package com.mints.goodmoney.mvp.views 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; 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; ...@@ -13,7 +13,7 @@ import com.mints.goodmoney.mvp.model.FriendHallMsgBean;
import com.mints.goodmoney.mvp.model.GoldRecordBean; import com.mints.goodmoney.mvp.model.GoldRecordBean;
import com.mints.goodmoney.mvp.model.KylTabBean; import com.mints.goodmoney.mvp.model.KylTabBean;
import com.mints.goodmoney.mvp.model.KylVedioBean; 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.MealBean;
import com.mints.goodmoney.mvp.model.MorningClockBean; import com.mints.goodmoney.mvp.model.MorningClockBean;
import com.mints.goodmoney.mvp.model.MyInfo; import com.mints.goodmoney.mvp.model.MyInfo;
...@@ -292,7 +292,7 @@ public interface LoanService { ...@@ -292,7 +292,7 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/getHomeVedioBaseMsg") @POST("api/getHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getHomeVedioMsg(); Observable<BaseResponse<MainVideoMsgBean>> getHomeVedioMsg();
/** /**
* 横版视频信息 * 横版视频信息
...@@ -300,7 +300,7 @@ public interface LoanService { ...@@ -300,7 +300,7 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/getSmallHomeVedioBaseMsg") @POST("api/getSmallHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getSmallHomeVedioBaseMsg(); Observable<BaseResponse<MainVideoMsgBean>> getSmallHomeVedioBaseMsg();
/** /**
* 小说阅读时长 * 小说阅读时长
......
...@@ -6,12 +6,12 @@ import android.view.KeyEvent ...@@ -6,12 +6,12 @@ import android.view.KeyEvent
import android.view.View import android.view.View
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager 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.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo.Companion.instance import com.mints.goodmoney.common.DeviceInfo.Companion.instance
import com.mints.goodmoney.manager.UserManager 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.presenters.AwardPresenter
import com.mints.goodmoney.mvp.views.AwardView import com.mints.goodmoney.mvp.views.AwardView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
...@@ -34,13 +34,13 @@ import java.util.* ...@@ -34,13 +34,13 @@ import java.util.*
*/ */
class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private lateinit var vedioAdingManager: VedioAdingManager private lateinit var videoAdingManager: VideoAdingManager
private val awardPresenter by lazy { AwardPresenter() } private val awardPresenter by lazy { AwardPresenter() }
private var mTimer: CountDownTimerSupport? = null private var mTimer: CountDownTimerSupport? = null
private var curCoin = 0 //传入金币 private var curCoin = 0 //传入金币
private var extraId = ""//传入key private var extraId = ""//传入key
private var carrierType = ""//传入载体 private var carrierType = ""//传入载体
private var loadVedioFailCount = 0 // 视频失败次数 private var loadVideoFailCount = 0 // 视频失败次数
override fun getContentViewLayoutID() = R.layout.activity_award override fun getContentViewLayoutID() = R.layout.activity_award
...@@ -53,7 +53,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -53,7 +53,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
awardPresenter.attachView(this) awardPresenter.attachView(this)
vedioAdingManager = VedioAdingManager.getInstance(this) videoAdingManager = VideoAdingManager.getInstance(this)
if (!AppConfig.app_black_flag) { if (!AppConfig.app_black_flag) {
// 首次进行黑名单校验 // 首次进行黑名单校验
...@@ -347,8 +347,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -347,8 +347,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
PreLoadExpressManager.onDestroy() PreLoadExpressManager.onDestroy()
flAwardAd?.removeAllViews() flAwardAd?.removeAllViews()
vedioAdingManager.setVedioAdingListener(null) videoAdingManager.setVideoAdingListener(null)
vedioAdingManager.onDestory() videoAdingManager.onDestory()
awardPresenter.detachView() awardPresenter.detachView()
} }
...@@ -371,12 +371,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -371,12 +371,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD, Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_EATMEAL_SUBSIDY, Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_EATMEAL_SUBSIDY,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> { Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
awardVedio() awardVideo()
} }
Constant.CARRIER_BLESSINGBAG_DOUBLE, Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE, Constant.CARRIER_BLESSINGBAG_DOUBLE, Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE,
Constant.CARRIER_HOMEVEDIO_DOUBLE, Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE, Constant.CARRIER_RUISHINEWS_DOUBLE -> { Constant.CARRIER_HOMEVEDIO_DOUBLE, Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE, Constant.CARRIER_RUISHINEWS_DOUBLE -> {
pushUmengEvent() pushUmengEvent()
awardVedio() awardVideo()
} }
Constant.CARRIER_NEW_VISITOR -> { Constant.CARRIER_NEW_VISITOR -> {
readyGoThenKill(WxLoginActivity::class.java) readyGoThenKill(WxLoginActivity::class.java)
...@@ -392,53 +392,53 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -392,53 +392,53 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
/** /**
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio() { private fun awardVideo() {
if (vedioAdingManager.getVedioFinishFlag()) { if (videoAdingManager.getVideoFinishFlag()) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
showLoading("加载中...") showLoading("加载中...")
val bean = VedioAdingBean() val bean = VideoAdingBean()
bean.setCarrierType(carrierType) bean.setCarrierType(carrierType)
bean.setCurCoin(curCoin) bean.setCurCoin(curCoin)
bean.setExtraId(extraId) bean.setExtraId(extraId)
loadVedio(vedioAdingManager, bean, true) loadVideo(videoAdingManager, bean, true)
} }
/** /**
* 加载激励视频 * 加载激励视频
*/ */
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) { private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener { videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun vedioAdingListenerError(adType: String) { override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下") showToast("加载超时,请休息一下")
hideLoading() hideLoading()
} }
override fun vedioAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVideoFailCount++
if (loadVedioFailCount >= 2) { if (loadVideoFailCount >= 2) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
loadVedio(vedioAdingManager, bean, false) loadVideo(videoAdingManager, bean, false)
} }
} }
override fun vedioAdingListenerSuccess(adType: String) { override fun videoAdingListenerSuccess(adType: String) {
hideLoading() hideLoading()
vedioAdingSuccess(adType) videoAdingSuccess(adType)
} }
}) })
if (isFirstLoad) { if (isFirstLoad) {
// 首页按权重加载 // 首页按权重加载
vedioAdingManager.loadAding(this, bean) videoAdingManager.loadAding(this, bean)
} else { } else {
// 失败按优先级加载 // 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean) videoAdingManager.loadFailAding(this, bean)
} }
} }
...@@ -507,7 +507,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -507,7 +507,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
/** /**
* 广告返回结果 * 广告返回结果
*/ */
private fun vedioAdingSuccess(adType: String) { private fun videoAdingSuccess(adType: String) {
setAdFinshLayout() setAdFinshLayout()
} }
......
...@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.GridLayoutManager ...@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import cn.sharesdk.framework.ShareSDK import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi import com.mints.goodmoney.login.LoginApi
...@@ -21,7 +21,6 @@ import com.mints.goodmoney.mvp.views.DrawcashView ...@@ -21,7 +21,6 @@ import com.mints.goodmoney.mvp.views.DrawcashView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.DrawcashAdapter import com.mints.goodmoney.ui.adapter.DrawcashAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener 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.DrawcashVideoDialog
import com.mints.goodmoney.ui.widgets.JDTintDialog import com.mints.goodmoney.ui.widgets.JDTintDialog
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
...@@ -45,7 +44,7 @@ class DrawcashActivity : BaseActivity(), ...@@ -45,7 +44,7 @@ class DrawcashActivity : BaseActivity(),
private var drawcashVideoDialog: DrawcashVideoDialog? = null private var drawcashVideoDialog: DrawcashVideoDialog? = null
private lateinit var vedioAdingManager: VedioAdingManager private lateinit var vedioAdingManager: VideoAdingManager
private val drawcashPresenter by lazy { DrawcashPresenter() } private val drawcashPresenter by lazy { DrawcashPresenter() }
private lateinit var drawcashAdapter: DrawcashAdapter private lateinit var drawcashAdapter: DrawcashAdapter
private val userManager by lazy { UserManager.getInstance() } private val userManager by lazy { UserManager.getInstance() }
...@@ -74,7 +73,7 @@ class DrawcashActivity : BaseActivity(), ...@@ -74,7 +73,7 @@ class DrawcashActivity : BaseActivity(),
tvDrawJd.setOnCheckedChangeListener(this) tvDrawJd.setOnCheckedChangeListener(this)
view_title.text = "提现规则" view_title.text = "提现规则"
vedioAdingManager = VedioAdingManager.getInstance(this) vedioAdingManager = VideoAdingManager.getInstance(this)
drawcashPresenter.attachView(this) drawcashPresenter.attachView(this)
initListener() initListener()
} }
...@@ -299,14 +298,18 @@ class DrawcashActivity : BaseActivity(), ...@@ -299,14 +298,18 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重 * 设置视频权重
*/ */
private fun initAdWeight(data: DrawcashBean.VedioRules) { private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO, data.fL_VEDIO) vedioAdingManager.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO, data.fL_VEDIO, data.coraL_VEDIO)
// vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO) LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} ylhWeight:${data.ylH_VEDIO} sdhzWeight:${data.sdhZ_VEDIO} flWeight:${data.fL_VEDIO}") "ylhWeight:${data.ylH_VEDIO} " +
"sdhzWeight:${data.sdhZ_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO}")
// 广告视频数 // 广告视频数
AppConfig.csjVedioAdCount = 10 AppConfig.csjVideoAdCount = 10
AppConfig.ylhAdCount = 10 AppConfig.ylhAdCount = 10
AppConfig.wnVedioAdCount = 10 AppConfig.wnVideoAdCount = 10
AppConfig.flVedioAdCount = 10 AppConfig.flVideoAdCount = 10
AppConfig.shVideoAdCount = 10
} }
/** /**
......
...@@ -9,72 +9,71 @@ import com.downloader.Error ...@@ -9,72 +9,71 @@ import com.downloader.Error
import com.downloader.OnDownloadListener import com.downloader.OnDownloadListener
import com.downloader.PRDownloader import com.downloader.PRDownloader
import com.mints.goodmoney.R 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.common.Constant
import com.mints.goodmoney.manager.UserManager 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.GamePresenter import com.mints.goodmoney.mvp.presenters.KylVideoPresenter
import com.mints.goodmoney.mvp.presenters.KylVedioPresenter import com.mints.goodmoney.mvp.views.KylVideoView
import com.mints.goodmoney.mvp.views.KylVedioView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.CacheUtil import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5 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 * 时间:2021/1/4 15:09
*/ */
class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView { class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView {
companion object { 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 val kylVideoPresenter by lazy { KylVideoPresenter() }
private lateinit var vedioAdingManager: VedioAdingManager private lateinit var videoAdingManager: VideoAdingManager
private var loadVedioFailCount = 0 private var loadVideoFailCount = 0
private val videoWallpaper by lazy { VideoWallpaper() } private val videoWallpaper by lazy { VideoWallpaper() }
private var downloadId: Int = -1//vedio下载id private var downloadId: Int = -1//video下载id
private var downloadVedioSucFlag = false// 下载视频成功 private var downloadVideoSucFlag = false// 下载视频成功
private var cachePath = ""// cache路径 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 isApplyKitKatTranslucency() = false
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras) super.getBundleExtras(extras)
extras?.let { extras?.let {
vedioUrl = it.getString(VEDIO_URL, "") videoUrl = it.getString(VIDEO_URL, "")
} }
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
if (TextUtils.isEmpty(vedioUrl)) { if (TextUtils.isEmpty(videoUrl)) {
showToast("加载失败,请稍后重试.") showToast("加载失败,请稍后重试.")
finish() finish()
return return
} }
cachePath = cacheDir.path + "/" cachePath = cacheDir.path + "/"
vedioAdingManager = VedioAdingManager.getInstance(this) videoAdingManager = VideoAdingManager.getInstance(this)
initListener() initListener()
loadVedio(vedioUrl) loadVideo(videoUrl)
} }
private fun loadVedio(vedioUrl: String) { private fun loadVideo(videoUrl: String) {
jzvdStd?.setUp(vedioUrl, "") jzvdStd?.setUp(videoUrl, "")
jzvdStd?.startVideo() jzvdStd?.startVideo()
// jzvdStd.setVedioRestart(false) // jzvdStd.setVideoRestart(false)
// jzvdStd.setJzVedioStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVedioStatusListener { // jzvdStd.setJzVideoStatusListener(object : JZVideoPlayerStandardLoopVideo.JZVideoStatusListener {
// override fun jzVedioPlaying() { // override fun jzVideoPlaying() {
// } // }
// }) // })
} }
...@@ -112,22 +111,22 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView { ...@@ -112,22 +111,22 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
//删除缓存文件 //删除缓存文件
CacheUtil.clearAllCache(context) CacheUtil.clearAllCache(context)
kylVedioPresenter.detachView() kylVideoPresenter.detachView()
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
when (v?.id) { when (v?.id) {
R.id.ivBack -> finish() R.id.ivBack -> finish()
R.id.ivSetting -> { R.id.ivSetting -> {
awardVedio() awardVideo()
downloadVedioToCacheFile() downloadVideoToCacheFile()
} }
} }
} }
private fun downloadVedioToCacheFile() { private fun downloadVideoToCacheFile() {
vedioName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".mp4" videoName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".mp4"
downloadId = PRDownloader.download(vedioUrl, cachePath, vedioName) downloadId = PRDownloader.download(videoUrl, cachePath, videoName)
.build() .build()
// .setOnStartOrResumeListener { } // .setOnStartOrResumeListener { }
// .setOnPauseListener { // .setOnPauseListener {
...@@ -138,7 +137,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView { ...@@ -138,7 +137,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
// } // }
.start(object : OnDownloadListener { .start(object : OnDownloadListener {
override fun onDownloadComplete() { override fun onDownloadComplete() {
downloadVedioSucFlag = true downloadVideoSucFlag = true
} }
override fun onError(error: Error) { override fun onError(error: Error) {
...@@ -155,59 +154,59 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView { ...@@ -155,59 +154,59 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
/** /**
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio() { private fun awardVideo() {
if (vedioAdingManager.vedioFinishFlag) { if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
loadVedioFailCount = 0 loadVideoFailCount = 0
showLoading("加载中...") showLoading("加载中...")
val bean = VedioAdingBean() val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_KUYINYUE_VEDIO bean.carrierType = Constant.CARRIER_KUYINYUE_VEDIO
loadVedio(vedioAdingManager, bean, true) loadVideo(videoAdingManager, bean, true)
} }
/** /**
* 加载激励视频 * 加载激励视频
*/ */
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) { private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener { videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun vedioAdingListenerError(adType: String) { override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下") showToast("加载超时,请休息一下")
hideLoading() hideLoading()
} }
override fun vedioAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVideoFailCount++
if (loadVedioFailCount >= 2) { if (loadVideoFailCount >= 2) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
loadVedio(vedioAdingManager, bean, false) loadVideo(videoAdingManager, bean, false)
} }
} }
override fun vedioAdingListenerSuccess(adType: String) { override fun videoAdingListenerSuccess(adType: String) {
hideLoading() hideLoading()
vedioAdingSuccess(adType) videoAdingSuccess(adType)
} }
}) })
if (isFirstLoad) { if (isFirstLoad) {
// 首页按权重加载 // 首页按权重加载
vedioAdingManager.loadAding(this, bean) videoAdingManager.loadAding(this, bean)
} else { } else {
// 失败按优先级加载 // 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean) videoAdingManager.loadFailAding(this, bean)
} }
} }
private fun vedioAdingSuccess(adType: String) { private fun videoAdingSuccess(adType: String) {
if (downloadVedioSucFlag) { if (downloadVideoSucFlag) {
LogUtil.d("KylVedioActivity", "name:-->" + cachePath + vedioName) LogUtil.d("KylVideoActivity", "name:-->" + cachePath + videoName)
try { try {
showToast("设置壁纸成功") showToast("设置壁纸成功")
videoWallpaper.setToWallPaper(this, cachePath + vedioName) videoWallpaper.setToWallPaper(this, cachePath + videoName)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
......
...@@ -10,7 +10,7 @@ import androidx.fragment.app.FragmentManager ...@@ -10,7 +10,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.R 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.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
...@@ -72,8 +72,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -72,8 +72,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
super.onDestroy() super.onDestroy()
TTPreLoadCarrierExpressManager.getInstance().onDestroy() TTPreLoadCarrierExpressManager.getInstance().onDestroy()
VedioAdingManager.getInstance(this).setVedioAdingListener(null) VideoAdingManager.getInstance(this).setVideoAdingListener(null)
VedioAdingManager.getInstance(this).onDestory() VideoAdingManager.getInstance(this).onDestory()
} }
public override fun onSaveInstanceState(outState: Bundle) { public override fun onSaveInstanceState(outState: Bundle) {
......
...@@ -4,12 +4,12 @@ import android.os.Bundle ...@@ -4,12 +4,12 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import com.mints.goodmoney.R 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.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.manager.TtCsjAdManager import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.MorningClockBean 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.presenters.MorningClockPresenter
import com.mints.goodmoney.mvp.views.MorningClockView import com.mints.goodmoney.mvp.views.MorningClockView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
...@@ -29,8 +29,8 @@ class MorningClockActivity : BaseActivity() ...@@ -29,8 +29,8 @@ class MorningClockActivity : BaseActivity()
private lateinit var morningClockAdapter: MorningClockAdapter private lateinit var morningClockAdapter: MorningClockAdapter
private var morningClockList: MutableList<MorningClockBean.MorningClockTargetBean>? = null private var morningClockList: MutableList<MorningClockBean.MorningClockTargetBean>? = null
private lateinit var vedioAdingManager: VedioAdingManager private lateinit var videoAdingManager: VideoAdingManager
private var loadVedioFailCount = 0 private var loadVideoFailCount = 0
private var morningClockBean: MorningClockBean? = null private var morningClockBean: MorningClockBean? = null
override fun getContentViewLayoutID() = R.layout.activity_morning_clock override fun getContentViewLayoutID() = R.layout.activity_morning_clock
...@@ -38,7 +38,7 @@ class MorningClockActivity : BaseActivity() ...@@ -38,7 +38,7 @@ class MorningClockActivity : BaseActivity()
override fun isApplyKitKatTranslucency() = false override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
vedioAdingManager = VedioAdingManager.getInstance(this) videoAdingManager = VideoAdingManager.getInstance(this)
initListener() initListener()
morningClockPresenter.attachView(this) morningClockPresenter.attachView(this)
...@@ -60,7 +60,7 @@ class MorningClockActivity : BaseActivity() ...@@ -60,7 +60,7 @@ class MorningClockActivity : BaseActivity()
when (v?.id) { when (v?.id) {
R.id.ivMorningClockBack -> finish() R.id.ivMorningClockBack -> finish()
R.id.tvMorningClockClick -> { R.id.tvMorningClockClick -> {
awardVedio() awardVideo()
// 预加载信息流 // 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK) TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
...@@ -106,54 +106,54 @@ class MorningClockActivity : BaseActivity() ...@@ -106,54 +106,54 @@ class MorningClockActivity : BaseActivity()
/** /**
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio() { private fun awardVideo() {
if (vedioAdingManager.vedioFinishFlag) { if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
showLoading("加载中...") showLoading("加载中...")
val bean = VedioAdingBean() val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_MORNING_CLOCK bean.carrierType = Constant.CARRIER_MORNING_CLOCK
loadVedio(vedioAdingManager, bean, true) loadVideo(videoAdingManager, bean, true)
} }
/** /**
* 加载激励视频 * 加载激励视频
*/ */
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) { private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener { videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun vedioAdingListenerError(adType: String) { override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下") showToast("加载超时,请休息一下")
hideLoading() hideLoading()
} }
override fun vedioAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVideoFailCount++
if (loadVedioFailCount >= 2) { if (loadVideoFailCount >= 2) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
loadVedio(vedioAdingManager, bean, false) loadVideo(videoAdingManager, bean, false)
} }
} }
override fun vedioAdingListenerSuccess(adType: String) { override fun videoAdingListenerSuccess(adType: String) {
hideLoading() hideLoading()
vedioAdingSuccess(adType) videoAdingSuccess(adType)
} }
}) })
if (isFirstLoad) { if (isFirstLoad) {
// 首页按权重加载 // 首页按权重加载
vedioAdingManager.loadAding(this, bean) videoAdingManager.loadAding(this, bean)
} else { } else {
// 失败按优先级加载 // 失败按优先级加载
vedioAdingManager.loadFailAding(this, bean) videoAdingManager.loadFailAding(this, bean)
} }
} }
private fun vedioAdingSuccess(adType: String) { private fun videoAdingSuccess(adType: String) {
try { try {
if (morningClockList != null && morningClockList!!.size > 0) { if (morningClockList != null && morningClockList!!.size > 0) {
for (morningBean in morningClockList!!) { for (morningBean in morningClockList!!) {
......
...@@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat ...@@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat
import cn.sharesdk.framework.ShareSDK import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.TzVideoAdManager import com.mints.goodmoney.ad.video.TzVideoAdManager
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener import com.mints.goodmoney.login.OnLoginListener
......
...@@ -78,7 +78,7 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor ...@@ -78,7 +78,7 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back) iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
mCoralDownload = CoralDownload(CoralDownload.RELEASE_TASK_TYPE).setOnAdLoadListener(this) mCoralDownload = CoralDownload().setOnAdLoadListener(this)
CacheUtil.clearAllCache(context) CacheUtil.clearAllCache(context)
......
...@@ -14,7 +14,7 @@ import com.daimajia.androidanimations.library.YoYo ...@@ -14,7 +14,7 @@ import com.daimajia.androidanimations.library.YoYo
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant 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.presenters.HorizChannelPresenter
import com.mints.goodmoney.mvp.views.HorizChannelView import com.mints.goodmoney.mvp.views.HorizChannelView
import com.mints.goodmoney.ui.activitys.AwardActivity import com.mints.goodmoney.ui.activitys.AwardActivity
...@@ -131,8 +131,8 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -131,8 +131,8 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
rope = null rope = null
} }
cdvvYilanTime?.setCountDownVedioListener(null) cdvvYilanTime?.setCountDownVideoListener(null)
cdvvYilanTime?.onDestory() cdvvYilanTime?.onDestroy()
super.onDestroyView() super.onDestroyView()
} }
...@@ -165,7 +165,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -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) { if (activity == null || requireActivity().isFinishing) {
return return
} }
...@@ -208,7 +208,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -208,7 +208,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
* 红包倒计时初始化 * 红包倒计时初始化
*/ */
private fun initTimeView() { private fun initTimeView() {
cdvvYilanTime.setCountDownVedioListener { cdvvYilanTime.setCountDownVideoListener {
if (isFirstWatchVideo) { if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户 // 第一次观看完视频提醒用户
vs_tips.visibility = View.VISIBLE vs_tips.visibility = View.VISIBLE
......
...@@ -7,14 +7,12 @@ import com.mints.goodmoney.mvp.model.Data ...@@ -7,14 +7,12 @@ import com.mints.goodmoney.mvp.model.Data
import com.mints.goodmoney.mvp.model.KylVedioBean import com.mints.goodmoney.mvp.model.KylVedioBean
import com.mints.goodmoney.mvp.presenters.KuYinYuePagePresenter import com.mints.goodmoney.mvp.presenters.KuYinYuePagePresenter
import com.mints.goodmoney.mvp.views.KuYinYuePageView import com.mints.goodmoney.mvp.views.KuYinYuePageView
import com.mints.goodmoney.ui.activitys.KylVedioActivity import com.mints.goodmoney.ui.activitys.KylVideoActivity
import com.mints.goodmoney.ui.activitys.XmlyPlayActivity
import com.mints.goodmoney.ui.adapter.KylPageAdapter import com.mints.goodmoney.ui.adapter.KylPageAdapter
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener 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.* import kotlinx.android.synthetic.main.fragment_main_kyl_page.*
/** /**
...@@ -58,8 +56,8 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment( ...@@ -58,8 +56,8 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
override fun onItemClick(position: Int) { override fun onItemClick(position: Int) {
if (kylData != null && kylData.size > 0) { if (kylData != null && kylData.size > 0) {
val bundle = Bundle() val bundle = Bundle()
bundle.putString(KylVedioActivity.VEDIO_URL, kylData[position].url) bundle.putString(KylVideoActivity.VIDEO_URL, kylData[position].url)
readyGo(KylVedioActivity::class.java, bundle) readyGo(KylVideoActivity::class.java, bundle)
} }
} }
......
...@@ -16,11 +16,11 @@ import com.mints.goodmoney.MintsApplication ...@@ -16,11 +16,11 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager 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.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.* 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.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.presenters.HomePresenter import com.mints.goodmoney.mvp.presenters.HomePresenter
import com.mints.goodmoney.mvp.views.HomeView import com.mints.goodmoney.mvp.views.HomeView
...@@ -67,15 +67,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -67,15 +67,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var rewardCoin = 0 // 小金币 private var rewardCoin = 0 // 小金币
private var littleVideoFragment: YLLittleVideoFragment? = null private var littleVideoFragment: YLLittleVideoFragment? = null
private val videoMaxCount = 12 // 当前缓存视频id最大数 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 isToCreateReward = true // 是否还有剩余红包 服务器返回
private var isFirstLoadVedio = true // 首次加载视频初始化 本地判断 private var isFirstLoadVideo = true // 首次加载视频初始化 本地判断
private var isAward = false // 是否可以领金币 本地判断 private var isAward = false // 是否可以领金币 本地判断
private var isFirstWatchVideo = true// 是否是第一次观看完视频 private var isFirstWatchVideo = true// 是否是第一次观看完视频
// 广告权重相关 // 广告权重相关
private var vedioAdingManager: VedioAdingManager? = null private var videoAdingManager: VideoAdingManager? = null
// 福袋相关 // 福袋相关
private var rope: YoYoString? = null private var rope: YoYoString? = null
...@@ -88,7 +88,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -88,7 +88,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
homePresenter.attachView(this) homePresenter.attachView(this)
vedioAdingManager = VedioAdingManager.getInstance(activity) videoAdingManager = VideoAdingManager.getInstance(activity)
// 奖励页预加载 信息流广告 // 奖励页预加载 信息流广告
PreLoadExpressManager.loadADFrameLayout() PreLoadExpressManager.loadADFrameLayout()
...@@ -139,7 +139,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -139,7 +139,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) { if (isToCreateReward) {
// 防止界面切换 重置红包动画 // 防止界面切换 重置红包动画
// 好兔视频已加载 且 红包已转满 // 好兔视频已加载 且 红包已转满
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying) { if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying) {
cdvvYilanTime.startAnim() cdvvYilanTime.startAnim()
} }
} }
...@@ -174,7 +174,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -174,7 +174,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) { if (isToCreateReward) {
// 防止界面切换 重置红包动画 // 防止界面切换 重置红包动画
// 好兔视频已加载 且 红包已转满 // 好兔视频已加载 且 红包已转满
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying) { if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying) {
cdvvYilanTime.stopAnim() cdvvYilanTime.stopAnim()
} }
} }
...@@ -191,8 +191,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -191,8 +191,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
rope = null rope = null
} }
cdvvYilanTime?.onDestory() cdvvYilanTime?.onDestroy()
cdvvYilanTime?.setCountDownVedioListener(null) cdvvYilanTime?.setCountDownVideoListener(null)
super.onDestroyView() super.onDestroyView()
} }
...@@ -252,7 +252,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -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) { if (activity == null || requireActivity().isFinishing) {
return return
} }
...@@ -266,7 +266,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -266,7 +266,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (isToCreateReward) { if (isToCreateReward) {
// 防止界面切换 重置倒计时 // 防止界面切换 重置倒计时
// 好兔视频已加载 且 红包已转满 且 奖励已领过 // 好兔视频已加载 且 红包已转满 且 奖励已领过
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying && !isAward) { if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying && !isAward) {
cdvvYilanTime?.stopRedbox() cdvvYilanTime?.stopRedbox()
cdvvYilanTime?.reset() cdvvYilanTime?.reset()
cdvvYilanTime?.start() cdvvYilanTime?.start()
...@@ -333,8 +333,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -333,8 +333,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack { YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(pager: String, videoid: String, p2: String?) { override fun onStart(pager: String, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包 // 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVedio) { if (isFirstLoadVideo) {
isFirstLoadVedio = false isFirstLoadVideo = false
initTimeview() initTimeview()
} else { } else {
resumeDownloadTime(videoid) resumeDownloadTime(videoid)
...@@ -355,7 +355,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -355,7 +355,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) { override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
// LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete") // LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete")
addVedioIdList(videoID) addVideoIdList(videoID)
pauseDownloadTime() pauseDownloadTime()
} }
...@@ -445,12 +445,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -445,12 +445,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
/** /**
* 将播放的id记录到list中 * 将播放的id记录到list中
*/ */
private fun addVedioIdList(id: String) { private fun addVideoIdList(id: String) {
// 达到12个视频时 删除前10个记录 // 达到12个视频时 删除前10个记录
if (vedioIdList.size >= videoMaxCount) { if (videoIdList.size >= videoMaxCount) {
vedioIdList.subList(0, 10).clear() 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 { ...@@ -465,7 +465,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
*/ */
private fun resumeDownloadTime(id: String) { private fun resumeDownloadTime(id: String) {
if (!TextUtils.isEmpty(id)) { if (!TextUtils.isEmpty(id)) {
if (vedioIdList.contains(id)) { if (videoIdList.contains(id)) {
cdvvYilanTime?.pause() cdvvYilanTime?.pause()
return return
} }
...@@ -488,7 +488,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -488,7 +488,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 红包倒计时初始化 * 红包倒计时初始化
*/ */
private fun initTimeview() { private fun initTimeview() {
cdvvYilanTime?.setCountDownVedioListener { cdvvYilanTime?.setCountDownVideoListener {
if (isFirstWatchVideo) { if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户 // 第一次观看完视频提醒用户
vs_tips?.visibility = View.VISIBLE vs_tips?.visibility = View.VISIBLE
...@@ -503,8 +503,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -503,8 +503,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
cdvvYilanTime?.showRedbox() cdvvYilanTime?.showRedbox()
stopDownloadTime() stopDownloadTime()
} }
val vedioTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30) val videoTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime?.setTime(vedioTime) cdvvYilanTime?.setTime(videoTime)
cdvvYilanTime?.start() cdvvYilanTime?.start()
} }
...@@ -565,16 +565,23 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -565,16 +565,23 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 设置视频权重 * 设置视频权重
*/ */
private fun initAdWeight(data: UserTaskMsgBean) { 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) 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)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate}" + LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
" sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate}") "ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_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.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount}" + AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
" sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount}") LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
} }
......
...@@ -13,12 +13,11 @@ import androidx.recyclerview.widget.DividerItemDecoration ...@@ -13,12 +13,11 @@ import androidx.recyclerview.widget.DividerItemDecoration
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.fly.scenemodule.SceneUtil import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.BuildConfig import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager 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.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.* import com.mints.goodmoney.manager.*
...@@ -57,6 +56,8 @@ import net.grandcentrix.tray.AppPreferences ...@@ -57,6 +56,8 @@ import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal import java.math.BigDecimal
import java.util.* import java.util.*
private val TAG = MyFragment::class.java.simpleName
/** /**
* 描述:我 * 描述:我
* 作者:孟崔广 * 作者:孟崔广
...@@ -70,12 +71,10 @@ class MyFragment : BaseFragment(), ...@@ -70,12 +71,10 @@ class MyFragment : BaseFragment(),
View.OnClickListener, View.OnClickListener,
AdapterView.OnItemClickListener { AdapterView.OnItemClickListener {
private val TAG = MyFragment::class.java.simpleName
private val ps by lazy { AppPreferences(context) } private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() } private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() } private val userManager by lazy { UserManager.getInstance() }
private lateinit var vedioAdingManager: VedioAdingManager private lateinit var vedioAdingManager: VideoAdingManager
private var loadVedioFailCount = 0 private var loadVedioFailCount = 0
private var userConfig: MyInfo? = null private var userConfig: MyInfo? = null
...@@ -910,7 +909,7 @@ class MyFragment : BaseFragment(), ...@@ -910,7 +909,7 @@ class MyFragment : BaseFragment(),
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio(coin: Int, carrierType: String) { private fun awardVedio(coin: Int, carrierType: String) {
if (vedioAdingManager.vedioFinishFlag) { if (vedioAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -918,7 +917,7 @@ class MyFragment : BaseFragment(), ...@@ -918,7 +917,7 @@ class MyFragment : BaseFragment(),
loadVedioFailCount = 0 loadVedioFailCount = 0
showLoading("加载中...") showLoading("加载中...")
val bean = VedioAdingBean() val bean = VideoAdingBean()
bean.carrierType = carrierType bean.carrierType = carrierType
bean.curCoin = coin bean.curCoin = coin
...@@ -928,14 +927,14 @@ class MyFragment : BaseFragment(), ...@@ -928,14 +927,14 @@ class MyFragment : BaseFragment(),
/** /**
* 加载激励视频 * 加载激励视频
*/ */
private fun loadVideo(videoAdingManager: VedioAdingManager, bean: VedioAdingBean, isFirstLoad: Boolean) { private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
videoAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener { videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun vedioAdingListenerError(adType: String) { override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下") showToast("加载超时,请休息一下")
hideLoading() hideLoading()
} }
override fun vedioAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVedioFailCount++
if (loadVedioFailCount >= 2) { if (loadVedioFailCount >= 2) {
hideLoading() hideLoading()
...@@ -945,7 +944,7 @@ class MyFragment : BaseFragment(), ...@@ -945,7 +944,7 @@ class MyFragment : BaseFragment(),
} }
} }
override fun vedioAdingListenerSuccess(adType: String) { override fun videoAdingListenerSuccess(adType: String) {
hideLoading() hideLoading()
videoAdingSuccess(adType) videoAdingSuccess(adType)
} }
...@@ -996,7 +995,7 @@ class MyFragment : BaseFragment(), ...@@ -996,7 +995,7 @@ class MyFragment : BaseFragment(),
private fun initManager() { private fun initManager() {
BannerManager.init() BannerManager.init()
vedioAdingManager = VedioAdingManager.getInstance(activity) vedioAdingManager = VideoAdingManager.getInstance(activity)
if (!TextUtils.isEmpty(userManager.userID)) { if (!TextUtils.isEmpty(userManager.userID)) {
// 登录成功的用户初始化鱼丸盒子 // 登录成功的用户初始化鱼丸盒子
...@@ -1046,14 +1045,23 @@ class MyFragment : BaseFragment(), ...@@ -1046,14 +1045,23 @@ class MyFragment : BaseFragment(),
* 设置视频权重 * 设置视频权重
*/ */
private fun initAdWeight(data: UserTaskMsgBean) { 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) 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)
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}") LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_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.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount}") AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
} }
/** /**
......
...@@ -13,9 +13,9 @@ import com.daimajia.androidanimations.library.YoYo; ...@@ -13,9 +13,9 @@ import com.daimajia.androidanimations.library.YoYo;
import com.mints.goodmoney.R; 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 CountDownView cdCountVedioView;
private ImageView ivCountVedioRedbox; private ImageView ivCountVedioRedbox;
...@@ -23,15 +23,15 @@ public class CountDownVedioView extends LinearLayout { ...@@ -23,15 +23,15 @@ public class CountDownVedioView extends LinearLayout {
private boolean isPlaying = false; private boolean isPlaying = false;
private YoYo.YoYoString rope; private YoYo.YoYoString rope;
public CountDownVedioView(Context context) { public CountDownVideoView(Context context) {
this(context, null); this(context, null);
} }
public CountDownVedioView(Context context, @Nullable AttributeSet attrs) { public CountDownVideoView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0); 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); super(context, attrs, defStyleAttr);
initView(context); initView(context);
...@@ -47,8 +47,8 @@ public class CountDownVedioView extends LinearLayout { ...@@ -47,8 +47,8 @@ public class CountDownVedioView extends LinearLayout {
private void initListener() { private void initListener() {
cdCountVedioView.setOnLoadingFinishListener(() -> { cdCountVedioView.setOnLoadingFinishListener(() -> {
if (countDownVedioListener != null) { if (countDownVideoListener != null) {
countDownVedioListener.finish(); countDownVideoListener.finish();
} }
}); });
} }
...@@ -93,11 +93,11 @@ public class CountDownVedioView extends LinearLayout { ...@@ -93,11 +93,11 @@ public class CountDownVedioView extends LinearLayout {
ivCountVedioRedbox.setImageResource(img); ivCountVedioRedbox.setImageResource(img);
} }
public void setCountDownVedioListener(CountDownVedioListener countDownVedioListener) { public void setCountDownVideoListener(CountDownVideoListener countDownVideoListener) {
this.countDownVedioListener = countDownVedioListener; this.countDownVideoListener = countDownVideoListener;
} }
public interface CountDownVedioListener { public interface CountDownVideoListener {
void finish(); void finish();
} }
...@@ -135,7 +135,7 @@ public class CountDownVedioView extends LinearLayout { ...@@ -135,7 +135,7 @@ public class CountDownVedioView extends LinearLayout {
} }
} }
public void onDestory() { public void onDestroy() {
if (cdCountVedioView.callOnClick()) if (cdCountVedioView.callOnClick())
if (rope != null) { if (rope != null) {
......
...@@ -8,10 +8,10 @@ import android.view.View ...@@ -8,10 +8,10 @@ import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.widget.TextView import android.widget.TextView
import com.mints.goodmoney.R 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.common.Constant
import com.mints.goodmoney.manager.TrackManager 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.goodmoney.utils.ToastUtil
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
...@@ -23,8 +23,8 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -23,8 +23,8 @@ class DrawcashVideoDialog(activity: Activity) :
private var onClickListener: OnClickListener? = null private var onClickListener: OnClickListener? = null
private var vedioAdingManager: VedioAdingManager? = null private var videoAdingManager: VideoAdingManager? = null
private var loadVedioFailCount = 0 private var loadVideoFailCount = 0
private var tvContent: TextView private var tvContent: TextView
private var tvNext: TextView private var tvNext: TextView
...@@ -39,7 +39,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -39,7 +39,7 @@ class DrawcashVideoDialog(activity: Activity) :
lp.windowAnimations = R.style.DialogAnimBottom lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp window!!.attributes = lp
vedioAdingManager = VedioAdingManager.getInstance(activity) videoAdingManager = VideoAdingManager.getInstance(activity)
findViewById<View>(R.id.btn_dialog_drawcash_back).setOnClickListener(this) findViewById<View>(R.id.btn_dialog_drawcash_back).setOnClickListener(this)
tvContent = findViewById<View>(R.id.btn_dialog_drawcash_content) as TextView tvContent = findViewById<View>(R.id.btn_dialog_drawcash_content) as TextView
...@@ -49,8 +49,8 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -49,8 +49,8 @@ class DrawcashVideoDialog(activity: Activity) :
} }
fun onDestory(){ fun onDestory(){
vedioAdingManager?.setVedioAdingListener(null) videoAdingManager?.setVideoAdingListener(null)
vedioAdingManager?.onDestory() videoAdingManager?.onDestory()
activity = null activity = null
} }
...@@ -63,7 +63,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -63,7 +63,7 @@ class DrawcashVideoDialog(activity: Activity) :
onClickListener?.onClick() onClickListener?.onClick()
dismiss() dismiss()
} else { } else {
awardVedio() awardVideo()
} }
} }
R.id.btn_dialog_drawcash_back -> { R.id.btn_dialog_drawcash_back -> {
...@@ -83,40 +83,40 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -83,40 +83,40 @@ class DrawcashVideoDialog(activity: Activity) :
/** /**
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio() { private fun awardVideo() {
if (activity == null) return if (activity == null) return
loadVedioFailCount = 0 loadVideoFailCount = 0
ToastUtil.show(activity, "加载中...") ToastUtil.show(activity, "加载中...")
val bean = VedioAdingBean() val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_DRAWCASH 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 if (activity == null) return
vedioAdingManager?.let { videoAdingManager?.let {
it.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener { it.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun vedioAdingListenerError(adType: String) { override fun videoAdingListenerError(adType: String) {
ToastUtil.show(activity, "加载超时,请休息一下") ToastUtil.show(activity, "加载超时,请休息一下")
} }
override fun vedioAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVideoFailCount++
if (loadVedioFailCount >= 2) { if (loadVideoFailCount >= 2) {
ToastUtil.show(activity, "加载超时,请休息一下") ToastUtil.show(activity, "加载超时,请休息一下")
} else { } else {
loadVedio(vedioAdingManager, bean, false) loadVideo(videoAdingManager, bean, false)
} }
} }
override fun vedioAdingListenerSuccess(adType: String) { override fun videoAdingListenerSuccess(adType: String) {
if (it.isVedioAdDownload) { if (it.isVideoAdDownload) {
TrackManager.getInstance().drawcashVideo() TrackManager.getInstance().drawcashVideo()
} }
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
android:src="@mipmap/ic_main_box" android:src="@mipmap/ic_main_box"
android:visibility="gone" /> android:visibility="gone" />
<com.mints.goodmoney.ui.widgets.CountDownVedioView <com.mints.goodmoney.ui.widgets.CountDownVideoView
android:id="@+id/cdvvYilanTime" android:id="@+id/cdvvYilanTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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