Commit 5623c54f authored by mengcuiguang's avatar mengcuiguang

解决冲突

parents 99b6b840 96064363
...@@ -259,9 +259,9 @@ dependencies { ...@@ -259,9 +259,9 @@ dependencies {
implementation(name: 'xrsdk-release_tbs', ext: 'aar') implementation(name: 'xrsdk-release_tbs', ext: 'aar')
implementation(name: 'xrsharesdk-release_tbs', ext: 'aar') implementation(name: 'xrsharesdk-release_tbs', ext: 'aar')
implementation(name: 'windAd-2.25.0', ext: 'aar') implementation(name: 'windAd-2.25.0', ext: 'aar')
implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3'
implementation 'com.scwang.smart:refresh-header-classics:2.0.3' implementation 'com.scwang.smart:refresh-header-classics:2.0.3'
implementation 'com.scwang.smart:refresh-footer-classics:2.0.3' implementation 'com.scwang.smart:refresh-footer-classics:2.0.3'
// 枫岚 // 枫岚
implementation(name: 'mh-adsdk', ext: 'aar') implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar') implementation(name: 'mh-adsdk-ext', ext: 'aar')
...@@ -321,7 +321,7 @@ dependencies { ...@@ -321,7 +321,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutinesVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutinesVersion"
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion" implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$rootProject.hiltViewModelVersion" implementation "androidx.hilt:hilt-lifecycle-viewmodel:$rootProject.hiltViewModelVersion"
implementation "com.scwang.smart:refresh-header-material:$rootProject.refresh_version" implementation "com.scwang.smart:refresh-header-material:$rootProject.refresh_version"
implementation 'com.github.pdog18:dimension-extensions:1.0' implementation 'com.github.pdog18:dimension-extensions:1.0'
implementation 'com.github.zhpanvip:BannerViewPager:3.2.0' implementation 'com.github.zhpanvip:BannerViewPager:3.2.0'
api "androidx.navigation:navigation-fragment-ktx:$navigationVersion" api "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
...@@ -341,8 +341,8 @@ dependencies { ...@@ -341,8 +341,8 @@ dependencies {
implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3' implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3'
api 'org.aspectj:aspectjrt:1.9.5' api 'org.aspectj:aspectjrt:1.9.5'
//小满 //小满
implementation ("com.bx:adsdk:1.4.2.2"){ implementation("com.bx:adsdk:1.4.2.2") {
exclude group:"com.miit.sdk" exclude group: "com.miit.sdk"
transitive = true transitive = true
changing = true changing = true
} }
......
package com.mints.goodmoney.ad.express package com.mints.goodmoney.ad.express
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.DialogInterface
import android.text.TextUtils import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
...@@ -95,7 +96,7 @@ object KsPreLoadExpressManager { ...@@ -95,7 +96,7 @@ object KsPreLoadExpressManager {
} }
override fun onVideoPlayError(what: Int, extra: Int) { override fun onVideoPlayError(what: Int, extra: Int) {
LogUtil.d("KsPreLoadExpressManager","id=${what} extra=${extra}") LogUtil.d("KsPreLoadExpressManager", "id=${what} extra=${extra}")
} }
}) })
...@@ -191,6 +192,10 @@ object KsPreLoadExpressManager { ...@@ -191,6 +192,10 @@ object KsPreLoadExpressManager {
// Toast.makeText(mContext, "广告" + ad.appName + "展示", Toast.LENGTH_SHORT).show() // Toast.makeText(mContext, "广告" + ad.appName + "展示", Toast.LENGTH_SHORT).show()
} }
} }
override fun handleDownloadDialog(p0: DialogInterface.OnClickListener?): Boolean {
return false
}
}) })
// 广告描述 // 广告描述
......
...@@ -120,6 +120,8 @@ class KsVideoAdManager private constructor(activity: Activity) : ...@@ -120,6 +120,8 @@ class KsVideoAdManager private constructor(activity: Activity) :
} }
} }
override fun onRequestResult(p0: Int) {}
}) })
......
...@@ -6,8 +6,6 @@ import android.content.Context; ...@@ -6,8 +6,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.text.TextUtils; import android.text.TextUtils;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.ad.video.base.VideoAdStatusListener; 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;
...@@ -17,8 +15,6 @@ import com.mints.goodmoney.mvp.model.WeightBean; ...@@ -17,8 +15,6 @@ import com.mints.goodmoney.mvp.model.WeightBean;
import com.mints.goodmoney.service.AppInstallService; import com.mints.goodmoney.service.AppInstallService;
import com.mints.goodmoney.utils.AppUtil; import com.mints.goodmoney.utils.AppUtil;
import com.mints.goodmoney.utils.LogUtil; import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
...@@ -64,8 +60,6 @@ public class VideoAdingManager { ...@@ -64,8 +60,6 @@ public class VideoAdingManager {
// 是否是高额视频任务 // 是否是高额视频任务
private boolean isHighWeight = false; private boolean isHighWeight = false;
private boolean isTTVideoAd = false;
private int highIndex = 0;//0-穿山甲 1-优量汇 2-快手
private Activity activity; private Activity activity;
private boolean isVideoAdDownload = false;// 是否点击广告下载 true-点击 private boolean isVideoAdDownload = false;// 是否点击广告下载 true-点击
...@@ -235,31 +229,52 @@ public class VideoAdingManager { ...@@ -235,31 +229,52 @@ public class VideoAdingManager {
/** /**
* 高额任务广告类型 * 高额任务广告类型
* *
* @return _ * @return
*/ */
private String getHighWeight() { public String getHighWeight() {
// isTTVideoAd = !isTTVideoAd;
// if (isTTVideoAd) { int weight = 0;
// return Constant.CSJ_VEDIO_AD;
// } else { if (weightList != null) {
// return Constant.YLH_VEDIO_AD; weightList.clear();
// }
String adType = "";
switch (highIndex) {
case 0:
highIndex = 1;
adType = Constant.CSJ_VEDIO_AD;
break;
case 1:
highIndex = 2;
adType = Constant.YLH_VEDIO_AD;
break;
case 2:
highIndex = 0;
adType = Constant.KS_VEDIO_AD;
break;
} }
return adType;
// 穿山甲
if (AppConfig.csjHighVideoAdCount > 0) {
weightList.add(new WeightBean(AppConfig.csjHighVideoAdCount, Constant.CSJ_VEDIO_AD));
weight = weight + AppConfig.csjHighVideoAdCount;
LogUtil.d(TAG, "高额任务 -> 权重值:csjVideoWeight:" + AppConfig.csjHighVideoAdCount);
}
// 优量汇
if (AppConfig.ylhHighVideoAdCount > 0) {
weightList.add(new WeightBean(AppConfig.ylhHighVideoAdCount, Constant.YLH_VEDIO_AD));
weight = weight + AppConfig.ylhHighVideoAdCount;
LogUtil.d(TAG, "高额任务 -> 权重值:ylhVideoWeight:" + AppConfig.ylhHighVideoAdCount);
}
// 快手
if (AppConfig.ksHighVideoAdCount > 0) {
weightList.add(new WeightBean(AppConfig.ksHighVideoAdCount, Constant.KS_VEDIO_AD));
weight = weight + AppConfig.ksHighVideoAdCount;
LogUtil.d(TAG, "高额任务 -> 权重值:ksVideoWeight:" + AppConfig.ksHighVideoAdCount);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "高额任务 -> 1、权重总值:" + weight);
Random r = new Random();
int randomWeight = r.nextInt(weight) + 1;
LogUtil.d(TAG, "高额任务 -> 2、权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
if (randomWeight <= 0) {
LogUtil.d(TAG, "高额任务 -> 3、权重结果:" + weightBean.getType());
return weightBean.getType();
}
}
}
return Constant.CSJ_VEDIO_AD;
} }
/** /**
......
...@@ -100,6 +100,20 @@ public class AppConfig { ...@@ -100,6 +100,20 @@ public class AppConfig {
* rtaVideo 剩余广告播放数 * rtaVideo 剩余广告播放数
*/ */
public static int rtaVideoAdCount = 0; public static int rtaVideoAdCount = 0;
/**
* 高额任务和超级翻倍 csjVideo 剩余广告播放数
*/
public static int csjHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 ylhVideo 剩余广告播放数
*/
public static int ylhHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 ksVideo 剩余广告播放数
*/
public static int ksHighVideoAdCount = 0;
/** /**
* 高额试玩任务标识 * 高额试玩任务标识
......
...@@ -23,6 +23,9 @@ object KsManager { ...@@ -23,6 +23,9 @@ object KsManager {
/* vedio-postid */ /* vedio-postid */
const val KS_AD_VEDIO_POSTID = 5746000022 const val KS_AD_VEDIO_POSTID = 5746000022
/* 内容联盟id */
const val KS_CONTENT_POSTID = 5746000049
/** /**
* 初始化 * 初始化
*/ */
......
...@@ -13,6 +13,7 @@ public class UserTaskMsgBean implements Serializable { ...@@ -13,6 +13,7 @@ public class UserTaskMsgBean implements Serializable {
private UserRiskAppsBean userRiskApps; private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode_v1 = null; private AdcodeBean adcode_v1 = null;
private FlowAdRulesBean flowAdRules; private FlowAdRulesBean flowAdRules;
private HighRatePlanBean highRatePlan;
private String ip; private String ip;
private String channel; private String channel;
...@@ -135,4 +136,30 @@ public class UserTaskMsgBean implements Serializable { ...@@ -135,4 +136,30 @@ public class UserTaskMsgBean implements Serializable {
public FlowAdRulesBean getFlowAdRules() { public FlowAdRulesBean getFlowAdRules() {
return flowAdRules; return flowAdRules;
} }
public HighRatePlanBean getHighRatePlan() {
return highRatePlan;
}
public void setHighRatePlan(HighRatePlanBean highRatePlan) {
this.highRatePlan = highRatePlan;
}
public static class HighRatePlanBean implements Serializable {
private int YLH;
private int KS;
private int CSJ;
public int getYLH() {
return YLH;
}
public int getKS() {
return KS;
}
public int getCSJ() {
return CSJ;
}
}
} }
...@@ -425,6 +425,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -425,6 +425,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
// 是否开启应用使用情况权限 // 是否开启应用使用情况权限
if (AppUtil.isOpenUsageStats()) { if (AppUtil.isOpenUsageStats()) {
registerBroad() registerBroad()
videoAdingManager.setIsHighWeight(true)
awardVideo() awardVideo()
} else { } else {
AppTryPlayManager.openAppUsageStats(this) AppTryPlayManager.openAppUsageStats(this)
......
...@@ -29,6 +29,7 @@ class SplashKsADActivity : BaseActivity() { ...@@ -29,6 +29,7 @@ class SplashKsADActivity : BaseActivity() {
* 记录拉取广告的时间 * 记录拉取广告的时间
*/ */
private val handler = Handler(Looper.getMainLooper()) private val handler = Handler(Looper.getMainLooper())
override fun getContentViewLayoutID(): Int { override fun getContentViewLayoutID(): Int {
return R.layout.activity_splash_ylh return R.layout.activity_splash_ylh
} }
...@@ -100,6 +101,8 @@ class SplashKsADActivity : BaseActivity() { ...@@ -100,6 +101,8 @@ class SplashKsADActivity : BaseActivity() {
next() next()
} }
override fun onRequestResult(p0: Int) {}
override fun onSplashScreenAdLoad(p0: KsSplashScreenAd?) { override fun onSplashScreenAdLoad(p0: KsSplashScreenAd?) {
LogUtil.d(TAG, "onSplashScreenAdLoad") LogUtil.d(TAG, "onSplashScreenAdLoad")
......
...@@ -10,10 +10,14 @@ import android.view.Gravity ...@@ -10,10 +10,14 @@ import android.view.Gravity
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.daimajia.androidanimations.library.YoYo.YoYoString import com.daimajia.androidanimations.library.YoYo.YoYoString
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.KsContentPage
import com.kwad.sdk.api.KsScene
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager import com.mints.goodmoney.ad.express.PreLoadExpressManager
...@@ -22,7 +26,6 @@ import com.mints.goodmoney.ad.video.VideoAdingManager ...@@ -22,7 +26,6 @@ import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.* import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.FlowAdRulesBean import com.mints.goodmoney.mvp.model.FlowAdRulesBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean import com.mints.goodmoney.mvp.model.UserTaskMsgBean
...@@ -40,11 +43,6 @@ import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils ...@@ -40,11 +43,6 @@ import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.TimeRender import com.mints.goodmoney.utils.TimeRender
import com.mints.library.utils.CommonUtils import com.mints.library.utils.CommonUtils
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.configs.YLUIConfig
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import com.yilan.sdk.ylad.YLAdListener
import kotlinx.android.synthetic.main.layout_red_bag.* import kotlinx.android.synthetic.main.layout_red_bag.*
import kotlinx.android.synthetic.main.layout_red_box.* import kotlinx.android.synthetic.main.layout_red_box.*
import net.grandcentrix.tray.AppPreferences import net.grandcentrix.tray.AppPreferences
...@@ -64,12 +62,11 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -64,12 +62,11 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var bindWxDialog: BindWxDialog? = null private var bindWxDialog: BindWxDialog? = null
private var userMsgBean: UserTaskMsgBean? = null private var userMsgBean: UserTaskMsgBean? = null
private lateinit var baseResponse: BaseResponse<UserTaskMsgBean> // private lateinit var baseResponse: BaseResponse<UserTaskMsgBean>
// 视频相关 // 视频相关
private var rewardDoubleCoin = 0 // 大金币 private var rewardDoubleCoin = 0 // 大金币
private var rewardCoin = 0 // 小金币 private var rewardCoin = 0 // 小金币
private var littleVideoFragment: YLLittleVideoFragment? = null
private val videoMaxCount = 12 // 当前缓存视频id最大数 private val videoMaxCount = 12 // 当前缓存视频id最大数
private val videoIdList by lazy { ArrayList<String>() }//记录播放的视频id private val videoIdList by lazy { ArrayList<String>() }//记录播放的视频id
...@@ -81,6 +78,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -81,6 +78,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 广告权重相关 // 广告权重相关
private var videoAdingManager: VideoAdingManager? = null private var videoAdingManager: VideoAdingManager? = null
// 快手视频相关
private var ksFragment: Fragment? = null
private var mKsContentPage: KsContentPage? = null
// 福袋相关 // 福袋相关
private var rope: YoYoString? = null private var rope: YoYoString? = null
private var mRedBoxTimer: CountDownTimerSupport? = null private var mRedBoxTimer: CountDownTimerSupport? = null
...@@ -125,7 +126,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -125,7 +126,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
override fun onHiddenChanged(hidden: Boolean) { override fun onHiddenChanged(hidden: Boolean) {
littleVideoFragment?.onHiddenChanged(hidden) ksFragment?.onHiddenChanged(hidden)
if (hidden) { if (hidden) {
onPause() onPause()
...@@ -153,8 +154,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -153,8 +154,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
} }
registerPlayerCallBack() ksFragment?.onResume()
littleVideoFragment?.onResume()
} }
} }
...@@ -170,16 +170,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -170,16 +170,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
// 福袋动画停止 // 福袋动画停止
stopRedbox() stopRedbox()
// 倒计时红包暂停 // 倒计时红包暂停
pauseDownloadTime() pauseDownloadTime()
destroyTimerRedbox() destroyTimerRedbox()
littleVideoFragment?.onPause() ksFragment?.onPause()
if (isToCreateReward) { if (isToCreateReward) {
// 防止界面切换 重置红包动画 // 防止界面切换 重置红包动画
...@@ -192,7 +189,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -192,7 +189,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun setUserVisibleHint(isVisibleToUser: Boolean) { override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser) super.setUserVisibleHint(isVisibleToUser)
littleVideoFragment?.userVisibleHint = isVisibleToUser ksFragment?.userVisibleHint = isVisibleToUser
} }
override fun onDestroyView() { override fun onDestroyView() {
...@@ -208,9 +205,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -208,9 +205,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
// 广告回调解绑
YLUIConfig.getInstance().unRegisterAdListener()
YLPlayerConfig.config().unRegisterPlayerCallback()
homePresenter.detachView() homePresenter.detachView()
} }
...@@ -224,6 +218,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -224,6 +218,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
userMsgBean = data userMsgBean = data
// 高额任务及超级翻倍次数
if (data.highRatePlan != null) {
AppConfig.csjHighVideoAdCount = data.highRatePlan.csj
AppConfig.ylhHighVideoAdCount = data.highRatePlan.ylh
AppConfig.ksHighVideoAdCount = data.highRatePlan.ks
}
if (userMsgBean?.shareNews != null) { if (userMsgBean?.shareNews != null) {
AppConfig.wzReadCoin = userMsgBean!!.shareNews.readCoin AppConfig.wzReadCoin = userMsgBean!!.shareNews.readCoin
} }
...@@ -350,70 +351,103 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -350,70 +351,103 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
/** /**
* 一览视频初始化 * 快手视频初始化
*/ */
private fun showLittle() { private fun showLittle() {
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction() val adScene = KsScene.Builder(KsManager.KS_CONTENT_POSTID).build()
if (littleVideoFragment == null) { mKsContentPage = KsAdSDK.getLoadManager().loadContentPage(adScene)
littleVideoFragment = YLLittleVideoFragment.newInstance()
transaction.add(R.id.yilan_fragment_frame_container, littleVideoFragment!!, YLLittleVideoFragment::class.java.simpleName) registerPlayerCallBack()
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
if (ksFragment == null) {
ksFragment = mKsContentPage?.fragment
transaction.add(R.id.yilan_fragment_frame_container, ksFragment!!, "ks_fragment")
} else { } else {
transaction.show(littleVideoFragment!!) transaction.show(ksFragment!!)
} }
transaction.commitAllowingStateLoss() transaction.commitAllowingStateLoss()
} }
private fun registerPlayerCallBack() { private fun registerPlayerCallBack() {
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack { mKsContentPage?.let {
override fun onStart(pager: String, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包 it.setPageListener(object : KsContentPage.PageListener {
if (isFirstLoadVideo) { override fun onPagePause(p0: KsContentPage.ContentItem?) {
isFirstLoadVideo = false LogUtil.d("onPagePause")
initTimeview()
} else {
resumeDownloadTime(videoid)
} }
}
override fun onPause(pager: String, p1: String?, p2: String?) { override fun onPageResume(p0: KsContentPage.ContentItem?) {
pauseDownloadTime() LogUtil.d("onPageResume")
} }
override fun onResume(pager: String, videoid: String, p2: String?) { override fun onPageEnter(p0: KsContentPage.ContentItem?) {
resumeDownloadTime(videoid) LogUtil.d("onPageEnter")
}
override fun onComplete(pager: String, videoid: String, p2: String?) {
} }
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) { override fun onPageLeave(p0: KsContentPage.ContentItem?) {
// LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete") LogUtil.d("onPageLeave")
addVideoIdList(videoID) }
pauseDownloadTime() })
}
override fun onStuckStart(pager: String, p1: String?, p2: String?) {
}
override fun onStuckEnd(pager: String, p1: String?, p2: String?) { // 视频播放回调
} it.setVideoListener(object : KsContentPage.VideoListener {
override fun onVideoPlayCompleted(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayCompleted")
override fun onError(pager: String, p1: String?, p2: String?) {
pauseDownloadTime() addVideoIdList(p0!!.id)
} pauseDownloadTime()
}
override fun onStop(pager: String, p1: String?, p2: String?) { override fun onVideoPlayPaused(p0: KsContentPage.ContentItem?) {
// LogUtil.d(TAG, "registerPlayerCallBack onStop") LogUtil.d("onVideoPlayPaused")
// pauseDownloadTime()
}
}) pauseDownloadTime()
}
override fun onVideoPlayStart(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayStart")
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(p0!!.id)
}
}
override fun onVideoPlayError(p0: KsContentPage.ContentItem?, p1: Int, p2: Int) {
LogUtil.d("onVideoPlayError")
pauseDownloadTime()
}
override fun onVideoPlayResume(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayResume")
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(p0!!.id)
}
}
})
}
} }
private fun initListener() { private fun initListener() {
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT) val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
params.setMargins(0, 0, 0, BubbleUtils.dp2px(270)) params.setMargins(0, 0, 0, BubbleUtils.dp2px(410))
cdvvYilanTime.layoutParams = params cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT) val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
...@@ -424,57 +458,14 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -424,57 +458,14 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
rl_fragment_main_redbox.setOnClickListener(this) rl_fragment_main_redbox.setOnClickListener(this)
rl_fragment_main_redbox.isClickable = false rl_fragment_main_redbox.isClickable = false
// 广告回调
YLUIConfig.getInstance().registerAdListener(object : YLAdListener() {
override fun onSuccess(p0: String?, p1: Int, p2: String?, p3: String?) {
}
override fun onError(p0: String?, p1: Int, p2: String?, p3: Int, p4: String?, p5: String?) {
}
override fun onRenderError(p0: String?, p1: Int, p2: String?, p3: Int, p4: String?, p5: String?) {
}
override fun onShow(p0: String?, p1: Int, p2: String?, p3: String) {
resumeAdTime()
}
override fun onClick(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onSkip(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onTimeOver(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onClose(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onAdEmpty(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onVideoStart(p0: String?, p1: Int, p2: String?, p3: String) {
}
override fun onVideoPause(p0: String?, p1: Int, p2: String?, p3: String?) {
pauseDownloadTime()
}
override fun onVideoResume(p0: String?, p1: Int, p2: String?, p3: String?) {
resumeAdTime()
}
override fun onVideoComplete(p0: String?, p1: Int, p2: String?, p3: String?) {
pauseDownloadTime()
}
override fun onVideoError(p0: String?, p1: Int, p2: String?, p3: String?) {}
})
} }
private fun resumeAdTime() { // private fun resumeAdTime() {
// 视频未转满 且 界面切换时可继续加进度 // // 视频未转满 且 界面切换时可继续加进度
if (!isAward) { // if (!isAward) {
cdvvYilanTime?.resume() // cdvvYilanTime?.resume()
} // }
} // }
/** /**
* 将播放的id记录到list中 * 将播放的id记录到list中
......
...@@ -324,6 +324,13 @@ class MyFragment : BaseFragment(), ...@@ -324,6 +324,13 @@ class MyFragment : BaseFragment(),
return return
} }
// 高额任务及超级翻倍次数
if (data.highRatePlan != null) {
AppConfig.csjHighVideoAdCount = data.highRatePlan.csj
AppConfig.ylhHighVideoAdCount = data.highRatePlan.ylh
AppConfig.ksHighVideoAdCount = data.highRatePlan.ks
}
if (data.shareNews != null) { if (data.shareNews != null) {
AppConfig.wzReadCoin = data.shareNews.readCoin AppConfig.wzReadCoin = data.shareNews.readCoin
} }
......
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