[6.5.0]修改自动探查展示逻辑

This commit is contained in:
xuxinchao
2024-07-05 20:08:49 +08:00
parent fe062f5d1e
commit ddfea72710
2 changed files with 45 additions and 4 deletions

View File

@@ -91,6 +91,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
MsgCategory.RECORD_BAG -> {
MsgBoxConfig.recordBagList.add(msgBoxBean)
}
else -> {}
}
if(isShowData){
if(category == MsgCategory.RECORD_BAG){

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.notice.exploration
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.os.CountDownTimer
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
@@ -13,9 +14,13 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotSummaryInfo
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
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.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.CountDownTimer
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -27,7 +32,7 @@ class AutomaticExplorationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
private var user = 0
private var ivClose: ImageView ?= null //关闭按钮
@@ -35,10 +40,12 @@ class AutomaticExplorationView @JvmOverloads constructor(
private var rvExplorationList: RecyclerView ?= null
private var automaticExplorationAdapter: AutomaticExplorationAdapter ?= null
private var rotationAnim: ObjectAnimator ?= null
private var showViewTimer: CountDownTimer ?= null //展示自动探查倒计时
companion object {
private const val TAG = "AutomaticExplorationView"
private const val EXPLORATION_SHOW_TIME = 5000L //探查完毕后5秒关闭弹窗
private const val EXPLORATION_HIDE_TIME = 5000L //探查完毕后5秒关闭弹窗
private const val EXPLORATION_SHOW_TIME = 300000L //距离用户在触发上一次事件播报的时间5分钟后自动触发常规道路情况检测
}
init {
@@ -55,6 +62,7 @@ class AutomaticExplorationView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.view_automatic_exploration_p, this, true)
}
initEvent()
CallerMsgBoxListenerManager.addListener(TAG,this)
}
private fun showAutoExploration(){
@@ -78,6 +86,22 @@ 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) {
}
override fun onFinish() {
showAutoExploration()
}
}
showViewTimer?.start()
}
}
private fun initData() {
@@ -104,7 +128,7 @@ class AutomaticExplorationView @JvmOverloads constructor(
//语音播放
AIAssist.getInstance(context).speakTTSVoice("道路畅通一切正常蘑菇行车助手将持续守候您的出行")
//5秒后关闭弹窗
val hideViewTimer =object: CountDownTimer(EXPLORATION_SHOW_TIME,EXPLORATION_SHOW_TIME){
val hideViewTimer =object: CountDownTimer(EXPLORATION_HIDE_TIME,EXPLORATION_HIDE_TIME){
override fun onTick(millisUntilFinished: Long) {
}
@@ -114,6 +138,8 @@ class AutomaticExplorationView @JvmOverloads constructor(
ThreadUtils.runOnUiThread {
this@AutomaticExplorationView.visibility = View.GONE
}
//重新开始下一轮展示倒计时
startShowTimer()
}
}
hideViewTimer.start()
@@ -146,6 +172,20 @@ class AutomaticExplorationView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
}
/**
* 距离用户在触发上一次事件播报的时间5分钟后自动触发常规道路情况检测
*/
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.V2X){
//重置倒计时时长
showViewTimer?.cancel()
startShowTimer()
}
}
}
}