Commit 44865996 authored by jyx's avatar jyx

开通vip后更新页面状态

parent bc053e74
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -35,6 +35,10 @@ object Constant {
const val FRAGMENT_CLICK_THREE = 2
const val VIP_REQUEST_CODE = 0x111
// 协议地址
var REGISTER_URL = "http://mints-web.mints-id.com/agreements/helivideo/yhxy.html"//注册协议
var PRIVACY_URL = "http://mints-web.mints-id.com/agreements/helivideo/syzc.html"//隐私协议
......
......@@ -292,6 +292,11 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
get().put(Constant.IS_FIRST_VEDIO, true)
if (data != null && data.vedioMsg != null) {
LocalVedioManager.startVedioDetailActivityForType(requireActivity(), data.vedioMsg)
}else{
if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
readyGo(VipActivity::class.java)
}
}
}
......
package com.xinfu.helivideo.video
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.KeyEvent
import android.view.View
import com.google.gson.Gson
import com.xinfu.helivideo.R
......@@ -20,7 +20,6 @@ import com.xinfu.helivideo.mvp.model.VedioBean
import com.xinfu.helivideo.mvp.model.VideoMultiItemEntity
import com.xinfu.helivideo.mvp.presenters.VideoPresenter
import com.xinfu.helivideo.mvp.views.VideoView
import com.xinfu.helivideo.ui.activitys.MainActivity
import com.xinfu.helivideo.ui.activitys.VipActivity
import com.xinfu.helivideo.ui.activitys.base.BaseActivity
import com.xinfu.helivideo.ui.adapter.VideoEpisodeAdapter
......@@ -32,7 +31,7 @@ import com.xinfu.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_tx_video.*
class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
var videos = ArrayList<VedioEpisodeBean>()
......@@ -90,9 +89,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun initView() {
episode_tv.text = String.format(
"共%d集 %s",
mVedioBean?.vedioTotal,
if (mVedioBean?.completeStatus == 0) "已完结" else "更新中"
"共%d集 %s",
mVedioBean?.vedioTotal,
if (mVedioBean?.completeStatus == 0) "已完结" else "更新中"
)
super_short_video_view.setOnCustomChildClickListener(this)
......@@ -118,9 +117,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
R.id.close_iv -> {
finish()
}
R.id.fm_bottom -> {
showEpisodeDialog()
}
else -> {}
}
}
......@@ -227,26 +228,28 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
}
R.id.leave -> {
// 返回
finish()
}
R.id.unlock -> {
// 看广告解锁
val carrierType = Constant.CARRIERTYPE_TX_VEDIO
AdManager.instance.showAd(this, carrierType,
object : AdStatusListener {
var canFail = false
override fun adSuccess() {
canFail = true
}
override fun adFail() {
if (canFail) return
NoPreAdManager.loadVideoAd(
this@TxVideoActivity,
carrierType, object : AdStatusListener {
object : AdStatusListener {
var canFail = false
override fun adSuccess() {
canFail = true
}
override fun adFail() {
if (canFail) return
NoPreAdManager.loadVideoAd(
this@TxVideoActivity,
carrierType, object : AdStatusListener {
override fun adFail() {
showToast("广告太火爆了,请稍候再试")
}
......@@ -261,24 +264,26 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
})
}
}
override fun adClose(vo: HashMap<String, Any>?) {
vo?.let {
vo["vedioId"] = mVedioBean!!.vedioId
videoPresenter.unlock(vo)
override fun adClose(vo: HashMap<String, Any>?) {
vo?.let {
vo["vedioId"] = mVedioBean!!.vedioId
videoPresenter.unlock(vo)
}
}
}
})
})
}
R.id.vip -> {
// 开通VIP
val bundle = Bundle()
bundle.putString(VipActivity.VEDIO_ID, mVedioBean!!.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID, mVedioBean!!.thirdId)
readyGo(VipActivity::class.java, bundle)
readyGoForResult(VipActivity::class.java, Constant.VIP_REQUEST_CODE, bundle)
}
else -> {}
}
}
......@@ -291,13 +296,25 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
VipCountDialog(this, mVedioBean!!, tipList)
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {}
})
.show()
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {}
})
.show()
}
private fun getPosition() = super_short_video_view.currentPosition
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constant.VIP_REQUEST_CODE) {
if (UserManager.getInstance().vipFlag) {
// 重置状态
isPlayNext = false
playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
}
}
}
}
\ No newline at end of file
......@@ -79,6 +79,7 @@ public class SuperShortVideoView extends RelativeLayout {
videoList.add(new VideoModel(list.get(i).getVideo().getVedioUrl()));
}
}
mUrlList.clear();
mUrlList.addAll(videoList);
mAdapter.setVedioBean(vedioBean);
mAdapter.setNewInstance(mList);
......
......@@ -260,6 +260,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
}
}
@Override
public void onResume() {
mIvCover.setVisibility(GONE);
}
public void setOnVideoEndListener(OnVideoEndListener onVideoEndListener) {
this.mOnVideoEndListener = onVideoEndListener;
}
......
......@@ -58,6 +58,9 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
+ mVodPlayer.hashCode() + " mUrl " + mUrl);
if (mStartOnPrepare) {
mVodPlayer.resume();
if (mOnPlayEventChangedListener != null) {
mOnPlayEventChangedListener.onResume();
}
mStartOnPrepare = false;
playerStatusChanged(TxVodStatus.TX_VIDEO_PLAYER_STATUS_PLAYING);
}
......@@ -182,6 +185,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
void onRcvFirstFrame();
void onEnded();
void onResume();
}
public TXVodPlayer getVodPlayer() {
......
......@@ -3,6 +3,7 @@ package com.xinfu.helivideo.video.tx.adapter
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
......@@ -16,7 +17,6 @@ import com.xinfu.helivideo.manager.UserManager
import com.xinfu.helivideo.mvp.model.VedioBean
import com.xinfu.helivideo.mvp.model.VideoMultiItemEntity
import com.xinfu.helivideo.video.tx.TXVideoBaseView
import kotlinx.android.synthetic.main.fragment_main_my.*
class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewHolder>() {
......@@ -37,17 +37,17 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private fun initLockHolder(holder: BaseViewHolder) {
Glide.with(context).load(vedioBean?.coverImage)
.into(holder.getView(R.id.iv_bg))
.into(holder.getView(R.id.iv_bg))
val vipBtn = holder.getView<View>(R.id.vip)
if (UserManager.getInstance().newFlag) {
// 匹配
vipBtn.visibility=View.VISIBLE
vipBtn.visibility = View.VISIBLE
vipBtn.setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
} else {
// 未匹配
vipBtn.visibility=View.GONE
vipBtn.visibility = View.GONE
}
holder.getView<TextView>(R.id.unlock).text = "看广告解锁" + vedioBean?.adGiveVedioNum + "集"
......@@ -65,9 +65,9 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
holder.setText(R.id.zan_num_tv, "" + vedioBean?.hot)
//缩略图
Glide.with(context).load(vedioBean?.coverImage)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(holder.getView<TXVideoBaseView>(R.id.baseItemView).findViewById(R.id.iv_cover))
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(holder.getView<TXVideoBaseView>(R.id.baseItemView).findViewById(R.id.iv_cover))
holder.getView<LinearLayout>(R.id.ll_collect).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
......@@ -87,15 +87,19 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
holder.getView<TXVideoBaseView>(R.id.baseItemView)
.setOnVideoEndListener(mOnVideoEndListener)
.setOnVideoEndListener(mOnVideoEndListener)
}
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
super.onViewDetachedFromWindow(holder)
if (holder.itemViewType == VideoMultiItemEntity.MULTI_ITEM_1) {
holder.getView<TXVideoBaseView>(R.id.baseItemView).pausePlayer()
holder.getView<TXVideoBaseView>(R.id.baseItemView).stopForPlaying()
vedioBean?.let {
if (it.seeIndex != holder.layoutPosition + 1) {
holder.getView<TXVideoBaseView>(R.id.baseItemView).pausePlayer()
holder.getView<TXVideoBaseView>(R.id.baseItemView).stopForPlaying()
}
}
}
}
......@@ -109,44 +113,44 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private fun setCollectImage(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
view.setImageDrawable(lottieDrawable)
}
private fun setCancelCollectImage(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
view.setImageDrawable(lottieDrawable)
}
private fun playCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
private fun playCancelCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
......
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