Commit 6017830f authored by mengcuiguang's avatar mengcuiguang

代码优化

parents 4f92d9c6 28adc26b
......@@ -83,7 +83,7 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView {
datas.add(datum)
}
mWatchRecordAdapter?.setNewInstance(datas)
mWatchRecordAdapter?.notifyDataSetChanged()
// mWatchRecordAdapter?.notifyDataSetChanged()
}
override fun getHistoryFail() {
......
......@@ -95,7 +95,7 @@ class FollowVideoFragment : BaseFragment(), FollowView {
}
showEditView(true)
followAdapter?.setEditStyle(false)
followAdapter?.notifyDataSetChanged()
// followAdapter?.notifyDataSetChanged()
}
override fun getCollectListFail() {
......
......@@ -59,7 +59,7 @@ class WatchVideoFragment : BaseFragment(), RecommendView {
when (view.id) {
R.id.ll_bottom -> {
Jzvd.goOnPlayOnPause()
videos[position].seeIndex++
videos[position].recommendIndex++
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
videos[position],
......@@ -84,7 +84,7 @@ class WatchVideoFragment : BaseFragment(), RecommendView {
override fun onVideoCompletion() {
// showToast("即将为您播放下一集")
Jzvd.goOnPlayOnPause()
videos[mCurrentPosition].seeIndex++
videos[mCurrentPosition].recommendIndex++
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
videos[mCurrentPosition],
......
......@@ -176,10 +176,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
finish()
}
vipBtn?.setOnClickListener {
val bundle= Bundle()
bundle.putString(VipActivity.VEDIO_ID,mVedioBean!!.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID,mVedioBean!!.thirdId)
readyGo(VipActivity::class.java,bundle)
val bundle = Bundle()
bundle.putString(VipActivity.VEDIO_ID, mVedioBean!!.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID, mVedioBean!!.thirdId)
readyGo(VipActivity::class.java, bundle)
}
}
......@@ -606,7 +606,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
private fun showVipCountDialog(position: Int) {
if (mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) return
if (position == 0 || mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) return
VipCountDialog(this, mVedioBean!!)
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {
......
......@@ -54,9 +54,12 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun initViewsAndEvents() {
videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
if (isPlayNext) {
playIndex = mVedioBean!!.recommendIndex
playIndex = if (isPlayNext) {
mVedioBean!!.recommendIndex
} else {
mVedioBean!!.seeIndex - 1
}
mCurrentPosition = playIndex
initView()
}
......@@ -116,9 +119,10 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onInitComplete() {
dialog?.setCurrentIndex(mCurrentPosition)
//初始化 自动播放
// autoPlayVideo()
if (mCurrentPosition != mVedioBean!!.seeIndex) {
showVipCountDialog(mCurrentPosition)
}
}
override fun onPageRelease(isNext: Boolean, position: Int) {
//滑动时,释放上一个
......@@ -138,10 +142,8 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// loadData()
}
mCurrentPosition = position
// autoPlayVideo()
showVipCountDialog(mCurrentPosition)
dialog?.setCurrentIndex(mCurrentPosition)
}
......@@ -227,17 +229,18 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
override fun getIndexListSuc(indexList: IndexList) {
// 处理推荐页跳转自动播放下一集逻辑
playIndex = if (isPlayNext) {
mVedioBean!!.recommendIndex - 1
} else {
mVedioBean!!.seeIndex - 1
}
mVedioBean = indexList.vedioMsg
indexBean = indexList
videos.clear()
videos.addAll(indexList.list)
adapter.setNewInstance(getAdapterData())
adapter.notifyDataSetChanged()
// 处理推荐页跳转自动播放下一集逻辑
if (!isPlayNext) {
playIndex = mVedioBean!!.seeIndex - 1
}
mCurrentPosition = playIndex
recy.scrollToPosition(playIndex)
}
......@@ -265,7 +268,7 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
dialog?.changeLockStatus(videos.size)
videos.addAll(indexList.list)
adapter.setNewInstance(getAdapterData())
adapter.notifyDataSetChanged()
// adapter.notifyDataSetChanged()
}
override fun unlockFail() {
......@@ -371,8 +374,12 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun showVipCountDialog(position: Int) {
if (isFinishing) return
<<<<<<< HEAD
// mVedioBean!!.tipMaxIndex=5
if (mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) {
=======
if (position == 0 || mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) {
>>>>>>> 28adc26b9eca95e7af32fac4947e11386e2e939f
autoPlayVideo()
return
}
......
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