Commit 3a81cfca authored by mengcuiguang's avatar mengcuiguang

代码优化

parent a55a3306
...@@ -2,6 +2,8 @@ package com.xinfu.helivideo.video.csj ...@@ -2,6 +2,8 @@ package com.xinfu.helivideo.video.csj
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.widget.Button import android.widget.Button
...@@ -22,6 +24,7 @@ import com.xinfu.helivideo.ad.express.ExpressAdCallback ...@@ -22,6 +24,7 @@ import com.xinfu.helivideo.ad.express.ExpressAdCallback
import com.xinfu.helivideo.ad.express.ExpressManager import com.xinfu.helivideo.ad.express.ExpressManager
import com.xinfu.helivideo.common.Constant import com.xinfu.helivideo.common.Constant
import com.xinfu.helivideo.manager.LocalVedioManager import com.xinfu.helivideo.manager.LocalVedioManager
import com.xinfu.helivideo.manager.TrackManager
import com.xinfu.helivideo.manager.UserManager import com.xinfu.helivideo.manager.UserManager
import com.xinfu.helivideo.mvp.model.IndexList import com.xinfu.helivideo.mvp.model.IndexList
import com.xinfu.helivideo.mvp.model.NineShowBean import com.xinfu.helivideo.mvp.model.NineShowBean
...@@ -37,6 +40,7 @@ import com.xinfu.helivideo.ui.widgets.VideoEpisodeDialog ...@@ -37,6 +40,7 @@ import com.xinfu.helivideo.ui.widgets.VideoEpisodeDialog
import com.xinfu.helivideo.ui.widgets.VipCountDialog import com.xinfu.helivideo.ui.widgets.VipCountDialog
import com.xinfu.helivideo.utils.AppPreferencesManager import com.xinfu.helivideo.utils.AppPreferencesManager
import com.xinfu.helivideo.utils.SpanUtils import com.xinfu.helivideo.utils.SpanUtils
import com.xinfu.helivideo.utils.ToastUtil
import com.xinfu.helivideo.utils.UIUtils import com.xinfu.helivideo.utils.UIUtils
import com.xinfu.library.utils.GlideUtils import com.xinfu.library.utils.GlideUtils
import com.xinfu.library.utils.nodoubleclick.AntiShake import com.xinfu.library.utils.nodoubleclick.AntiShake
...@@ -108,6 +112,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -108,6 +112,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private var mCurrentIndex = 0 private var mCurrentIndex = 0
private var lastVipStatus = false
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
val json = extras?.getString(Constant.VEDIO_BEAN) val json = extras?.getString(Constant.VEDIO_BEAN)
isThirdId = extras?.getBoolean(Constant.VEDIO_THIRD, false) == true isThirdId = extras?.getBoolean(Constant.VEDIO_THIRD, false) == true
...@@ -196,6 +202,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -196,6 +202,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
if (DPSdk.isStartSuccess()) { if (DPSdk.isStartSuccess()) {
init() init()
} }
if (mVipFlag) {
lastVipStatus = true
}
} }
override fun isApplyKitKatTranslucency() = true override fun isApplyKitKatTranslucency() = true
...@@ -261,6 +271,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -261,6 +271,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) { if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态 // 重置状态
lastVipStatus = true
resetData() resetData()
} }
} }
...@@ -404,6 +415,15 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -404,6 +415,15 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
} }
TrackManager.getInstance().getMyInfo()
// 如果从vip变成非vip提示用户退出续费
if (lastVipStatus && !UserManager.getInstance().vipFlag) {
ToastUtil.showLong(context, "您的体验会员已过期")
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 500)
}
return needBlock return needBlock
} }
......
...@@ -2,6 +2,8 @@ package com.xinfu.helivideo.video.tx ...@@ -2,6 +2,8 @@ package com.xinfu.helivideo.video.tx
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View import android.view.View
import com.google.gson.Gson import com.google.gson.Gson
import com.xinfu.helivideo.R import com.xinfu.helivideo.R
...@@ -12,6 +14,7 @@ import com.xinfu.helivideo.ad.draw.DrawExpressManager ...@@ -12,6 +14,7 @@ import com.xinfu.helivideo.ad.draw.DrawExpressManager
import com.xinfu.helivideo.ad.express.ExpressManager import com.xinfu.helivideo.ad.express.ExpressManager
import com.xinfu.helivideo.common.Constant import com.xinfu.helivideo.common.Constant
import com.xinfu.helivideo.manager.LocalVedioManager import com.xinfu.helivideo.manager.LocalVedioManager
import com.xinfu.helivideo.manager.TrackManager
import com.xinfu.helivideo.manager.UserManager import com.xinfu.helivideo.manager.UserManager
import com.xinfu.helivideo.mvp.model.* import com.xinfu.helivideo.mvp.model.*
import com.xinfu.helivideo.mvp.model.IndexList.VedioEpisodeBean import com.xinfu.helivideo.mvp.model.IndexList.VedioEpisodeBean
...@@ -26,6 +29,7 @@ import com.xinfu.helivideo.ui.widgets.VideoEpisodeDialog ...@@ -26,6 +29,7 @@ import com.xinfu.helivideo.ui.widgets.VideoEpisodeDialog
import com.xinfu.helivideo.ui.widgets.VipCountDialog import com.xinfu.helivideo.ui.widgets.VipCountDialog
import com.xinfu.helivideo.utils.AppPreferencesManager import com.xinfu.helivideo.utils.AppPreferencesManager
import com.xinfu.helivideo.utils.SpanUtils import com.xinfu.helivideo.utils.SpanUtils
import com.xinfu.helivideo.utils.ToastUtil
import com.xinfu.helivideo.video.tx.adapter.TxVideoAdapter import com.xinfu.helivideo.video.tx.adapter.TxVideoAdapter
import com.xinfu.library.utils.GlideUtils import com.xinfu.library.utils.GlideUtils
import com.xinfu.library.utils.nodoubleclick.AntiShake import com.xinfu.library.utils.nodoubleclick.AntiShake
...@@ -50,6 +54,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -50,6 +54,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private var isPlayNext = false private var isPlayNext = false
private var playIndex = 1 private var playIndex = 1
private var lastVipStatus = false
override fun getContentViewLayoutID() = R.layout.activity_tx_video override fun getContentViewLayoutID() = R.layout.activity_tx_video
...@@ -57,6 +62,10 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -57,6 +62,10 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
videoPresenter.attachView(this) videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) } mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
initView() initView()
if (mVipFlag) {
lastVipStatus = true
}
} }
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
...@@ -81,6 +90,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -81,6 +90,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) { if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态 // 重置状态
lastVipStatus = true
isPlayNext = false isPlayNext = false
playIndex = super_short_video_view.currentPosition playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) } mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
...@@ -136,6 +146,15 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -136,6 +146,15 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
mVedioBean!!.orderTags = orderTagsList mVedioBean!!.orderTags = orderTagsList
LocalVedioManager.commitVedio(mVedioBean!!) LocalVedioManager.commitVedio(mVedioBean!!)
} }
TrackManager.getInstance().getMyInfo()
// 如果从vip变成非vip提示用户退出续费
if (lastVipStatus && !UserManager.getInstance().vipFlag) {
ToastUtil.showLong(context, "您的体验会员已过期")
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 500)
}
} }
fm_bottom.setOnClickListener(this) fm_bottom.setOnClickListener(this)
...@@ -390,7 +409,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -390,7 +409,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
if (isLuckyShow || localLucky) { if (isLuckyShow || localLucky) {
ll_lucky.visibility = View.VISIBLE ll_lucky.visibility = View.VISIBLE
context?.let { GlideUtils.loadRoundImageViewGif(it,R.drawable.ic_nine,iv_lucky_gif) } context?.let { GlideUtils.loadRoundImageViewGif(it, R.drawable.ic_nine, iv_lucky_gif) }
} else { } else {
ll_lucky.visibility = View.GONE ll_lucky.visibility = View.GONE
......
package com.xinfu.helivideo.video.tx.newrecommend package com.xinfu.helivideo.video.tx.newrecommend
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View import android.view.View
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.google.gson.Gson import com.google.gson.Gson
...@@ -11,6 +13,7 @@ import com.xinfu.helivideo.ad.NoPreAdManager ...@@ -11,6 +13,7 @@ import com.xinfu.helivideo.ad.NoPreAdManager
import com.xinfu.helivideo.ad.express.ExpressManager import com.xinfu.helivideo.ad.express.ExpressManager
import com.xinfu.helivideo.common.Constant import com.xinfu.helivideo.common.Constant
import com.xinfu.helivideo.manager.LocalVedioManager import com.xinfu.helivideo.manager.LocalVedioManager
import com.xinfu.helivideo.manager.TrackManager
import com.xinfu.helivideo.manager.UserManager import com.xinfu.helivideo.manager.UserManager
import com.xinfu.helivideo.mvp.model.* import com.xinfu.helivideo.mvp.model.*
import com.xinfu.helivideo.mvp.model.IndexList.VedioEpisodeBean import com.xinfu.helivideo.mvp.model.IndexList.VedioEpisodeBean
...@@ -23,6 +26,7 @@ import com.xinfu.helivideo.ui.adapter.VideoEpisodeAdapter ...@@ -23,6 +26,7 @@ import com.xinfu.helivideo.ui.adapter.VideoEpisodeAdapter
import com.xinfu.helivideo.ui.widgets.NewVideoEpisodeDialog import com.xinfu.helivideo.ui.widgets.NewVideoEpisodeDialog
import com.xinfu.helivideo.utils.AppPreferencesManager import com.xinfu.helivideo.utils.AppPreferencesManager
import com.xinfu.helivideo.utils.SpanUtils import com.xinfu.helivideo.utils.SpanUtils
import com.xinfu.helivideo.utils.ToastUtil
import com.xinfu.helivideo.video.tx.VideoModel import com.xinfu.helivideo.video.tx.VideoModel
import com.xinfu.library.utils.GlideUtils import com.xinfu.library.utils.GlideUtils
import com.xinfu.library.utils.nodoubleclick.AntiShake import com.xinfu.library.utils.nodoubleclick.AntiShake
...@@ -47,6 +51,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -47,6 +51,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private var orderTagsList: ArrayList<String>? = null private var orderTagsList: ArrayList<String>? = null
private var playIndex = 1 private var playIndex = 1
private var lastVipStatus = false
override fun getContentViewLayoutID() = R.layout.activity_new_tx_video override fun getContentViewLayoutID() = R.layout.activity_new_tx_video
...@@ -54,6 +59,9 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -54,6 +59,9 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
videoPresenter.attachView(this) videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList2("" + it.vedioId) } mVedioBean?.let { videoPresenter.getIndexList2("" + it.vedioId) }
initView() initView()
if (mVipFlag) {
lastVipStatus = true
}
} }
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
...@@ -74,6 +82,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -74,6 +82,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) { if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态 // 重置状态
lastVipStatus = true
playIndex = new_super_short_video_view.currentPosition playIndex = new_super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList2("" + it.vedioId) } mVedioBean?.let { videoPresenter.getIndexList2("" + it.vedioId) }
} }
...@@ -125,6 +134,15 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -125,6 +134,15 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
mVedioBean!!.isRecommendVedio = true mVedioBean!!.isRecommendVedio = true
LocalVedioManager.commitVedio(mVedioBean!!) LocalVedioManager.commitVedio(mVedioBean!!)
} }
TrackManager.getInstance().getMyInfo()
// 如果从vip变成非vip提示用户退出续费
if (lastVipStatus && !UserManager.getInstance().vipFlag) {
ToastUtil.showLong(context, "您的体验会员已过期")
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 500)
}
} }
fm_bottom.setOnClickListener(this) fm_bottom.setOnClickListener(this)
......
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