[6.5.0]展示重叠问题优化:安心探查在有事件触发时,应即时打断并自动关闭;

另将灯态、路口相关的提醒也算作事件,5分钟内无事件再触发安心探查
This commit is contained in:
xuxinchao
2024-07-12 17:02:45 +08:00
parent 19423b9208
commit 0d9a6556ac
3 changed files with 57 additions and 4 deletions

View File

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

View File

@@ -20,6 +20,8 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -34,7 +36,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IViewControlListener {
private var user = 0
private var ivClose: ImageView ?= null //关闭按钮
@@ -44,6 +46,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
private var rotationAnim: ObjectAnimator ?= null
private var showViewTimer: CountDownTimer ?= null //展示自动探查倒计时
private var isCountingDown: Boolean = false //是否处于倒计时中
private var hasOrder: Boolean = false // 车当前是否有订单
companion object {
private const val TAG = "AutomaticExplorationView"
@@ -66,6 +69,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
}
initEvent()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerHmiViewControlListenerManager.addListener(TAG,this)
}
private fun showAutoExploration(){
@@ -82,6 +86,11 @@ open class AutomaticExplorationView @JvmOverloads constructor(
ivClose?.setOnClickListener {
rotationAnim?.cancel()
this.visibility = View.GONE
//重新开始下一轮展示倒计时
cancelTimer()
if(hasOrder){
startShowTimer()
}
}
rvExplorationList = findViewById(R.id.rvExplorationList)
val linearLayoutManager = LinearLayoutManager(context)
@@ -115,6 +124,14 @@ open class AutomaticExplorationView @JvmOverloads constructor(
}
}
/**
* 设置当前订单状态
* @param orderStatus true有订单false没有订单
*/
fun currentOrderStatus(orderStatus: Boolean){
hasOrder = orderStatus
}
private fun initData() {
val dataList = ArrayList<AutoExplorationEntity>(7)
dataList.add(AutoExplorationEntity("当前道路事件分析",2000L,false))
@@ -153,8 +170,10 @@ open class AutomaticExplorationView @JvmOverloads constructor(
ThreadUtils.runOnUiThread {
this@AutomaticExplorationView.visibility = View.GONE
}
//重新开始下一轮展示倒计时
startShowTimer()
if(hasOrder){
//重新开始下一轮展示倒计时
startShowTimer()
}
}
}
hideViewTimer.start()
@@ -186,6 +205,7 @@ open class AutomaticExplorationView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(TAG)
cancelTimer()
}
@@ -197,7 +217,9 @@ open class AutomaticExplorationView @JvmOverloads constructor(
if(msgBoxList.type == MsgBoxType.V2X){
//重置倒计时时长
cancelTimer()
startShowTimer()
if(hasOrder){
startShowTimer()
}
}
}
}
@@ -211,4 +233,22 @@ open class AutomaticExplorationView @JvmOverloads constructor(
isCountingDown = false
}
override fun v2xEventVisible(v: Int) {
super.v2xEventVisible(v)
if(v == View.VISIBLE){
//如果当前探查是出于显示状态,则取消动画,并且隐藏
if(this@AutomaticExplorationView.visibility == View.VISIBLE){
rotationAnim?.cancel()
this@AutomaticExplorationView.visibility = View.GONE
}
//重新开始下一轮展示倒计时
cancelTimer()
if(hasOrder){
startShowTimer()
}
}
}
}

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotSummaryInfo
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -80,6 +81,7 @@ class FusionTrafficLightView @JvmOverloads constructor(
UiThreadHandler.post{
mCurrentLightId = TrafficLightEnum.BLACK
this@FusionTrafficLightView.visibility = GONE
CallerHmiViewControlListenerManager.invokeV2XEvent(TAG, View.GONE)
}
}
@@ -105,6 +107,7 @@ class FusionTrafficLightView @JvmOverloads constructor(
//如果当前红绿灯视图为隐藏状态则设置为显示状态
if(this@FusionTrafficLightView.visibility == View.GONE){
this@FusionTrafficLightView.visibility = View.VISIBLE
CallerHmiViewControlListenerManager.invokeV2XEvent(TAG, View.VISIBLE)
AutopilotSummaryInfo.lightServicesNum++
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
val proportionList = intArrayOf(0, 0, 0)