Commit 175d5a63 authored by jyx's avatar jyx

珊瑚激励视频集成

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