Commit 8b5dd9be authored by jyx's avatar jyx

福袋计时器监听优化

parent 4e345302
......@@ -295,6 +295,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
fun stopRedbox() {
if (rope != null && rope!!.isRunning) {
rope?.stop()
rope = null
}
}
......@@ -317,6 +318,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
if (!requireActivity().isFinishing) {
stopRedbox()
tv_fragment_main_redbox.text = TimeRender.ms2MS(millisUntilFinished.toInt())
}
}
......@@ -383,7 +385,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
})
}
private fun destoryTimerRedbox(){
private fun destoryTimerRedbox() {
mRedBoxTimer?.stop()
mRedBoxTimer = null
}
......
......@@ -364,7 +364,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
paramsRedBox.setMargins(0, BubbleUtils.dp2px(60), 0, 0)
paramsRedBox.setMargins(0, BubbleUtils.dp2px(40), 0, 0)
paramsRedBox.gravity = Gravity.END
rl_fragment_main_redbox.layoutParams = paramsRedBox
cdvvYilanTime.setOnClickListener(this)
......@@ -589,6 +589,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
fun stopRedbox() {
if (rope != null && rope!!.isRunning) {
rope?.stop()
rope = null
}
}
......@@ -609,6 +610,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
if (!requireActivity().isFinishing) {
stopRedbox()
tv_fragment_main_redbox.text = TimeRender.ms2MS(millisUntilFinished.toInt())
}
}
......@@ -629,7 +631,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
private fun destoryTimerRedbox(){
private fun destoryTimerRedbox() {
mRedBoxTimer?.stop()
mRedBoxTimer = null
}
......
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