[8.2.0]运营面板V2X页面提示修改
This commit is contained in:
@@ -2,6 +2,9 @@ package com.mogo.eagle.core.function.hmi.ui.operate
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.os.Message
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log
|
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.tools.SweeperModeChangedConfirmDialog
|
||||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
|
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.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.kotlin.onClick
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
@@ -372,8 +376,10 @@ class OperatePanelLayout : LinearLayout {
|
|||||||
super.operatePanelDisplayStatus(isShow)
|
super.operatePanelDisplayStatus(isShow)
|
||||||
if(isShow){
|
if(isShow){
|
||||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||||
|
FunctionBuildConfig.v2xIsShow = true
|
||||||
}else{
|
}else{
|
||||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||||
|
FunctionBuildConfig.v2xIsShow = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,38 +441,102 @@ class OperatePanelLayout : LinearLayout {
|
|||||||
return super.getDefaultVal(pref)
|
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 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(
|
override fun onAutopilotIpcConnectStatusChanged(
|
||||||
status: AdasConstants.IpcConnectionStatus,
|
status: AdasConstants.IpcConnectionStatus,
|
||||||
reason: String?
|
reason: String?
|
||||||
){
|
){
|
||||||
ThreadUtils.runOnUiThread{
|
ThreadUtils.runOnUiThread{
|
||||||
Log.i("xuxinchao","status="+status)
|
|
||||||
if(status == AdasConstants.IpcConnectionStatus.CONNECTED){
|
if(status == AdasConstants.IpcConnectionStatus.CONNECTED){
|
||||||
//域控连接成功,恢复正常状态
|
//域控连接成功,恢复正常状态
|
||||||
Log.i("xuxinchao","域控连接成功")
|
Log.i(TAG,"域控连接成功")
|
||||||
setEnableStatus(true)
|
// handler.sendEmptyMessage(1)
|
||||||
|
// handler.removeMessages(2)
|
||||||
|
// if(!currentStatus){
|
||||||
|
// currentStatus = true
|
||||||
|
// }
|
||||||
|
this.onResume()
|
||||||
}else{
|
}else{
|
||||||
//断连中,持续提示:请等待与域控恢复连接后操作;并且将所有开关置为不可用状态
|
//断连中,持续提示:请等待与域控恢复连接后操作;并且将所有开关置为不可用状态
|
||||||
Log.i("xuxinchao","请等待与域控恢复连接后操作")
|
Log.i(TAG,"请等待与域控恢复连接后操作"+FunctionBuildConfig.currentStatus)
|
||||||
if(System.currentTimeMillis() - lastToastTime > 5000){
|
FunctionBuildConfig.currentStatus = false
|
||||||
try {
|
handler.removeMessages(1)
|
||||||
val customToastView = AppStateManager.currentActivity()?.layoutInflater?.inflate(R.layout.view_ipc_connect_status_toast,null)
|
handler.sendEmptyMessage(2)
|
||||||
val customToast = Toast(AppStateManager.currentActivity()?.applicationContext)
|
this.onResume()
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEnableStatus(isEnable: Boolean){
|
private fun setEnableStatus(isEnable: Boolean){
|
||||||
|
if(preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(NDE_UPWARD_SWITCH)?.isEnabled == isEnable){
|
||||||
|
return
|
||||||
|
}
|
||||||
//NDE(数据上车)上行
|
//NDE(数据上车)上行
|
||||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(NDE_UPWARD_SWITCH)?.isEnabled = isEnable
|
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(NDE_UPWARD_SWITCH)?.isEnabled = isEnable
|
||||||
//车辆图像上传行云大模型
|
//车辆图像上传行云大模型
|
||||||
|
|||||||
@@ -530,4 +530,12 @@ object FunctionBuildConfig {
|
|||||||
@Volatile
|
@Volatile
|
||||||
@JvmField
|
@JvmField
|
||||||
var isDriveSeatVideoStream: Boolean = false
|
var isDriveSeatVideoStream: Boolean = false
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
@JvmField
|
||||||
|
var v2xIsShow: Boolean = false //运营面板V2X页面是否是显示状态
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
@JvmField
|
||||||
|
var currentStatus: Boolean = false //当前工控机连接状态连接状态
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user