diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt index 163e6bbb5d..b417e19fba 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt @@ -78,6 +78,7 @@ import kotlinx.android.synthetic.main.layout_operate_panel.view.iv_operate_panel import kotlinx.coroutines.launch import me.jessyan.autosize.utils.AutoSizeUtils import mogo.telematics.pad.MessagePad +import java.lang.Exception import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.TimeUnit import kotlin.math.min @@ -434,6 +435,8 @@ class OperatePanelLayout : LinearLayout { return super.getDefaultVal(pref) } + private var lastToastTime: Long = 0L + override fun onAutopilotIpcConnectStatusChanged( status: AdasConstants.IpcConnectionStatus, reason: String? @@ -445,15 +448,19 @@ class OperatePanelLayout : LinearLayout { Log.i("xuxinchao","域控连接成功") setEnableStatus(true) }else{ - Log.i("xuxinchao","请等待与域控恢复连接后操作") //断连中,持续提示:请等待与域控恢复连接后操作;并且将所有开关置为不可用状态 - val customToastView = AppStateManager.currentActivity()?.layoutInflater?.inflate(R.layout.view_ipc_connect_status_toast,null) - val customToast = Toast(context?.applicationContext) - customToast.duration = Toast.LENGTH_LONG - customToast.view = customToastView - customToast.setGravity(Gravity.START,AutoSizeUtils.dp2px(context, 280f),0) - customToast.show() - + 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) } }