[6.5.0]只有在有订单状态下才开始安心探查显示倒计时

This commit is contained in:
xuxinchao
2024-07-12 15:54:21 +08:00
parent 25ca7ffda5
commit 5795a5bd68
6 changed files with 61 additions and 26 deletions

View File

@@ -43,6 +43,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
private var automaticExplorationAdapter: AutomaticExplorationAdapter ?= null
private var rotationAnim: ObjectAnimator ?= null
private var showViewTimer: CountDownTimer ?= null //展示自动探查倒计时
private var isCountingDown: Boolean = false //是否处于倒计时中
companion object {
private const val TAG = "AutomaticExplorationView"
@@ -88,21 +89,29 @@ open class AutomaticExplorationView @JvmOverloads constructor(
automaticExplorationAdapter = AutomaticExplorationAdapter(context,user)
rvExplorationList?.adapter = automaticExplorationAdapter
rvExplorationList?.layoutManager = linearLayoutManager
startShowTimer()
}
private fun startShowTimer(){
ThreadUtils.runOnUiThread {
showViewTimer = object: CountDownTimer(EXPLORATION_SHOW_TIME,EXPLORATION_SHOW_TIME){
override fun onTick(millisUntilFinished: Long) {
/**
* 开始倒计时
*/
fun startShowTimer(){
if(!isCountingDown){
ThreadUtils.runOnUiThread {
if(showViewTimer == null){
showViewTimer = object: CountDownTimer(EXPLORATION_SHOW_TIME,EXPLORATION_SHOW_TIME){
override fun onTick(millisUntilFinished: Long) {
}
}
override fun onFinish() {
showAutoExploration()
override fun onFinish() {
showAutoExploration()
isCountingDown = false
}
}
}
isCountingDown = true
showViewTimer?.start()
}
showViewTimer?.start()
}
}
@@ -177,8 +186,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
showViewTimer?.cancel()
showViewTimer = null
cancelTimer()
}
/**
@@ -188,10 +196,19 @@ open class AutomaticExplorationView @JvmOverloads constructor(
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.V2X){
//重置倒计时时长
showViewTimer?.cancel()
cancelTimer()
startShowTimer()
}
}
}
/**
* 取消倒计时
*/
fun cancelTimer(){
showViewTimer?.cancel()
showViewTimer = null
isCountingDown = false
}
}