Commit 7ccdbd65 authored by jyx's avatar jyx

RTA激励视频集成,热门活动样式改变

parent 1e4580a5
...@@ -272,6 +272,10 @@ dependencies { ...@@ -272,6 +272,10 @@ dependencies {
// 抖音滑动LayoutManager // 抖音滑动LayoutManager
implementation(name: 'LayoutManagerGroup', ext: 'aar') implementation(name: 'LayoutManagerGroup', ext: 'aar')
// 激励视频RTA
implementation(name: 'taskwake1.0', ext: 'aar')
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
// testImplementation 'junit:junit:4.13' // testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2' // androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' // androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
......
...@@ -60,7 +60,8 @@ ...@@ -60,7 +60,8 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/CustomAppTheme" android:theme="@style/CustomAppTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"> tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:theme">
<uses-library <uses-library
android:name="org.apache.http.legacy" android:name="org.apache.http.legacy"
......
...@@ -14,6 +14,9 @@ import com.mints.goodmoney.utils.LogUtil ...@@ -14,6 +14,9 @@ import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.ToastUtil import com.mints.goodmoney.utils.ToastUtil
import com.mints.goodmoney.utils.UIUtils import com.mints.goodmoney.utils.UIUtils
/**
* 描述:穿山甲Draw 信息流广告
*/
class CsjDrawAdManager private constructor(activity: Activity) { class CsjDrawAdManager private constructor(activity: Activity) {
companion object { companion object {
......
...@@ -8,7 +8,7 @@ import com.bytedance.sdk.openadsdk.TTAdNative; ...@@ -8,7 +8,7 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk; import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.mints.goodmoney.ad.video.base.BaseVideoAd; import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener; import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
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.TtCsjAdManager; import com.mints.goodmoney.manager.TtCsjAdManager;
...@@ -20,7 +20,7 @@ public class CsjFullVideoAdManager extends BaseVideoAd { ...@@ -20,7 +20,7 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
private static CsjFullVideoAdManager _inst; private static CsjFullVideoAdManager _inst;
private VedioAdStatusListener vedioAdStatusListener; private VideoAdStatusListener videoAdStatusListener;
Activity activity; Activity activity;
private TTAdNative ttAdNative; private TTAdNative ttAdNative;
...@@ -68,8 +68,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd { ...@@ -68,8 +68,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
public void onError(int code, String message) { public void onError(int code, String message) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, String.valueOf(code), message); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
...@@ -92,16 +92,16 @@ public class CsjFullVideoAdManager extends BaseVideoAd { ...@@ -92,16 +92,16 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
} }
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_TWO, "", ""); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_TWO, "", "");
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adDownload(); videoAdStatusListener.adDownload();
} }
} }
@Override @Override
public void onAdClose() { public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_THREE, "", ""); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_THREE, "", "");
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adSuccess(); videoAdStatusListener.adSuccess();
} }
if (activity != null) { if (activity != null) {
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJFULL, extraId, curCoin)); TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJFULL, extraId, curCoin));
...@@ -129,8 +129,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd { ...@@ -129,8 +129,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
} else { } else {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail"); TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJFULL, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
} }
...@@ -146,8 +146,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd { ...@@ -146,8 +146,8 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
activity = null; activity = null;
} }
public void setVedioAdStatusListener(VedioAdStatusListener vedioAdStatusListener) { public void setVideoAdStatusListener(VideoAdStatusListener videoAdStatusListener) {
this.vedioAdStatusListener = vedioAdStatusListener; this.videoAdStatusListener = videoAdStatusListener;
} }
} }
...@@ -9,7 +9,7 @@ import com.bytedance.sdk.openadsdk.TTAppDownloadListener; ...@@ -9,7 +9,7 @@ import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd; import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.goodmoney.BuildConfig; import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.ad.video.base.BaseVideoAd; import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener; import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
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.TTNativeExpressManager; import com.mints.goodmoney.manager.TTNativeExpressManager;
...@@ -33,7 +33,7 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -33,7 +33,7 @@ public class CsjVideoAdManager extends BaseVideoAd {
private AppPreferences ps; private AppPreferences ps;
private int curCoin; private int curCoin;
private String extraId; private String extraId;
private VedioAdStatusListener vedioAdStatusListener; private VideoAdStatusListener videoAdStatusListener;
Activity activity; Activity activity;
private TTAdNative ttAdNative; private TTAdNative ttAdNative;
...@@ -151,8 +151,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -151,8 +151,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
LogUtil.d("vedioAdStatusListener", "onError " + code + message); LogUtil.d("vedioAdStatusListener", "onError " + code + message);
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
...@@ -165,8 +165,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -165,8 +165,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
} 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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
} }
...@@ -197,8 +197,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -197,8 +197,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adDownload(); videoAdStatusListener.adDownload();
} }
} }
...@@ -206,8 +206,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -206,8 +206,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adSuccess(); videoAdStatusListener.adSuccess();
} }
} }
...@@ -219,8 +219,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -219,8 +219,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
...@@ -300,8 +300,8 @@ public class CsjVideoAdManager extends BaseVideoAd { ...@@ -300,8 +300,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
return vo; return vo;
} }
public void setVedioAdStatusListener(VedioAdStatusListener vedioAdStatusListener) { public void setVideoAdStatusListener(VideoAdStatusListener videoAdStatusListener) {
this.vedioAdStatusListener = vedioAdStatusListener; this.videoAdStatusListener = videoAdStatusListener;
} }
} }
...@@ -6,7 +6,7 @@ import com.kwad.sdk.api.KsLoadManager ...@@ -6,7 +6,7 @@ import com.kwad.sdk.api.KsLoadManager
import com.kwad.sdk.api.KsRewardVideoAd import com.kwad.sdk.api.KsRewardVideoAd
import com.kwad.sdk.api.KsScene import com.kwad.sdk.api.KsScene
import com.mints.goodmoney.ad.video.base.BaseVideoAd import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
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.KsManager import com.mints.goodmoney.manager.KsManager
...@@ -22,7 +22,7 @@ private val TAG = KsVideoAdManager::class.java.simpleName ...@@ -22,7 +22,7 @@ private val TAG = KsVideoAdManager::class.java.simpleName
class KsVideoAdManager private constructor(activity: Activity) : class KsVideoAdManager private constructor(activity: Activity) :
BaseVideoAd() { BaseVideoAd() {
private var vedioAdStatusListener: VedioAdStatusListener? = null private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: KsRewardVideoAd? = null private var mRewardVideoAd: KsRewardVideoAd? = null
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
...@@ -55,7 +55,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -55,7 +55,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
val scene = KsScene.Builder(KsManager.KS_AD_VEDIO_POSTID).build() val scene = KsScene.Builder(KsManager.KS_AD_VEDIO_POSTID).build()
KsAdSDK.getLoadManager().loadRewardVideoAd(scene, object : KsLoadManager.RewardVideoAdListener { KsAdSDK.getLoadManager().loadRewardVideoAd(scene, object : KsLoadManager.RewardVideoAdListener {
override fun onError(p0: Int, p1: String?) { override fun onError(p0: Int, p1: String?) {
vedioAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) { override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) {
...@@ -77,7 +77,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -77,7 +77,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_FOUR, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false isClickScreen = false
} }
vedioAdStatusListener?.adDownload() videoAdStatusListener?.adDownload()
} }
override fun onPageDismiss() { override fun onPageDismiss() {
...@@ -87,7 +87,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -87,7 +87,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_THREE, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_THREE, "", "")
vedioAdStatusListener?.adSuccess() videoAdStatusListener?.adSuccess()
} }
override fun onVideoPlayError(p0: Int, p1: Int) { override fun onVideoPlayError(p0: Int, p1: Int) {
...@@ -95,7 +95,7 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -95,7 +95,7 @@ class KsVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, (p0).toString(), "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
vedioAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
override fun onVideoPlayEnd() { override fun onVideoPlayEnd() {
...@@ -123,8 +123,8 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -123,8 +123,8 @@ class KsVideoAdManager private constructor(activity: Activity) :
} }
fun setVedioAdStatusListener(vedioAdStatusListener: VedioAdStatusListener?) { fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.vedioAdStatusListener = vedioAdStatusListener this.videoAdStatusListener = videoAdStatusListener
} }
......
...@@ -3,7 +3,7 @@ package com.mints.goodmoney.ad.video ...@@ -3,7 +3,7 @@ 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
import com.mints.goodmoney.ad.video.base.BaseVideoAd import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
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.MhManager import com.mints.goodmoney.manager.MhManager
...@@ -18,7 +18,7 @@ private val TAG = MhVideoAdManager::class.java.simpleName ...@@ -18,7 +18,7 @@ private val TAG = MhVideoAdManager::class.java.simpleName
class MhVideoAdManager private constructor(activity: Activity) : class MhVideoAdManager private constructor(activity: Activity) :
BaseVideoAd() { BaseVideoAd() {
private var vedioAdStatusListener: VedioAdStatusListener? = null private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: RewardVideoAd? = null private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
...@@ -85,7 +85,7 @@ class MhVideoAdManager private constructor(activity: Activity) : ...@@ -85,7 +85,7 @@ class MhVideoAdManager 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
} }
vedioAdStatusListener?.adDownload() videoAdStatusListener?.adDownload()
} }
override fun onVideoComplete() { override fun onVideoComplete() {
...@@ -99,7 +99,7 @@ class MhVideoAdManager private constructor(activity: Activity) : ...@@ -99,7 +99,7 @@ class MhVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
vedioAdStatusListener?.adSuccess() videoAdStatusListener?.adSuccess()
} }
override fun onADError(p0: Int) { override fun onADError(p0: Int) {
...@@ -107,7 +107,7 @@ class MhVideoAdManager private constructor(activity: Activity) : ...@@ -107,7 +107,7 @@ class MhVideoAdManager 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(), "")
vedioAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
}) })
...@@ -115,8 +115,8 @@ class MhVideoAdManager private constructor(activity: Activity) : ...@@ -115,8 +115,8 @@ class MhVideoAdManager private constructor(activity: Activity) :
mRewardVideoAd?.loadAd() mRewardVideoAd?.loadAd()
} }
fun setVedioAdStatusListener(vedioAdStatusListener: VedioAdStatusListener?) { fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.vedioAdStatusListener = vedioAdStatusListener this.videoAdStatusListener = videoAdStatusListener
} }
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.fly.videowake.ad.ManageVideoAd
import com.fly.videowake.ad.VideoRewardListener
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.utils.LogUtil
private val TAG = RTAVideoAdManager::class.java.simpleName
/**
* ACT激励视频
*/
class RTAVideoAdManager private constructor(activity: Activity) : BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var isClickScreen: Boolean = true
private var activity: Activity? = null
private var manageVideoAd: ManageVideoAd? = null
companion object {
const val RTA_ID = 38
private var _inst: RTAVideoAdManager? = null
fun getInstance(activity: Activity): RTAVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = RTAVideoAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
manageVideoAd = ManageVideoAd(activity, RTA_ID, MintsApplication.OAID)
manageVideoAd?.setVideoRewardListener(object : VideoRewardListener {
override fun onVideoPlayStart() {
LogUtil.d(TAG, "onVideoPlayStart -> ")
}
override fun onLoadSuccess() {
LogUtil.d(TAG, "onLoadSuccess -> ")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_RTA, Constant.EVENT_TYPE_ZERO, "", "")
// 展示广告
manageVideoAd?.showAD()
}
override fun onAdShow() {
LogUtil.d(TAG, "onAdShow -> ")
}
override fun onVideoPlaySkip() {
LogUtil.d(TAG, "onVideoPlaySkip -> ")
}
override fun onLoadFail(p0: String?) {
LogUtil.d(TAG, "onLoadFail -> " + p0)
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_RTA, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
videoAdStatusListener?.adFail()
}
override fun onAdClick() {
LogUtil.d(TAG, "onAdClick -> ")
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_RTA, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_RTA, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
videoAdStatusListener?.adDownload()
}
override fun onVideoPlayComplete() {
LogUtil.d(TAG, "onVideoPlayComplete -> ")
}
override fun onAdClosed() {
LogUtil.d(TAG, "onAdClosed -> ")
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_RTA, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_RTA, Constant.EVENT_TYPE_THREE, "", "")
videoAdStatusListener?.adSuccess()
}
})
manageVideoAd?.loadAD()
}
fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.videoAdStatusListener = videoAdStatusListener
}
override fun onDestroy() {
manageVideoAd?.setVideoRewardListener(null)
manageVideoAd = null
activity = null
}
}
\ No newline at end of file
...@@ -5,7 +5,7 @@ import android.text.TextUtils ...@@ -5,7 +5,7 @@ import android.text.TextUtils
import androidx.annotation.Nullable import androidx.annotation.Nullable
import com.mints.goodmoney.BuildConfig import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.ad.video.base.BaseVideoAd import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
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
...@@ -32,7 +32,7 @@ class ShVideoAdManager private constructor(activity: Activity) : ...@@ -32,7 +32,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
private var activity: Activity? = null private var activity: Activity? = null
private var vedioAdStatusListener: VedioAdStatusListener? = null private var videoAdStatusListener: VideoAdStatusListener? = null
private lateinit var ps: AppPreferences private lateinit var ps: AppPreferences
companion object { companion object {
...@@ -106,7 +106,7 @@ class ShVideoAdManager private constructor(activity: Activity) : ...@@ -106,7 +106,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ONE, (adError.code).toString(), "")
vedioAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
override fun onAdShow(@Nullable ad: CoralAD?): Boolean { override fun onAdShow(@Nullable ad: CoralAD?): Boolean {
...@@ -128,7 +128,7 @@ class ShVideoAdManager private constructor(activity: Activity) : ...@@ -128,7 +128,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_FOUR, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false isClickScreen = false
} }
vedioAdStatusListener?.adDownload() videoAdStatusListener?.adDownload()
return super.onAdClicked(ad) return super.onAdClicked(ad)
} }
...@@ -167,7 +167,7 @@ class ShVideoAdManager private constructor(activity: Activity) : ...@@ -167,7 +167,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
LogUtil.d(TAG, "onVideoClosed") LogUtil.d(TAG, "onVideoClosed")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
vedioAdStatusListener?.adSuccess() videoAdStatusListener?.adSuccess()
return super.onVideoClosed(coralAD, s) return super.onVideoClosed(coralAD, s)
} }
...@@ -175,8 +175,8 @@ class ShVideoAdManager private constructor(activity: Activity) : ...@@ -175,8 +175,8 @@ class ShVideoAdManager private constructor(activity: Activity) :
} }
fun setVedioAdStatusListener(vedioAdStatusListener: VedioAdStatusListener?) { fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.vedioAdStatusListener = vedioAdStatusListener this.videoAdStatusListener = videoAdStatusListener
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -7,9 +7,7 @@ import android.content.Intent; ...@@ -7,9 +7,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.text.TextUtils; import android.text.TextUtils;
import com.mints.goodmoney.ad.video.base.BaseVideoAd; import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
import com.mints.goodmoney.ad.video.base.ChannelRuleEnum;
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener;
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;
...@@ -44,6 +42,7 @@ public class VideoAdingManager { ...@@ -44,6 +42,7 @@ public class VideoAdingManager {
private ShVideoAdManager shVideoAdManager; private ShVideoAdManager shVideoAdManager;
private CsjFullVideoAdManager csjFullVideoAdManager; private CsjFullVideoAdManager csjFullVideoAdManager;
private KsVideoAdManager ksVideoAdManager; private KsVideoAdManager ksVideoAdManager;
private RTAVideoAdManager rtaVideoAdManager;
private int wnWeight; private int wnWeight;
private int ylhWeight; private int ylhWeight;
...@@ -52,6 +51,7 @@ public class VideoAdingManager { ...@@ -52,6 +51,7 @@ public class VideoAdingManager {
private int shVideoWeight; private int shVideoWeight;
private int csjFullVideoWeight; private int csjFullVideoWeight;
private int ksVideoWeight; private int ksVideoWeight;
private int rtaVideoWeight;
private ArrayList<WeightBean> weightList; private ArrayList<WeightBean> weightList;
...@@ -82,12 +82,13 @@ public class VideoAdingManager { ...@@ -82,12 +82,13 @@ public class VideoAdingManager {
private void init(Activity activity) { private void init(Activity activity) {
this.activity = activity; this.activity = activity;
csjVideoAdManager = CsjVideoAdManager.getInstance(activity); csjVideoAdManager = CsjVideoAdManager.getInstance(activity);
ylhVideoAdManager = YlhVideoAdManager.getInstance(activity); ylhVideoAdManager = YlhVideoAdManager.getInstance();
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity); csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
wnVideoAdManager = WnVideoAdManager.Companion.getInstance(activity); wnVideoAdManager = WnVideoAdManager.Companion.getInstance(activity);
mhVideoAdManager = MhVideoAdManager.Companion.getInstance(activity); mhVideoAdManager = MhVideoAdManager.Companion.getInstance(activity);
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity); shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity); ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity);
rtaVideoAdManager = RTAVideoAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>(); weightList = new ArrayList<>();
} }
...@@ -130,8 +131,10 @@ public class VideoAdingManager { ...@@ -130,8 +131,10 @@ public class VideoAdingManager {
/** /**
* 初始化广告权重 * 初始化广告权重
*/ */
public void initAdWeight(int csjVideoWeight, int ylhWeight, int wnWeight, int flVideoWeight, public void initAdWeight(int csjVideoWeight, int ylhWeight,
int shVideoWeight, int csjFullVideoWeight, int ksVideoWeight) { int wnWeight, int flVideoWeight,
int shVideoWeight, int csjFullVideoWeight,
int ksVideoWeight, int rtaVideoWeight) {
this.csjVideoWeight = csjVideoWeight; this.csjVideoWeight = csjVideoWeight;
this.ylhWeight = ylhWeight; this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight; this.wnWeight = wnWeight;
...@@ -139,6 +142,7 @@ public class VideoAdingManager { ...@@ -139,6 +142,7 @@ public class VideoAdingManager {
this.shVideoWeight = shVideoWeight; this.shVideoWeight = shVideoWeight;
this.csjFullVideoWeight = csjFullVideoWeight; this.csjFullVideoWeight = csjFullVideoWeight;
this.ksVideoWeight = ksVideoWeight; this.ksVideoWeight = ksVideoWeight;
this.rtaVideoWeight = rtaVideoWeight;
} }
/** /**
...@@ -279,13 +283,18 @@ public class VideoAdingManager { ...@@ -279,13 +283,18 @@ public class VideoAdingManager {
if (AppConfig.csjFullVideoAdCount > 0) { if (AppConfig.csjFullVideoAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD)); weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullVideoWeight; weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVedioWeight:" + csjFullVideoWeight); LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight);
} }
if (AppConfig.ksVideoAdCount > 0) { if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD)); weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight; weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight); LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
} }
if (AppConfig.rtaVideoAdCount > 0) {
weightList.add(new WeightBean(rtaVideoWeight, Constant.RTA_VEDIO_AD));
weight = weight + rtaVideoWeight;
LogUtil.d(TAG, "权重值:rtaWeight:" + rtaVideoWeight);
}
if (AppConfig.shVideoAdCount > 0) { if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD)); weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight; weight = weight + shVideoWeight;
...@@ -343,6 +352,7 @@ public class VideoAdingManager { ...@@ -343,6 +352,7 @@ public class VideoAdingManager {
int flVideoAdCount = AppConfig.flVideoAdCount; int flVideoAdCount = AppConfig.flVideoAdCount;
int tzVideoAdCount = AppConfig.shVideoAdCount; int tzVideoAdCount = AppConfig.shVideoAdCount;
int ksVideoAdCount = AppConfig.ksVideoAdCount; int ksVideoAdCount = AppConfig.ksVideoAdCount;
int rtaVideoAdCount = AppConfig.rtaVideoAdCount;
int csjFullVideoAdCount = AppConfig.csjFullVideoAdCount; int csjFullVideoAdCount = AppConfig.csjFullVideoAdCount;
if (ylhAdCount <= 0 && if (ylhAdCount <= 0 &&
...@@ -351,7 +361,8 @@ public class VideoAdingManager { ...@@ -351,7 +361,8 @@ public class VideoAdingManager {
flVideoAdCount <= 0 && flVideoAdCount <= 0 &&
tzVideoAdCount <= 0 && tzVideoAdCount <= 0 &&
csjFullVideoAdCount <= 0 && csjFullVideoAdCount <= 0 &&
ksVideoAdCount <= 0) { ksVideoAdCount <= 0 &&
rtaVideoAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧"); // showToast("今日视频已看完,请明天再来吧");
return true; return true;
} }
...@@ -361,42 +372,47 @@ public class VideoAdingManager { ...@@ -361,42 +372,47 @@ public class VideoAdingManager {
/** /**
* 释放资源 * 释放资源
*/ */
public void onDestory() { public void onDestroy() {
if (csjVideoAdManager != null) { if (csjVideoAdManager != null) {
csjVideoAdManager.setVedioAdStatusListener(null); csjVideoAdManager.setVideoAdStatusListener(null);
csjVideoAdManager.onDestroy(); csjVideoAdManager.onDestroy();
csjVideoAdManager = null; csjVideoAdManager = null;
} }
if (ylhVideoAdManager != null) { if (ylhVideoAdManager != null) {
ylhVideoAdManager.setVedioAdStatusListener(null); ylhVideoAdManager.setVideoAdStatusListener(null);
ylhVideoAdManager.onDestroy(); ylhVideoAdManager.onDestroy();
ylhVideoAdManager = null; ylhVideoAdManager = null;
} }
if (wnVideoAdManager != null) { if (wnVideoAdManager != null) {
wnVideoAdManager.setVedioAdStatusListener(null); wnVideoAdManager.setVideoAdStatusListener(null);
wnVideoAdManager.onDestroy(); wnVideoAdManager.onDestroy();
wnVideoAdManager = null; wnVideoAdManager = null;
} }
if (mhVideoAdManager != null) { if (mhVideoAdManager != null) {
mhVideoAdManager.setVedioAdStatusListener(null); mhVideoAdManager.setVideoAdStatusListener(null);
mhVideoAdManager.onDestroy(); mhVideoAdManager.onDestroy();
mhVideoAdManager = null; mhVideoAdManager = null;
} }
if (csjFullVideoAdManager != null) { if (csjFullVideoAdManager != null) {
csjFullVideoAdManager.setVedioAdStatusListener(null); csjFullVideoAdManager.setVideoAdStatusListener(null);
csjFullVideoAdManager.onDestroy(); csjFullVideoAdManager.onDestroy();
csjFullVideoAdManager = null; csjFullVideoAdManager = null;
} }
if (shVideoAdManager != null) { if (shVideoAdManager != null) {
shVideoAdManager.setVedioAdStatusListener(null); shVideoAdManager.setVideoAdStatusListener(null);
shVideoAdManager.onDestroy(); shVideoAdManager.onDestroy();
shVideoAdManager = null; shVideoAdManager = null;
} }
if (ksVideoAdManager != null) { if (ksVideoAdManager != null) {
ksVideoAdManager.setVedioAdStatusListener(null); ksVideoAdManager.setVideoAdStatusListener(null);
ksVideoAdManager.onDestroy(); ksVideoAdManager.onDestroy();
ksVideoAdManager = null; ksVideoAdManager = null;
} }
if (rtaVideoAdManager != null) {
rtaVideoAdManager.setVideoAdStatusListener(null);
rtaVideoAdManager.onDestroy();
rtaVideoAdManager = null;
}
if (mReceiverBroadcastReceiver != null) { if (mReceiverBroadcastReceiver != null) {
activity.stopService(new Intent(activity, AppInstallService.class)); activity.stopService(new Intent(activity, AppInstallService.class));
...@@ -439,10 +455,10 @@ public class VideoAdingManager { ...@@ -439,10 +455,10 @@ public class VideoAdingManager {
} }
return; return;
} }
ylhVideoAdManager = YlhVideoAdManager.getInstance(activity); ylhVideoAdManager = YlhVideoAdManager.getInstance();
} }
ylhVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { ylhVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adFail() { public void adFail() {
if (videoAdingListener != null) { if (videoAdingListener != null) {
...@@ -481,7 +497,7 @@ public class VideoAdingManager { ...@@ -481,7 +497,7 @@ public class VideoAdingManager {
} }
csjVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { csjVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adFail() { public void adFail() {
if (videoAdingListener != null) { if (videoAdingListener != null) {
...@@ -517,7 +533,7 @@ public class VideoAdingManager { ...@@ -517,7 +533,7 @@ public class VideoAdingManager {
} }
wnVideoAdManager = WnVideoAdManager.Companion.getInstance(activity); wnVideoAdManager = WnVideoAdManager.Companion.getInstance(activity);
} }
wnVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { wnVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adSuccess() { public void adSuccess() {
AppConfig.wnVideoAdCount--; AppConfig.wnVideoAdCount--;
...@@ -553,7 +569,7 @@ public class VideoAdingManager { ...@@ -553,7 +569,7 @@ public class VideoAdingManager {
} }
mhVideoAdManager = MhVideoAdManager.Companion.getInstance(activity); mhVideoAdManager = MhVideoAdManager.Companion.getInstance(activity);
} }
mhVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { mhVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adSuccess() { public void adSuccess() {
AppConfig.flVideoAdCount--; AppConfig.flVideoAdCount--;
...@@ -590,7 +606,7 @@ public class VideoAdingManager { ...@@ -590,7 +606,7 @@ public class VideoAdingManager {
} }
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity); csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
} }
csjFullVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener(){ csjFullVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adSuccess() { public void adSuccess() {
AppConfig.csjFullVideoAdCount--; AppConfig.csjFullVideoAdCount--;
...@@ -627,7 +643,7 @@ public class VideoAdingManager { ...@@ -627,7 +643,7 @@ public class VideoAdingManager {
} }
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity); shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
} }
shVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { shVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adSuccess() { public void adSuccess() {
AppConfig.shVideoAdCount--; AppConfig.shVideoAdCount--;
...@@ -664,7 +680,7 @@ public class VideoAdingManager { ...@@ -664,7 +680,7 @@ public class VideoAdingManager {
} }
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity); ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity);
} }
ksVideoAdManager.setVedioAdStatusListener(new VedioAdStatusListener() { ksVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override @Override
public void adSuccess() { public void adSuccess() {
AppConfig.ksVideoAdCount--; AppConfig.ksVideoAdCount--;
...@@ -690,8 +706,41 @@ public class VideoAdingManager { ...@@ -690,8 +706,41 @@ public class VideoAdingManager {
}); });
ksVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId()); ksVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(videoAdType, Constant.RTA_VEDIO_AD)) {
// RTA广告激励视频
if (rtaVideoAdManager == null) {
if (activity == null) {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerError(Constant.RTA_VEDIO_AD);
}
return;
}
rtaVideoAdManager = RTAVideoAdManager.Companion.getInstance(activity);
}
rtaVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
@Override
public void adSuccess() {
AppConfig.rtaVideoAdCount--;
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerSuccess(Constant.RTA_VEDIO_AD);
}
}
@Override
public void adFail() {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerFail(Constant.RTA_VEDIO_AD);
}
}
@Override
public void adDownload() {
}
});
} }
rtaVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
// ChannelRuleEnum channelRule = ChannelRuleEnum.match(videoAdType); // ChannelRuleEnum channelRule = ChannelRuleEnum.match(videoAdType);
// BaseVideoAd rule = channelRule.channel; // BaseVideoAd rule = channelRule.channel;
// if (rule != null) { // if (rule != null) {
......
...@@ -2,7 +2,7 @@ package com.mints.goodmoney.ad.video ...@@ -2,7 +2,7 @@ package com.mints.goodmoney.ad.video
import android.app.Activity import android.app.Activity
import com.mints.goodmoney.ad.video.base.BaseVideoAd import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
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
...@@ -18,7 +18,7 @@ private val TAG = WnVideoAdManager::class.java.simpleName ...@@ -18,7 +18,7 @@ private val TAG = WnVideoAdManager::class.java.simpleName
class WnVideoAdManager private constructor(activity: Activity) : class WnVideoAdManager private constructor(activity: Activity) :
BaseVideoAd() { BaseVideoAd() {
private var vedioAdStatusListener: VedioAdStatusListener? = null private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: WNRewardVideoAd? = null private var mRewardVideoAd: WNRewardVideoAd? = null
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
...@@ -66,7 +66,7 @@ class WnVideoAdManager private constructor(activity: Activity) : ...@@ -66,7 +66,7 @@ class WnVideoAdManager 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)
vedioAdStatusListener?.adFail() videoAdStatusListener?.adFail()
} }
override fun onLoad(ad: WNRewardVideoAd) { override fun onLoad(ad: WNRewardVideoAd) {
...@@ -87,7 +87,7 @@ class WnVideoAdManager private constructor(activity: Activity) : ...@@ -87,7 +87,7 @@ class WnVideoAdManager 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
} }
vedioAdStatusListener?.adDownload() videoAdStatusListener?.adDownload()
} }
override fun onAdClose() { override fun onAdClose() {
...@@ -95,7 +95,7 @@ class WnVideoAdManager private constructor(activity: Activity) : ...@@ -95,7 +95,7 @@ class WnVideoAdManager private constructor(activity: Activity) :
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
vedioAdStatusListener?.adSuccess() videoAdStatusListener?.adSuccess()
} }
override fun onVideoComplete() { override fun onVideoComplete() {
...@@ -120,8 +120,8 @@ class WnVideoAdManager private constructor(activity: Activity) : ...@@ -120,8 +120,8 @@ class WnVideoAdManager private constructor(activity: Activity) :
}) })
} }
fun setVedioAdStatusListener(vedioAdStatusListener: VedioAdStatusListener?) { fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.vedioAdStatusListener = vedioAdStatusListener this.videoAdStatusListener = videoAdStatusListener
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -4,7 +4,7 @@ import android.app.Activity; ...@@ -4,7 +4,7 @@ import android.app.Activity;
import android.os.SystemClock; import android.os.SystemClock;
import com.mints.goodmoney.ad.video.base.BaseVideoAd; import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import com.mints.goodmoney.ad.video.base.VedioAdStatusListener; import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
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;
...@@ -14,8 +14,6 @@ import com.qq.e.ads.rewardvideo.RewardVideoAD; ...@@ -14,8 +14,6 @@ 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;
import java.lang.ref.WeakReference;
/** /**
* 优量汇视频 * 优量汇视频
*/ */
...@@ -26,32 +24,21 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -26,32 +24,21 @@ public class YlhVideoAdManager extends BaseVideoAd {
// 优量汇激励视频 // 优量汇激励视频
private RewardVideoAD rewardVideoAD; private RewardVideoAD rewardVideoAD;
private VedioAdStatusListener vedioAdStatusListener; private VideoAdStatusListener videoAdStatusListener;
private Activity activity;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告 private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVideoAdManager getInstance(Activity activity) { public static YlhVideoAdManager getInstance() {
if (_inst != null) { if (_inst != null) {
return _inst; return _inst;
} else { } else {
_inst = new YlhVideoAdManager(activity); _inst = new YlhVideoAdManager();
return _inst; return _inst;
} }
} }
private YlhVideoAdManager(Activity activity) {
init(activity);
}
private void init(Activity activity) {
this.activity = activity;
}
@Override @Override
public void onDestroy() { public void onDestroy() {
activity = null;
rewardVideoAD = null; rewardVideoAD = null;
} }
...@@ -60,7 +47,6 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -60,7 +47,6 @@ public class YlhVideoAdManager extends BaseVideoAd {
*/ */
@Override @Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) { public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true; isClickScreen = true;
String ylhPostId; String ylhPostId;
...@@ -151,8 +137,8 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -151,8 +137,8 @@ public class YlhVideoAdManager extends BaseVideoAd {
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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
} }
...@@ -193,8 +179,8 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -193,8 +179,8 @@ public class YlhVideoAdManager extends BaseVideoAd {
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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adDownload(); videoAdStatusListener.adDownload();
} }
} }
...@@ -209,8 +195,8 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -209,8 +195,8 @@ public class YlhVideoAdManager extends BaseVideoAd {
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin)); TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin));
if (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adSuccess(); videoAdStatusListener.adSuccess();
} }
} }
...@@ -223,8 +209,8 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -223,8 +209,8 @@ public class YlhVideoAdManager extends BaseVideoAd {
// 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 (vedioAdStatusListener != null) { if (videoAdStatusListener != null) {
vedioAdStatusListener.adFail(); videoAdStatusListener.adFail();
} }
} }
}); });
...@@ -232,7 +218,7 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -232,7 +218,7 @@ public class YlhVideoAdManager extends BaseVideoAd {
rewardVideoAD.loadAD(); rewardVideoAD.loadAD();
} }
public void setVedioAdStatusListener(VedioAdStatusListener vedioAdStatusListener) { public void setVideoAdStatusListener(VideoAdStatusListener videoAdStatusListener) {
this.vedioAdStatusListener = vedioAdStatusListener; this.videoAdStatusListener = videoAdStatusListener;
} }
} }
...@@ -3,7 +3,7 @@ package com.mints.goodmoney.ad.video.base ...@@ -3,7 +3,7 @@ package com.mints.goodmoney.ad.video.base
/** /**
* 广告状态触发事件 * 广告状态触发事件
*/ */
interface VedioAdStatusListener { interface VideoAdStatusListener {
/** /**
* 广告加载失败 * 广告加载失败
*/ */
......
...@@ -97,6 +97,10 @@ public class AppConfig { ...@@ -97,6 +97,10 @@ public class AppConfig {
* ksVideo 剩余广告播放数 * ksVideo 剩余广告播放数
*/ */
public static int ksVideoAdCount = 5; public static int ksVideoAdCount = 5;
/**
* rtaVideo 剩余广告播放数
*/
public static int rtaVideoAdCount = 5;
/** /**
* 高额试玩任务标识 * 高额试玩任务标识
......
...@@ -148,6 +148,7 @@ object Constant { ...@@ -148,6 +148,7 @@ object Constant {
const val AD_SOURCE_CSJFULL = "CSJFULL" const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓 const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手 const val AD_SOURCE_KS = "KS" //快手
const val AD_SOURCE_RTA = "RTA" //RTA
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重 // 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0" const val EVENT_TYPE_ZERO = "0"
...@@ -169,6 +170,7 @@ object Constant { ...@@ -169,6 +170,7 @@ object Constant {
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD" const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD" const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD" const val KS_VEDIO_AD = "KS_VEDIO_AD"
const val RTA_VEDIO_AD = "RTA_VEDIO_AD"
// 信息流广告类型 // 信息流广告类型
const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD" const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD"
......
...@@ -87,6 +87,15 @@ public class DrawcashBean implements Serializable { ...@@ -87,6 +87,15 @@ public class DrawcashBean implements Serializable {
private int FL_VEDIO; private int FL_VEDIO;
private int CORAL_VEDIO; private int CORAL_VEDIO;
private int KS_VEDIO; private int KS_VEDIO;
private int RTA_VEDIO;
public int getRTA_VEDIO() {
return RTA_VEDIO;
}
public void setRTA_VEDIO(int RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
public int getCORAL_VEDIO() { public int getCORAL_VEDIO() {
return CORAL_VEDIO; return CORAL_VEDIO;
......
...@@ -11,6 +11,7 @@ public class VedioRulesBean implements Serializable { ...@@ -11,6 +11,7 @@ public class VedioRulesBean implements Serializable {
private CsjfullVedioBean CSJFULL_VEDIO; private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO; private CORALVedioBean CORAL_VEDIO;
private KSVedioBean KS_VEDIO; private KSVedioBean KS_VEDIO;
private RTAVedioBean RTA_VEDIO;
private boolean flVideoFlag; private boolean flVideoFlag;
public class CsjVedioBean implements Serializable { public class CsjVedioBean implements Serializable {
...@@ -91,6 +92,19 @@ public class VedioRulesBean implements Serializable { ...@@ -91,6 +92,19 @@ public class VedioRulesBean implements Serializable {
} }
} }
public class RTAVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class CsjfullVedioBean implements Serializable { public class CsjfullVedioBean implements Serializable {
private int surplus; private int surplus;
private int rate; private int rate;
...@@ -125,6 +139,14 @@ public class VedioRulesBean implements Serializable { ...@@ -125,6 +139,14 @@ public class VedioRulesBean implements Serializable {
return CORAL_VEDIO; return CORAL_VEDIO;
} }
public RTAVedioBean getRTA_VEDIO() {
return RTA_VEDIO;
}
public void setRTA_VEDIO(RTAVedioBean RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
public KSVedioBean getKS_VEDIO() { public KSVedioBean getKS_VEDIO() {
return KS_VEDIO; return KS_VEDIO;
} }
......
...@@ -8,7 +8,9 @@ import android.content.Intent; ...@@ -8,7 +8,9 @@ import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.net.Uri; import android.net.Uri;
import android.os.IBinder; import android.os.IBinder;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod; import android.text.method.ScrollingMovementMethod;
import android.view.KeyEvent; import android.view.KeyEvent;
...@@ -56,6 +58,7 @@ public class VersionUpdatePresenter { ...@@ -56,6 +58,7 @@ public class VersionUpdatePresenter {
Button btnDuUpdate; Button btnDuUpdate;
private Subscription subscription; private Subscription subscription;
private UpdateService mUpdateService;
public void updateVersion(Activity activity) { public void updateVersion(Activity activity) {
if (activity == null) if (activity == null)
...@@ -210,6 +213,16 @@ public class VersionUpdatePresenter { ...@@ -210,6 +213,16 @@ public class VersionUpdatePresenter {
btnDuUpdate.setOnClickListener(new View.OnClickListener() { btnDuUpdate.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (TextUtils.equals(btnDuUpdate.getText(), "立即安装")) {
if (mUpdateService != null) {
mUpdateService.autoInstallApk();
} else {
ToastUtil.show(loanApplication.getApplicationContext(), "安装失败!");
System.exit(0);
}
return;
}
boolean url = CommonUtils.isUrl(appFileUrl); boolean url = CommonUtils.isUrl(appFileUrl);
if (url) { if (url) {
updateApp(appFileUrl, granted); updateApp(appFileUrl, granted);
...@@ -254,12 +267,13 @@ public class VersionUpdatePresenter { ...@@ -254,12 +267,13 @@ public class VersionUpdatePresenter {
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
// //返回一个MsgService对象 // //返回一个MsgService对象
UpdateService updateService = ((UpdateService.UpdateBinder) service).getService(); mUpdateService = ((UpdateService.UpdateBinder) service).getService();
// //
// //注册回调接口来接收下载进度的变化 // //注册回调接口来接收下载进度的变化
updateService.setUpdateNotification(new UpdateService.UpdateNotification() { mUpdateService.setUpdateNotification(new UpdateService.UpdateNotification() {
@Override @Override
public void updateProgress(int progress) { public void updateProgress(int progress) {
if (pbDuUpdating != null) { if (pbDuUpdating != null) {
pbDuUpdating.setProgress(progress); pbDuUpdating.setProgress(progress);
if (btnDuUpdate != null && progress == 100) { if (btnDuUpdate != null && progress == 100) {
...@@ -270,7 +284,13 @@ public class VersionUpdatePresenter { ...@@ -270,7 +284,13 @@ public class VersionUpdatePresenter {
@Override @Override
public void finishProgress() { public void finishProgress() {
if (pbDuUpdating != null) {
pbDuUpdating.setProgress(100);
}
if (btnDuUpdate != null) {
btnDuUpdate.setEnabled(true);
btnDuUpdate.setText("立即安装");
}
} }
}); });
...@@ -311,6 +331,7 @@ public class VersionUpdatePresenter { ...@@ -311,6 +331,7 @@ public class VersionUpdatePresenter {
} }
public void dispose() { public void dispose() {
mUpdateService = null;
loanService = null; loanService = null;
activity = null; activity = null;
loanApplication = null; loanApplication = null;
......
...@@ -12,13 +12,17 @@ import android.os.Build; ...@@ -12,13 +12,17 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Message; import android.os.Message;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.R; import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.ui.activitys.MainActivity; import com.mints.goodmoney.ui.activitys.MainActivity;
import com.mints.goodmoney.utils.ToastUtil;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
...@@ -202,6 +206,18 @@ public class UpdateService extends Service { ...@@ -202,6 +206,18 @@ public class UpdateService extends Service {
}).start(); }).start();
} }
/**
* 安装 apk 文件
*/
public void autoInstallApk() {
if (updateFile != null) {
autoInstallApk(updateFile);
} else {
ToastUtil.show(MintsApplication.getContext(), "安装失败!");
System.exit(0);
}
}
/** /**
* 安装 apk 文件 * 安装 apk 文件
*/ */
...@@ -210,7 +226,7 @@ public class UpdateService extends Service { ...@@ -210,7 +226,7 @@ public class UpdateService extends Service {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
} else {//Android7.0之后获取uri要用contentProvider } else {//Android7.0之后获取uri要用contentProvider
Uri contentUri = FileProvider.getUriForFile(getApplicationContext(), Constant.MINTS_PKG_NAME+".fileprovider", file); Uri contentUri = FileProvider.getUriForFile(getApplicationContext(), Constant.MINTS_PKG_NAME + ".fileprovider", file);
intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
} }
......
...@@ -400,7 +400,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -400,7 +400,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
flAwardAd?.removeAllViews() flAwardAd?.removeAllViews()
videoAdingManager.setVideoAdingListener(null) videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestory() videoAdingManager.onDestroy()
awardPresenter.detachView() awardPresenter.detachView()
......
...@@ -35,7 +35,6 @@ import com.mints.goodmoney.mvp.views.KylVideoView ...@@ -35,7 +35,6 @@ import com.mints.goodmoney.mvp.views.KylVideoView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.DrawVideoAdapter import com.mints.goodmoney.ui.adapter.DrawVideoAdapter
import com.mints.goodmoney.utils.MD5 import com.mints.goodmoney.utils.MD5
import com.mints.goodmoney.utils.ToastUtil
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.activity_draw_native_video.* import kotlinx.android.synthetic.main.activity_draw_native_video.*
...@@ -74,9 +73,6 @@ class DrawNativeVideoActivity : BaseActivity(), ...@@ -74,9 +73,6 @@ class DrawNativeVideoActivity : BaseActivity(),
const val WEB_VIDEO_URL = "https://vring.kuyin123.com/friend/94aa83142f7f5c98?videoId=" const val WEB_VIDEO_URL = "https://vring.kuyin123.com/friend/94aa83142f7f5c98?videoId="
} }
// Video 视频播放生命周期控制
private var isVideoPlayPause = false
// 列表页面播放page // 列表页面播放page
private var mCurrentPage = 0 private var mCurrentPage = 0
...@@ -309,7 +305,7 @@ class DrawNativeVideoActivity : BaseActivity(), ...@@ -309,7 +305,7 @@ class DrawNativeVideoActivity : BaseActivity(),
override fun onDestroy() { override fun onDestroy() {
mCsjDrawAdManager?.onDestroy() mCsjDrawAdManager?.onDestroy()
videoAdingManager.setVideoAdingListener(null) videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestory() videoAdingManager.onDestroy()
super.onDestroy() super.onDestroy()
......
...@@ -27,7 +27,6 @@ import com.mints.library.utils.CommonUtils ...@@ -27,7 +27,6 @@ import com.mints.library.utils.CommonUtils
import com.mints.library.utils.json.JsonUtil import com.mints.library.utils.json.JsonUtil
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_drawcash.* import kotlinx.android.synthetic.main.activity_drawcash.*
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.header_layout.* import kotlinx.android.synthetic.main.header_layout.*
import kotlinx.android.synthetic.main.view_title.* import kotlinx.android.synthetic.main.view_title.*
import java.math.BigDecimal import java.math.BigDecimal
...@@ -57,8 +56,8 @@ class DrawcashActivity : BaseActivity(), ...@@ -57,8 +56,8 @@ class DrawcashActivity : BaseActivity(),
private var isLoadRvItem: Boolean = true //是否首次加载rv item private var isLoadRvItem: Boolean = true //是否首次加载rv item
// private var isJDNewUser = false // private var isJDNewUser = false
// private var jumpJdUrl: String? = null // private var jumpJdUrl: String? = null
// private var jdTintDialog: JDTintDialog? = null // private var jdTintDialog: JDTintDialog? = null
override fun getContentViewLayoutID() = R.layout.activity_drawcash override fun getContentViewLayoutID() = R.layout.activity_drawcash
...@@ -306,7 +305,8 @@ class DrawcashActivity : BaseActivity(), ...@@ -306,7 +305,8 @@ class DrawcashActivity : BaseActivity(),
data.fL_VEDIO, data.fL_VEDIO,
data.coraL_VEDIO, data.coraL_VEDIO,
data.csjfulL_VEDIO, data.csjfulL_VEDIO,
data.kS_VEDIO data.kS_VEDIO,
data.rtA_VEDIO
) )
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " + LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
"ylhWeight:${data.ylH_VEDIO} " + "ylhWeight:${data.ylH_VEDIO} " +
...@@ -314,6 +314,7 @@ class DrawcashActivity : BaseActivity(), ...@@ -314,6 +314,7 @@ class DrawcashActivity : BaseActivity(),
"csjFullWeight:${data.csjfulL_VEDIO} " + "csjFullWeight:${data.csjfulL_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " + "shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO} " + "flWeight:${data.fL_VEDIO} " +
"rtaWeight:${data.rtA_VEDIO} " +
"ksWeight:${data.kS_VEDIO}" "ksWeight:${data.kS_VEDIO}"
) )
// 广告视频数 // 广告视频数
...@@ -324,6 +325,7 @@ class DrawcashActivity : BaseActivity(), ...@@ -324,6 +325,7 @@ class DrawcashActivity : BaseActivity(),
AppConfig.shVideoAdCount = 10 AppConfig.shVideoAdCount = 10
AppConfig.csjFullVideoAdCount = 10 AppConfig.csjFullVideoAdCount = 10
AppConfig.ksVideoAdCount = 10 AppConfig.ksVideoAdCount = 10
AppConfig.rtaVideoAdCount = 10
} }
/** /**
......
...@@ -20,7 +20,7 @@ import java.util.* ...@@ -20,7 +20,7 @@ import java.util.*
class GuideActivity : BaseActivity() { class GuideActivity : BaseActivity() {
private val animatorSet by lazy { AnimatorSet() } private val animatorSet by lazy { AnimatorSet() }
private var mImageViews = ArrayList<ImageView>() private var mImageViews = ArrayList<View>()
private val guideImgs = intArrayOf(R.mipmap.bg_guide1, R.mipmap.bg_guide2, R.mipmap.bg_guide3, R.mipmap.bg_guide4) private val guideImgs = intArrayOf(R.mipmap.bg_guide1, R.mipmap.bg_guide2, R.mipmap.bg_guide3, R.mipmap.bg_guide4)
override fun getContentViewLayoutID() = R.layout.activity_guide override fun getContentViewLayoutID() = R.layout.activity_guide
......
...@@ -100,7 +100,7 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView { ...@@ -100,7 +100,7 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView {
PRDownloader.cancel(downloadId) PRDownloader.cancel(downloadId)
} }
videoAdingManager.setVideoAdingListener(null) videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestory() videoAdingManager.onDestroy()
kylVideoPresenter.detachView() kylVideoPresenter.detachView()
} }
......
...@@ -96,7 +96,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -96,7 +96,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
TTPreLoadCarrierExpressManager.getInstance().onDestroy() TTPreLoadCarrierExpressManager.getInstance().onDestroy()
VideoAdingManager.getInstance(this).setVideoAdingListener(null) VideoAdingManager.getInstance(this).setVideoAdingListener(null)
VideoAdingManager.getInstance(this).onDestory() VideoAdingManager.getInstance(this).onDestroy()
} }
public override fun onSaveInstanceState(outState: Bundle) { public override fun onSaveInstanceState(outState: Bundle) {
......
...@@ -74,7 +74,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener { ...@@ -74,7 +74,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
} }
} }
if (!currentFragment!!.isAdded) { if (!currentFragment.isAdded) {
// 提交事务 // 提交事务
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, currentFragment).commitAllowingStateLoss() .add(R.id.flWrapper, currentFragment).commitAllowingStateLoss()
......
...@@ -3,7 +3,6 @@ package com.mints.goodmoney.ui.adapter; ...@@ -3,7 +3,6 @@ package com.mints.goodmoney.ui.adapter;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -18,7 +17,6 @@ import com.mints.goodmoney.common.Constant; ...@@ -18,7 +17,6 @@ import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.BxmManager; import com.mints.goodmoney.manager.BxmManager;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.model.BannerBean; import com.mints.goodmoney.mvp.model.BannerBean;
import com.mints.goodmoney.utils.ForegroundOrBackground;
import com.mints.library.utils.GlideUtils; import com.mints.library.utils.GlideUtils;
import java.util.List; import java.util.List;
...@@ -32,28 +30,35 @@ import java.util.List; ...@@ -32,28 +30,35 @@ import java.util.List;
public class GvMyAdapter extends BaseAdapter { public class GvMyAdapter extends BaseAdapter {
private List<BannerBean.ListBean> orders; private List<BannerBean.ListBean> orders;
private Context context;
private Activity activity; private Activity activity;
public GvMyAdapter(Context context, Activity activity, List<BannerBean.ListBean> orders) { private int mCurrentIndex;
private int mPageSize;
public GvMyAdapter(Activity activity, List<BannerBean.ListBean> orders, int currentIndex, int pageSize) {
this.orders = orders; this.orders = orders;
this.context = context;
this.activity = activity; this.activity = activity;
this.mCurrentIndex = currentIndex;
this.mPageSize = pageSize;
} }
@Override @Override
public int getCount() { public int getCount() {
return orders == null ? 0 : orders.size(); // return orders == null ? 0 : orders.size();
return orders.size() > (mCurrentIndex + 1) * mPageSize ? mPageSize : (orders.size() - mCurrentIndex * mPageSize);
} }
@Override @Override
public Object getItem(int position) { public Object getItem(int position) {
return orders.get(position); // return orders.get(position);
return orders.get(position + mCurrentIndex * mPageSize);
} }
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return position; // return position;
return position + mCurrentIndex * mPageSize;
} }
@SuppressLint("WrongViewCast") @SuppressLint("WrongViewCast")
...@@ -63,7 +68,7 @@ public class GvMyAdapter extends BaseAdapter { ...@@ -63,7 +68,7 @@ public class GvMyAdapter extends BaseAdapter {
ViewHolder viewHolder; ViewHolder viewHolder;
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(activity);
convertView = inflater.inflate(R.layout.item_list_my, null); convertView = inflater.inflate(R.layout.item_list_my, null);
viewHolder = new ViewHolder(); viewHolder = new ViewHolder();
...@@ -75,9 +80,15 @@ public class GvMyAdapter extends BaseAdapter { ...@@ -75,9 +80,15 @@ public class GvMyAdapter extends BaseAdapter {
} else { } else {
viewHolder = (ViewHolder) convertView.getTag(); viewHolder = (ViewHolder) convertView.getTag();
} }
BannerBean.ListBean data = orders.get(position);
/**
* 在给View绑定显示的数据时,计算正确的position = position + curIndex * pageSize
*/
int pos = position + mCurrentIndex * mPageSize;
BannerBean.ListBean data = orders.get(pos);
if (data != null) { if (data != null) {
GlideUtils.loadImageView(context, data.getImgUrl(), viewHolder.ic_my_icon); GlideUtils.loadImageView(activity, data.getImgUrl(), viewHolder.ic_my_icon);
viewHolder.tv_my_title.setText(data.getTitle()); viewHolder.tv_my_title.setText(data.getTitle());
if (TextUtils.equals(data.getToUrl(), Constant.HOT_ACTIVITY_BXM) && UserManager.getInstance().userIsLogin()) { if (TextUtils.equals(data.getToUrl(), Constant.HOT_ACTIVITY_BXM) && UserManager.getInstance().userIsLogin()) {
......
...@@ -9,6 +9,7 @@ import android.widget.ImageView ...@@ -9,6 +9,7 @@ import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
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.mvp.model.TzTaskBean import com.mints.goodmoney.mvp.model.TzTaskBean
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
...@@ -39,8 +40,8 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl ...@@ -39,8 +40,8 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == HOLDER_TYPE_SH_CPD) { if (viewType == HOLDER_TYPE_SH_CPD) {
// AdContainer 可能引起内存泄漏 // AdContainer 可能引起内存泄漏
val weakReference = WeakReference<Context>(context) // val weakReference = WeakReference<Context>(context)
val view = LayoutInflater.from(weakReference.get()).inflate(R.layout.item_task_recy, parent, false) val view = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.item_task_recy, parent, false)
return SHViewHolder(view) return SHViewHolder(view)
} }
......
package com.mints.goodmoney.ui.adapter; package com.mints.goodmoney.ui.adapter;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -15,16 +16,16 @@ import java.util.List; ...@@ -15,16 +16,16 @@ import java.util.List;
*/ */
public class ViewPagerAdapter extends PagerAdapter { public class ViewPagerAdapter extends PagerAdapter {
private List<ImageView> mImageViews; private List<View> mViews;
public ViewPagerAdapter(List<ImageView> mImageViews) { public ViewPagerAdapter(List<View> views) {
this.mImageViews = mImageViews; this.mViews = views;
} }
//设置viewpager条目的个数 //设置viewpager条目的个数
@Override @Override
public int getCount() { public int getCount() {
return mImageViews.size(); return mViews.size();
} }
//判断Viewpager的页面的view对象是否和instantiateItem返回的object一致 //判断Viewpager的页面的view对象是否和instantiateItem返回的object一致
...@@ -36,8 +37,8 @@ public class ViewPagerAdapter extends PagerAdapter { ...@@ -36,8 +37,8 @@ public class ViewPagerAdapter extends PagerAdapter {
//添加viewpager条目的方法 //添加viewpager条目的方法
@Override @Override
public Object instantiateItem(ViewGroup container, int position) { public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = mImageViews.get(position); View imageView = mViews.get(position);
//将imageview添加给viewpager //将view添加给viewpager
container.addView(imageView); container.addView(imageView);
return imageView; return imageView;
} }
......
...@@ -261,7 +261,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -261,7 +261,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
override fun getHomeVedioMsgSuc(data: MainVideoMsgBean) { override fun getHomeVedioMsgSuc(data: MainVideoMsgBean) {
if (activity == null || requireActivity().isFinishing) { if (activity == null || requireActivity().isFinishing) {
return return
...@@ -577,7 +576,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -577,7 +576,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
data.vedioRules.fL_VEDIO.rate, data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate, data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate, data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_VEDIO.rate
) )
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " + LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " + "ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
...@@ -585,6 +585,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -585,6 +585,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " + "csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " + "shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " + "flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"rtaWeight:${data.vedioRules.rtA_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}" "ksWeight:${data.vedioRules.kS_VEDIO.rate}"
) )
// 广告视频数 // 广告视频数
...@@ -595,18 +596,20 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -595,18 +596,20 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " + LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " + "ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " + "sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " + "csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " + "shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}" + "flCount:${AppConfig.flVideoAdCount} " +
"ratCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}" "ksCount:${AppConfig.ksVideoAdCount}"
) )
} }
private fun initExpress(flowAdRules: FlowAdRulesBean) { private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj,flowAdRules.ylh,flowAdRules.ks) PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks)
} }
/** /**
......
...@@ -9,10 +9,13 @@ import android.content.Intent ...@@ -9,10 +9,13 @@ import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.viewpager.widget.ViewPager
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
...@@ -32,13 +35,17 @@ import com.mints.goodmoney.service.AppInstallService ...@@ -32,13 +35,17 @@ import com.mints.goodmoney.service.AppInstallService
import com.mints.goodmoney.ui.activitys.* import com.mints.goodmoney.ui.activitys.*
import com.mints.goodmoney.ui.adapter.GvMyAdapter import com.mints.goodmoney.ui.adapter.GvMyAdapter
import com.mints.goodmoney.ui.adapter.MainMyAdapter import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.adapter.ViewPagerAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.ShareDialog import com.mints.goodmoney.ui.widgets.ShareDialog
import com.mints.goodmoney.ui.widgets.dialog.DialogListener import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.* import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.QQJumpUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.net.netstatus.NetUtils import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.CommonUtils import com.mints.library.utils.CommonUtils
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
...@@ -57,6 +64,7 @@ import net.grandcentrix.tray.AppPreferences ...@@ -57,6 +64,7 @@ import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal import java.math.BigDecimal
import java.util.* import java.util.*
import kotlin.concurrent.schedule import kotlin.concurrent.schedule
import kotlin.math.ceil
private val TAG = MyFragment::class.java.simpleName private val TAG = MyFragment::class.java.simpleName
...@@ -73,14 +81,18 @@ class MyFragment : BaseFragment(), ...@@ -73,14 +81,18 @@ class MyFragment : BaseFragment(),
View.OnClickListener, View.OnClickListener,
AdapterView.OnItemClickListener { AdapterView.OnItemClickListener {
companion object {
const val HOT_PAGE_SIZE = 8
}
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: VideoAdingManager private lateinit var videoAdingManager: VideoAdingManager
private var loadVedioFailCount = 0 private var loadVideoFailCount = 0
private var userConfig: MyInfo? = null private var userConfig: MyInfo? = null
private var hotList: List<BannerBean.ListBean>? = arrayListOf() private val hotList: MutableList<BannerBean.ListBean> = mutableListOf()
// 当天签到金币 // 当天签到金币
private var carrierType = "" private var carrierType = ""
...@@ -102,6 +114,9 @@ class MyFragment : BaseFragment(), ...@@ -102,6 +114,9 @@ class MyFragment : BaseFragment(),
private var mCurrentPkg: String? = null private var mCurrentPkg: String? = null
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
// 热门活动下标
private var mCurrentIndex = 0
override fun getContentViewLayoutID() = R.layout.fragment_main_my override fun getContentViewLayoutID() = R.layout.fragment_main_my
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
...@@ -181,7 +196,7 @@ class MyFragment : BaseFragment(), ...@@ -181,7 +196,7 @@ class MyFragment : BaseFragment(),
BannerManager.onDestroy() BannerManager.onDestroy()
myPresenter.detachView() myPresenter.detachView()
onDestoryBroadcastReceiver() onDestroyBroadcastReceiver()
} }
override fun getUserTaskMsgSuc(data: MyInfo?) { override fun getUserTaskMsgSuc(data: MyInfo?) {
...@@ -205,18 +220,53 @@ class MyFragment : BaseFragment(), ...@@ -205,18 +220,53 @@ class MyFragment : BaseFragment(),
srl_my.finishRefresh(false) srl_my.finishRefresh(false)
userConfig = null userConfig = null
item_promotions_egv.visibility = View.GONE vp_grid.visibility = View.GONE
setUserLoginStatus() setUserLoginStatus()
} }
override fun getMyHotActivitySuc(data: BannerBean?) { override fun getMyHotActivitySuc(data: BannerBean?) {
if (activity != null && !requireActivity().isFinishing) { if (activity != null && !requireActivity().isFinishing) {
data?.let { data?.let {
item_promotions_egv.visibility = View.VISIBLE vp_grid.visibility = View.VISIBLE
hotList = it.list hotList.clear()
item_promotions_egv.adapter = GvMyAdapter(mContext, requireActivity(), hotList) hotList.addAll(it.list)
generateGridData(hotList)
}
}
} }
// 生成热门活动数据
private fun generateGridData(data: List<BannerBean.ListBean>) {
val inflater = LayoutInflater.from(mContext)
val pageCount = ceil(data.size * 1.0 / HOT_PAGE_SIZE).toInt()
val pagerList = arrayListOf<View>()
for (i in 0 until pageCount) {
val gridView = inflater.inflate(R.layout.item_fragment_main_my_promotions_gv,
vp_grid, false) as GridView
gridView.adapter = GvMyAdapter(requireActivity(), data, i, HOT_PAGE_SIZE)
pagerList.add(gridView)
gridView.onItemClickListener = this
} }
piv_grid.count = pageCount
vp_grid.adapter = ViewPagerAdapter(pagerList)
vp_grid.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
mCurrentIndex = position
piv_grid.selection = position
}
})
} }
override fun getSignInHomePageMsgSuc(signBean: SignCardBean?) { override fun getSignInHomePageMsgSuc(signBean: SignCardBean?) {
...@@ -287,13 +337,14 @@ class MyFragment : BaseFragment(), ...@@ -287,13 +337,14 @@ class MyFragment : BaseFragment(),
} }
override fun onRefresh(refreshLayout: RefreshLayout) { override fun onRefresh(refreshLayout: RefreshLayout) {
onDestoryBroadcastReceiver() onDestroyBroadcastReceiver()
if (userManager.userID.isNotEmpty()) { if (userManager.userID.isNotEmpty()) {
myPresenter.getAutoUserHallBaseMsg() myPresenter.getAutoUserHallBaseMsg()
} else { } else {
myPresenter.userLogin() myPresenter.userLogin()
} }
} }
/** /**
...@@ -378,7 +429,7 @@ class MyFragment : BaseFragment(), ...@@ -378,7 +429,7 @@ class MyFragment : BaseFragment(),
if (nowDate == day) { if (nowDate == day) {
if (finalSignStatus == 1) { if (finalSignStatus == 1) {
carrierType = Constant.CARRIER_SIGNIN_HOMEPAGE_CARD carrierType = Constant.CARRIER_SIGNIN_HOMEPAGE_CARD
awardVedio(curSignCoin * 2, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD) awardVideo(curSignCoin * 2, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)
} }
} }
} }
...@@ -625,7 +676,7 @@ class MyFragment : BaseFragment(), ...@@ -625,7 +676,7 @@ class MyFragment : BaseFragment(),
return return
} }
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO) awardVideo(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO)
} }
} }
...@@ -734,7 +785,7 @@ class MyFragment : BaseFragment(), ...@@ -734,7 +785,7 @@ class MyFragment : BaseFragment(),
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD) bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
readyGo(AwardActivity::class.java, bundle) readyGo(AwardActivity::class.java, bundle)
onDestoryBroadcastReceiver() onDestroyBroadcastReceiver()
} }
} }
} }
...@@ -757,7 +808,7 @@ class MyFragment : BaseFragment(), ...@@ -757,7 +808,7 @@ class MyFragment : BaseFragment(),
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key) bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key)
readyGo(AwardActivity::class.java, bundle) readyGo(AwardActivity::class.java, bundle)
onDestoryBroadcastReceiver() onDestroyBroadcastReceiver()
} }
} }
} }
...@@ -831,8 +882,8 @@ class MyFragment : BaseFragment(), ...@@ -831,8 +882,8 @@ class MyFragment : BaseFragment(),
// 热门活动 // 热门活动
override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) { override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) {
if (hotList!!.isNotEmpty()) { if (hotList.isNotEmpty()) {
val hotBean: BannerBean.ListBean = hotList!![position] val hotBean: BannerBean.ListBean = hotList[position + (mCurrentIndex * HOT_PAGE_SIZE)]
if (!TextUtils.isEmpty(hotBean.toUrl)) { if (!TextUtils.isEmpty(hotBean.toUrl)) {
// 自有界面 // 自有界面
...@@ -981,20 +1032,20 @@ class MyFragment : BaseFragment(), ...@@ -981,20 +1032,20 @@ class MyFragment : BaseFragment(),
/** /**
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVedio(coin: Int, carrierType: String) { private fun awardVideo(coin: Int, carrierType: String) {
if (vedioAdingManager.videoFinishFlag) { if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
loadVedioFailCount = 0 loadVideoFailCount = 0
showLoading("加载中...") showLoading("加载中...")
val bean = VideoAdingBean() val bean = VideoAdingBean()
bean.carrierType = carrierType bean.carrierType = carrierType
bean.curCoin = coin bean.curCoin = coin
loadVideo(vedioAdingManager, bean, true) loadVideo(videoAdingManager, bean, true)
} }
/** /**
...@@ -1008,8 +1059,8 @@ class MyFragment : BaseFragment(), ...@@ -1008,8 +1059,8 @@ class MyFragment : BaseFragment(),
} }
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVedioFailCount++ loadVideoFailCount++
if (loadVedioFailCount >= 2) { if (loadVideoFailCount >= 2) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
...@@ -1024,10 +1075,10 @@ class MyFragment : BaseFragment(), ...@@ -1024,10 +1075,10 @@ class MyFragment : BaseFragment(),
}) })
if (isFirstLoad) { if (isFirstLoad) {
// 首页按权重加载 // 首页按权重加载
vedioAdingManager.loadAding(activity, bean) videoAdingManager.loadAding(activity, bean)
} else { } else {
// 失败按优先级加载 // 失败按优先级加载
vedioAdingManager.loadFailAding(activity, bean) videoAdingManager.loadFailAding(activity, bean)
} }
} }
...@@ -1068,7 +1119,7 @@ class MyFragment : BaseFragment(), ...@@ -1068,7 +1119,7 @@ class MyFragment : BaseFragment(),
private fun initManager() { private fun initManager() {
BannerManager.init() BannerManager.init()
vedioAdingManager = VideoAdingManager.getInstance(activity) videoAdingManager = VideoAdingManager.getInstance(activity)
if (!TextUtils.isEmpty(userManager.userID)) { if (!TextUtils.isEmpty(userManager.userID)) {
// 登录成功的用户初始化鱼丸盒子 // 登录成功的用户初始化鱼丸盒子
...@@ -1102,7 +1153,7 @@ class MyFragment : BaseFragment(), ...@@ -1102,7 +1153,7 @@ class MyFragment : BaseFragment(),
ll_my_login.setOnClickListener(this) ll_my_login.setOnClickListener(this)
item_customer_service.setOnClickListener(this) item_customer_service.setOnClickListener(this)
item_promotions_egv.onItemClickListener = this // item_promotions_egv.onItemClickListener = this
} }
/** /**
...@@ -1120,13 +1171,14 @@ class MyFragment : BaseFragment(), ...@@ -1120,13 +1171,14 @@ class MyFragment : BaseFragment(),
* 设置视频权重 * 设置视频权重
*/ */
private fun initAdWeight(data: UserTaskMsgBean) { private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate, data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate, data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate, data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_VEDIO.rate
) )
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " + LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " + "ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
...@@ -1134,6 +1186,7 @@ class MyFragment : BaseFragment(), ...@@ -1134,6 +1186,7 @@ class MyFragment : BaseFragment(),
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " + "csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " + "shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " + "flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"rtaWeight:${data.vedioRules.rtA_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}" "ksWeight:${data.vedioRules.kS_VEDIO.rate}"
) )
// 广告视频数 // 广告视频数
...@@ -1143,12 +1196,14 @@ class MyFragment : BaseFragment(), ...@@ -1143,12 +1196,14 @@ class MyFragment : BaseFragment(),
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " + LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " + "ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " + "sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " + "csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " + "shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " + "flCount:${AppConfig.flVideoAdCount} " +
"rtaCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}" "ksCount:${AppConfig.ksVideoAdCount}"
) )
} }
...@@ -1251,8 +1306,8 @@ class MyFragment : BaseFragment(), ...@@ -1251,8 +1306,8 @@ class MyFragment : BaseFragment(),
R.id.dialog_btn_right -> { R.id.dialog_btn_right -> {
carrierType = Constant.CARRIER_HIGH_ACTIVITY carrierType = Constant.CARRIER_HIGH_ACTIVITY
vedioAdingManager.setIsHighWeight(true) videoAdingManager.setIsHighWeight(true)
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_HIGH_ACTIVITY) awardVideo(taskBean.otherConfig.coin, Constant.CARRIER_HIGH_ACTIVITY)
// 注册高额任务广播监听 // 注册高额任务广播监听
registerBroad() registerBroad()
...@@ -1336,7 +1391,7 @@ class MyFragment : BaseFragment(), ...@@ -1336,7 +1391,7 @@ class MyFragment : BaseFragment(),
/** /**
* 下载安装广播回收 * 下载安装广播回收
*/ */
fun onDestoryBroadcastReceiver() { private fun onDestroyBroadcastReceiver() {
if (mReceiverBroadcastReceiver != null) { if (mReceiverBroadcastReceiver != null) {
mContext.stopService(Intent(context, AppInstallService::class.java)) mContext.stopService(Intent(context, AppInstallService::class.java))
mContext.unregisterReceiver(mReceiverBroadcastReceiver) mContext.unregisterReceiver(mReceiverBroadcastReceiver)
......
...@@ -81,7 +81,7 @@ class TaskCpdFragment : BaseFragment(), TaskView, ...@@ -81,7 +81,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
@Volatile @Volatile
private var shLoadCountTime = 0 // 珊瑚 加载广告次数 private var shLoadCountTime = 0 // 珊瑚 加载广告次数
// @Volatile @Volatile
private var cpdLoadCountTime = 0 // CPD 加载广告次数 private var cpdLoadCountTime = 0 // CPD 加载广告次数
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
...@@ -205,23 +205,23 @@ class TaskCpdFragment : BaseFragment(), TaskView, ...@@ -205,23 +205,23 @@ class TaskCpdFragment : BaseFragment(), TaskView,
} }
} }
// private fun loadCPDDataCycle() {
// // 循环拉取圣于地CPD广告拉取
// for (i in cpdLoadCountTime until cpdMax) {
// loadCPDData()
// }
// }
// private fun loadCPDData() {
// LogUtil.d(TAG, "syd loadCPDData")
// taskPresenter.getCpdDetail(outNetIp)
// }
private fun loadCPDDataList() { private fun loadCPDDataList() {
// 圣于地CPD广告拉取 // 圣于地CPD广告拉取
for (i in cpdLoadCountTime until cpdMax) { taskPresenter.getCpdListDetail(outNetIp, cpdMax)
loadCPDData()
}
} }
private fun loadCPDData() {
LogUtil.d(TAG, "syd loadCPDData")
taskPresenter.getCpdDetail(outNetIp)
}
// private fun loadCPDDataList() {
// // 圣于地CPD广告拉取
// taskPresenter.getCpdListDetail(outNetIp, cpdMax)
// }
override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) { override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) {
for (material in dataBean.materials) { for (material in dataBean.materials) {
...@@ -244,10 +244,6 @@ class TaskCpdFragment : BaseFragment(), TaskView, ...@@ -244,10 +244,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// 圣于地广告 循环完成后去重 // 圣于地广告 循环完成后去重
if (cpdLoadCountTime++ >= cpdMax - 1) { if (cpdLoadCountTime++ >= cpdMax - 1) {
for (tzTaskBean in mFakeTaskList) {
LogUtil.d("AA -> " + tzTaskBean.title)
}
getCpdRepeatPkg() getCpdRepeatPkg()
if (shMax == 0 || shLoadCountTime >= shMax) { if (shMax == 0 || shLoadCountTime >= shMax) {
......
package com.mints.goodmoney.ui.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.viewpager.widget.ViewPager;
public class WrapViewPager extends ViewPager {
public WrapViewPager(Context context) {
super(context);
}
public WrapViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if (h > height)
height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
...@@ -50,7 +50,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -50,7 +50,7 @@ class DrawcashVideoDialog(activity: Activity) :
fun onDestory(){ fun onDestory(){
videoAdingManager?.setVideoAdingListener(null) videoAdingManager?.setVideoAdingListener(null)
videoAdingManager?.onDestory() videoAdingManager?.onDestroy()
activity = null activity = null
} }
......
...@@ -10,7 +10,6 @@ import com.mints.goodmoney.manager.TrackManager; ...@@ -10,7 +10,6 @@ import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter; import com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter;
import com.mints.goodmoney.ui.activitys.SplashADActivity; import com.mints.goodmoney.ui.activitys.SplashADActivity;
import com.mints.goodmoney.ui.activitys.SplashCsjADActivity; import com.mints.goodmoney.ui.activitys.SplashCsjADActivity;
import com.mints.goodmoney.ui.activitys.SplashKsADActivity;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
...@@ -20,6 +19,8 @@ import java.lang.ref.WeakReference; ...@@ -20,6 +19,8 @@ import java.lang.ref.WeakReference;
*/ */
public class ForegroundOrBackground implements Application.ActivityLifecycleCallbacks { public class ForegroundOrBackground implements Application.ActivityLifecycleCallbacks {
public static final String TAG = ForegroundOrBackground.class.getSimpleName();
private long leaveTime = 0;//应用切后台时间 private long leaveTime = 0;//应用切后台时间
private static ForegroundOrBackground instance; private static ForegroundOrBackground instance;
...@@ -31,7 +32,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall ...@@ -31,7 +32,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
private VersionUpdatePresenter vup; private VersionUpdatePresenter vup;
private WeakReference<Activity> reference; private WeakReference<Activity> reference;
private Intent ylhIntent; private Intent ylhIntent;
// private Intent ksIntent; // private Intent ksIntent;
private Intent csjIntent; private Intent csjIntent;
public static ForegroundOrBackground init(Application application) { public static ForegroundOrBackground init(Application application) {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/white"
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:overScrollMode="never"> android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/llMyRoot" android:id="@+id/llMyRoot"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -45,8 +40,9 @@ ...@@ -45,8 +40,9 @@
android:id="@+id/fl_my_banner" android:id="@+id/fl_my_banner"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="12dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="12dp"
android:background="@drawable/shape_bg_award"
android:visibility="gone" /> android:visibility="gone" />
<include layout="@layout/item_divider_gray" /> <include layout="@layout/item_divider_gray" />
...@@ -56,7 +52,6 @@ ...@@ -56,7 +52,6 @@
<include layout="@layout/item_divider_gray" /> <include layout="@layout/item_divider_gray" />
<include layout="@layout/view_title" /> <include layout="@layout/view_title" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_my" android:id="@+id/recy_my"
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
android:id="@+id/ll_my_sign" android:id="@+id/ll_my_sign"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp" android:layout_marginStart="10dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="10dp"
android:background="@mipmap/bg_sign"> android:background="@mipmap/bg_sign">
<ImageView <ImageView
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.mints.goodmoney.ui.widgets.ExpandableGridView xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_promotions_egv" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/tools">
<com.mints.goodmoney.ui.widgets.WrapViewPager
android:id="@+id/vp_grid"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.rd.PageIndicatorView
android:id="@+id/piv_grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp" android:layout_marginTop="5dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="5dp"
android:columnWidth="85dp" app:piv_count="2"
android:divider="@null" app:piv_dynamicCount="false"
android:dividerHeight="10dp" app:piv_selectedColor="@color/color_FF9837"
android:listSelector="@color/color_0000" app:piv_unselectedColor="@color/color_20000000"
android:numColumns="4" app:piv_viewPager="@id/vp_grid"
android:scrollbars="none" attrs:piv_padding="0dp"
android:stretchMode="spacingWidthUniform" /> attrs:piv_radius="2dp" />
\ No newline at end of file </merge>
<?xml version="1.0" encoding="utf-8"?>
<com.mints.goodmoney.ui.widgets.ExpandableGridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_promotions_egv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="16dp"
android:columnWidth="85dp"
android:divider="@null"
android:dividerHeight="10dp"
android:listSelector="@color/color_0000"
android:numColumns="4"
android:scrollbars="none"
android:stretchMode="spacingWidthUniform" />
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
android:layout_width="260dp" android:layout_width="260dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:textColor="@color/color_ccc" android:textColor="@color/color_AAA"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_task_title" /> app:layout_constraintTop_toBottomOf="@id/item_task_title" />
......
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