[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

@@ -20,18 +20,36 @@ class OchAutomaticExplorationView @JvmOverloads constructor(
override fun onCurrentOrderStatusChanged(order: BaseOrderBean?) {
if(order==null){
cancelTimer()
}else {
when (order.orderStatus) {
TaxiOrderStatusEnum.None.code -> {}
TaxiOrderStatusEnum.OnTheWayToStart.code -> {}
TaxiOrderStatusEnum.ArriveAtStart.code -> {}
TaxiOrderStatusEnum.UserArriveAtStart.code -> {}
TaxiOrderStatusEnum.OnTheWayToEnd.code -> {}
TaxiOrderStatusEnum.ArriveAtEnd.code -> {}
TaxiOrderStatusEnum.JourneyCompleted.code -> {}
TaxiOrderStatusEnum.Cancel.code -> {}
else -> {}
TaxiOrderStatusEnum.None.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.OnTheWayToStart.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.ArriveAtStart.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.UserArriveAtStart.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.OnTheWayToEnd.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.ArriveAtEnd.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.JourneyCompleted.code -> {
startShowTimer()
}
TaxiOrderStatusEnum.Cancel.code -> {
cancelTimer()
}
else -> {
cancelTimer()
}
}
}
}

View File

@@ -160,7 +160,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--自动探查-->
<com.mogo.eagle.core.function.hmi.ui.notice.exploration.AutomaticExplorationView
<com.mogo.och.common.module.wigets.rodedata.OchAutomaticExplorationView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"

View File

@@ -203,7 +203,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--自动探查-->
<com.mogo.eagle.core.function.hmi.ui.notice.exploration.AutomaticExplorationView
<com.mogo.och.common.module.wigets.rodedata.OchAutomaticExplorationView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_20"

View File

@@ -219,7 +219,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--自动探查-->
<com.mogo.eagle.core.function.hmi.ui.notice.exploration.AutomaticExplorationView
<com.mogo.och.common.module.wigets.rodedata.OchAutomaticExplorationView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"

View File

@@ -106,7 +106,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--自动探查-->
<com.mogo.eagle.core.function.hmi.ui.notice.exploration.AutomaticExplorationView
<com.mogo.och.common.module.wigets.rodedata.OchAutomaticExplorationView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_20"

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
}
}