[8.2.0]运营面板V2X页面提示修改

This commit is contained in:
xuxinchao
2025-08-11 19:16:07 +08:00
parent 2a480da2e9
commit a1448ae33e
2 changed files with 94 additions and 16 deletions

View File

@@ -2,6 +2,9 @@ package com.mogo.eagle.core.function.hmi.ui.operate
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.os.SystemClock
import android.util.AttributeSet
import android.util.Log
@@ -59,6 +62,7 @@ import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithWel
import com.mogo.eagle.core.function.hmi.ui.tools.SweeperModeChangedConfirmDialog
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
import com.mogo.eagle.core.function.hmi.ui.utils.SOPAnalyticsManager.clickEventAnalytics
import com.mogo.eagle.core.function.main.MainMoGoApplication
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -372,8 +376,10 @@ class OperatePanelLayout : LinearLayout {
super.operatePanelDisplayStatus(isShow)
if(isShow){
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
FunctionBuildConfig.v2xIsShow = true
}else{
CallerAutoPilotStatusListenerManager.removeListener(TAG)
FunctionBuildConfig.v2xIsShow = false
}
}
@@ -435,38 +441,102 @@ class OperatePanelLayout : LinearLayout {
return super.getDefaultVal(pref)
}
override fun onResume() {
FunctionBuildConfig.v2xIsShow = true
if(AppConfigInfo.isConnectAutopilot){
FunctionBuildConfig.currentStatus = true
handler.removeMessages(2)
handler.sendEmptyMessage(1)
}else{
FunctionBuildConfig.currentStatus = false
handler.removeMessages(1)
handler.sendEmptyMessage(2)
}
super.onResume()
}
override fun onPause() {
FunctionBuildConfig.v2xIsShow = false
handler.removeMessages(1)
handler.removeMessages(2)
super.onPause()
}
private val handler =object : Handler(Looper.getMainLooper()){
override fun handleMessage(msg: Message){
super.handleMessage(msg)
//与域控连接正常
if(msg.what == 1){
Log.i(TAG,"与域控连接正常 handler操作1")
setEnableStatus(true)
FunctionBuildConfig.currentStatus = true
this.removeMessages(2)
}
//与域控断连
else if(msg.what == 2){
Log.i(TAG,"与域控断连 handler操作2 ="+FunctionBuildConfig.v2xIsShow)
if(FunctionBuildConfig.v2xIsShow){
Log.i(TAG,"currentStatus = "+FunctionBuildConfig.currentStatus)
if(FunctionBuildConfig.currentStatus){
return
}
Log.i(TAG,"执行断连UI操作")
setEnableStatus(false)
showConnectToast()
this.removeMessages(2)
this.sendEmptyMessageDelayed(2,5000)
}
}
}
}
private var lastToastTime: Long = 0L
private fun showConnectToast(){
if(System.currentTimeMillis() - lastToastTime > 4500){
try {
AppStateManager.currentActivity()?.let {
val customToastView = it.layoutInflater.inflate(R.layout.view_ipc_connect_status_toast,null)
val customToast = Toast(MainMoGoApplication.getApp().applicationContext)
customToast.duration = Toast.LENGTH_SHORT
customToast.view = customToastView
customToast.setGravity(Gravity.START,AutoSizeUtils.dp2px(MainMoGoApplication.getApp().applicationContext, 280f),0)
customToast.show()
}
}catch (_: Exception){}
lastToastTime = System.currentTimeMillis()
}
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
reason: String?
){
ThreadUtils.runOnUiThread{
Log.i("xuxinchao","status="+status)
if(status == AdasConstants.IpcConnectionStatus.CONNECTED){
//域控连接成功,恢复正常状态
Log.i("xuxinchao","域控连接成功")
setEnableStatus(true)
Log.i(TAG,"域控连接成功")
// handler.sendEmptyMessage(1)
// handler.removeMessages(2)
// if(!currentStatus){
// currentStatus = true
// }
this.onResume()
}else{
//断连中,持续提示:请等待与域控恢复连接后操作;并且将所有开关置为不可用状态
Log.i("xuxinchao","请等待与域控恢复连接后操作")
if(System.currentTimeMillis() - lastToastTime > 5000){
try {
val customToastView = AppStateManager.currentActivity()?.layoutInflater?.inflate(R.layout.view_ipc_connect_status_toast,null)
val customToast = Toast(AppStateManager.currentActivity()?.applicationContext)
customToast.duration = Toast.LENGTH_SHORT
customToast.view = customToastView
customToast.setGravity(Gravity.START,AutoSizeUtils.dp2px(context, 280f),0)
customToast.show()
}catch (_: Exception){}
lastToastTime = System.currentTimeMillis()
}
setEnableStatus(false)
Log.i(TAG,"请等待与域控恢复连接后操作"+FunctionBuildConfig.currentStatus)
FunctionBuildConfig.currentStatus = false
handler.removeMessages(1)
handler.sendEmptyMessage(2)
this.onResume()
}
}
}
private fun setEnableStatus(isEnable: Boolean){
if(preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(NDE_UPWARD_SWITCH)?.isEnabled == isEnable){
return
}
//NDE数据上车上行
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(NDE_UPWARD_SWITCH)?.isEnabled = isEnable
//车辆图像上传行云大模型

View File

@@ -530,4 +530,12 @@ object FunctionBuildConfig {
@Volatile
@JvmField
var isDriveSeatVideoStream: Boolean = false
@Volatile
@JvmField
var v2xIsShow: Boolean = false //运营面板V2X页面是否是显示状态
@Volatile
@JvmField
var currentStatus: Boolean = false //当前工控机连接状态连接状态
}