Commit 29b09e40 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 183fe3e1
package com.xinfu.helivideo.mvp.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class IndexList implements Serializable {
private VedioBean vedioMsg;
private List<VedioEpisodeBean> list;
private ArrayList<String> tip;
public ArrayList<String> getTip() {
return tip;
}
public void setTip(ArrayList<String> tip) {
this.tip = tip;
}
public VedioBean getVedioMsg() {
return vedioMsg;
......
......@@ -15,7 +15,8 @@ import com.xinfu.helivideo.ui.activitys.VipActivity
import com.xinfu.helivideo.ui.widgets.countdowntimer.CountDownTimerSupport
import com.xinfu.helivideo.ui.widgets.countdowntimer.OnCountDownTimerListener
class VipCountDialog(activity: Activity, vedioBean: VedioBean) : Dialog(activity, R.style.dialog) {
class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayList<String>?) :
Dialog(activity, R.style.dialog) {
private val lp: WindowManager.LayoutParams
var timer: CountDownTimerSupport? = null
......@@ -38,6 +39,8 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean) : Dialog(activity
val fm = findViewById<View>(R.id.fm)
val text_count = findViewById<TextView>(R.id.text_count)
val tv_dialog_vip_count_left = findViewById<TextView>(R.id.tv_dialog_vip_count_left)
val tv_dialog_vip_count_right = findViewById<TextView>(R.id.tv_dialog_vip_count_right)
timer = CountDownTimerSupport(3000L, 1000)
timer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
......@@ -51,12 +54,17 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean) : Dialog(activity
})
timer?.start()
if (tipList != null && tipList.size >= 2) {
tv_dialog_vip_count_left.text = tipList.get(0)
tv_dialog_vip_count_right.text = " ${tipList.get(1)}"
}
fm.setOnClickListener {
val bundle= Bundle()
bundle.putString(VipActivity.VEDIO_ID,vedioBean.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID,vedioBean.thirdId)
readyGo(activity, VipActivity::class.java,bundle)
val bundle = Bundle()
bundle.putString(VipActivity.VEDIO_ID, vedioBean.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID, vedioBean.thirdId)
readyGo(activity, VipActivity::class.java, bundle)
dismiss()
}
}
......@@ -84,7 +92,7 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean) : Dialog(activity
}
fun readyGo(activity: Activity,clazz: Class<*>?, bundle: Bundle?) {
fun readyGo(activity: Activity, clazz: Class<*>?, bundle: Bundle?) {
val intent = Intent(activity, clazz)
if (null != bundle) {
intent.putExtras(bundle)
......
......@@ -31,7 +31,6 @@ import com.xinfu.helivideo.ui.adapter.VideoEpisodeAdapter
import com.xinfu.helivideo.ui.widgets.DialogListener
import com.xinfu.helivideo.ui.widgets.VideoEpisodeDialog
import com.xinfu.helivideo.ui.widgets.VipCountDialog
import com.xinfu.helivideo.utils.LogUtil
import com.xinfu.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.drama_activity_api_detail.episode_tv
......@@ -64,6 +63,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private var dpWidget: IDPWidget? = null
private var isInited = false
private var drama: DPDrama? = null
private var tipList: ArrayList<String>? = null
private var mInitUnlockIndex = 0
......@@ -521,6 +521,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
override fun getIndexListSuc(indexList: IndexList) {
tipList = indexList.tip
}
override fun getIndexListFail() {
......@@ -600,7 +601,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private fun showVipCountDialog(position: Int) {
if (position == 0 || mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) return
VipCountDialog(this, mVedioBean!!)
VipCountDialog(this, mVedioBean!!, tipList)
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {
......
......@@ -39,6 +39,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private var mVedioBean: VedioBean? = null
private var indexBean: IndexList? = null
private var tipList: ArrayList<String>? = null
private var isPlayNext = false
private var playIndex = 1
......@@ -136,6 +137,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
if (playIndex > mVedioBean!!.vedioTotal) playIndex = 0
tipList = indexList.tip
mVedioBean = indexList.vedioMsg
indexBean = indexList
videos.clear()
......@@ -273,7 +275,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
return
}
VipCountDialog(this, mVedioBean!!)
VipCountDialog(this, mVedioBean!!, tipList)
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {}
})
......
......@@ -32,6 +32,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_dialog_vip_count_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1分钱"
......@@ -40,6 +41,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/tv_dialog_vip_count_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 签约会员"
......
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