Commit 79677b7a authored by mengcuiguang's avatar mengcuiguang

gromore 降低快手sdk版本

parent 9e6d9c92
...@@ -369,5 +369,6 @@ dependencies { ...@@ -369,5 +369,6 @@ dependencies {
// 广点通广告 腾讯 // 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNormal.4.351.1221', ext: 'aar') implementation(name: 'GDTSDK.unionNormal.4.351.1221', ext: 'aar')
// 快手 // 快手
implementation(name: 'kssdk-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar') implementation(name: 'kssdk-ad-3.3.9', ext: 'aar')
// implementation(name: 'kssdk-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar')
} }
...@@ -10,14 +10,10 @@ import android.view.Gravity ...@@ -10,14 +10,10 @@ 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
...@@ -26,6 +22,7 @@ import com.mints.goodmoney.ad.video.VideoAdingManager ...@@ -26,6 +22,7 @@ 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
...@@ -43,6 +40,11 @@ import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils ...@@ -43,6 +40,11 @@ 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
...@@ -62,11 +64,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -62,11 +64,12 @@ 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
...@@ -78,10 +81,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -78,10 +81,6 @@ 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
...@@ -126,7 +125,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -126,7 +125,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
override fun onHiddenChanged(hidden: Boolean) { override fun onHiddenChanged(hidden: Boolean) {
ksFragment?.onHiddenChanged(hidden) littleVideoFragment?.onHiddenChanged(hidden)
if (hidden) { if (hidden) {
onPause() onPause()
...@@ -154,7 +153,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -154,7 +153,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
} }
ksFragment?.onResume() registerPlayerCallBack()
littleVideoFragment?.onResume()
} }
} }
...@@ -170,13 +170,16 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -170,13 +170,16 @@ 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()
ksFragment?.onPause() littleVideoFragment?.onPause()
if (isToCreateReward) { if (isToCreateReward) {
// 防止界面切换 重置红包动画 // 防止界面切换 重置红包动画
...@@ -189,7 +192,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -189,7 +192,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun setUserVisibleHint(isVisibleToUser: Boolean) { override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser) super.setUserVisibleHint(isVisibleToUser)
ksFragment?.userVisibleHint = isVisibleToUser littleVideoFragment?.userVisibleHint = isVisibleToUser
} }
override fun onDestroyView() { override fun onDestroyView() {
...@@ -205,6 +208,9 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -205,6 +208,9 @@ 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()
} }
...@@ -218,13 +224,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -218,13 +224,6 @@ 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
} }
...@@ -351,103 +350,70 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -351,103 +350,70 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
} }
/** /**
* 快手视频初始化 * 一览视频初始化
*/ */
private fun showLittle() { private fun showLittle() {
val adScene = KsScene.Builder(KsManager.KS_CONTENT_POSTID).build() val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
mKsContentPage = KsAdSDK.getLoadManager().loadContentPage(adScene) if (littleVideoFragment == null) {
littleVideoFragment = YLLittleVideoFragment.newInstance()
registerPlayerCallBack() transaction.add(R.id.yilan_fragment_frame_container, littleVideoFragment!!, YLLittleVideoFragment::class.java.simpleName)
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(ksFragment!!) transaction.show(littleVideoFragment!!)
} }
transaction.commitAllowingStateLoss() transaction.commitAllowingStateLoss()
} }
private fun registerPlayerCallBack() { private fun registerPlayerCallBack() {
mKsContentPage?.let { YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(pager: String, videoid: String, p2: String?) {
it.setPageListener(object : KsContentPage.PageListener { // 防止网络异常时, 第一次加载倒计时红包
override fun onPagePause(p0: KsContentPage.ContentItem?) { if (isFirstLoadVideo) {
LogUtil.d("onPagePause") isFirstLoadVideo = false
} initTimeview()
} else {
override fun onPageResume(p0: KsContentPage.ContentItem?) { resumeDownloadTime(videoid)
LogUtil.d("onPageResume")
}
override fun onPageEnter(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPageEnter")
}
override fun onPageLeave(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPageLeave")
}
})
// 视频播放回调
it.setVideoListener(object : KsContentPage.VideoListener {
override fun onVideoPlayCompleted(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayCompleted")
addVideoIdList(p0!!.id)
pauseDownloadTime()
} }
}
override fun onVideoPlayPaused(p0: KsContentPage.ContentItem?) { override fun onPause(pager: String, p1: String?, p2: String?) {
LogUtil.d("onVideoPlayPaused") pauseDownloadTime()
}
override fun onResume(pager: String, videoid: String, p2: String?) {
resumeDownloadTime(videoid)
}
pauseDownloadTime() override fun onComplete(pager: String, videoid: String, p2: String?) {
}
override fun onVideoPlayStart(p0: KsContentPage.ContentItem?) { }
LogUtil.d("onVideoPlayStart")
// 防止网络异常时, 第一次加载倒计时红包 override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
if (isFirstLoadVideo) { // LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete")
isFirstLoadVideo = false addVideoIdList(videoID)
initTimeview() pauseDownloadTime()
} else { }
resumeDownloadTime(p0!!.id)
}
}
override fun onVideoPlayError(p0: KsContentPage.ContentItem?, p1: Int, p2: Int) { override fun onStuckStart(pager: String, p1: String?, p2: String?) {
LogUtil.d("onVideoPlayError") }
pauseDownloadTime() override fun onStuckEnd(pager: String, p1: String?, p2: String?) {
} }
override fun onVideoPlayResume(p0: KsContentPage.ContentItem?) { override fun onError(pager: String, p1: String?, p2: String?) {
LogUtil.d("onVideoPlayResume")
// 防止网络异常时, 第一次加载倒计时红包 pauseDownloadTime()
if (isFirstLoadVideo) { }
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(p0!!.id)
}
}
})
} override fun onStop(pager: String, p1: String?, p2: String?) {
// LogUtil.d(TAG, "registerPlayerCallBack onStop")
// pauseDownloadTime()
}
})
} }
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(410)) params.setMargins(0, 0, 0, BubbleUtils.dp2px(270))
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)
...@@ -458,14 +424,57 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -458,14 +424,57 @@ 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中
......
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