diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt index 4969812b51..8dc3372472 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt @@ -58,6 +58,7 @@ import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.came import com.mogo.eagle.core.function.hmi.ui.setting.StatusView import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog +import com.mogo.eagle.core.function.hmi.ui.tools.FMDialog import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog import com.mogo.eagle.core.function.hmi.ui.tools.OTADownloadStatusDialog import com.mogo.eagle.core.function.hmi.ui.tools.OTAPowerOffFinishDialog @@ -682,6 +683,7 @@ class MoGoHmiProvider : IMoGoHmiProvider { private var otaDownloadStatusDialog: OTADownloadStatusDialog ?= null private var otaUpgradeResultDialog: OTAUpgradeResultDialog ?= null private var otaPowerOffFinishDialog: OTAPowerOffFinishDialog ?= null + private var fMDialog: FMDialog ?= null /** * 展示OTA升级弹窗 @@ -816,4 +818,20 @@ class MoGoHmiProvider : IMoGoHmiProvider { } } + override fun showFMDialog(errorMsg: String) { + ThreadUtils.runOnUiThread { + context?.let { + if (fMDialog == null) { + fMDialog = FMDialog(it).apply { + // 设置回调,当弹窗消失(无论是手动还是自动)时置空 + onDialogDestroyListener = { + Log.i("FMDialog","回调销毁") + fMDialog = null + } + } + } + fMDialog?.showMsg(errorMsg) + } + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/FMDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/FMDialog.kt new file mode 100644 index 0000000000..c27c5a0a7c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/FMDialog.kt @@ -0,0 +1,78 @@ +package com.mogo.eagle.core.function.hmi.ui.tools + +import android.content.Context +import android.os.Handler +import android.os.Looper +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog +import kotlinx.android.synthetic.main.dialog_fm_data_show.tvResultClose +import kotlinx.android.synthetic.main.dialog_fm_data_show.tvResultContent + +/** + * FM 提示窗 + */ +class FMDialog(context: Context) : + BaseFloatDialog(context, TAG) { + + companion object { + private const val TAG = "FMDialog" + private const val AUTO_DISMISS_DELAY = 2000L // 2秒持续无消息则关闭 + private const val SHOW_INTERVAL = 2000L // 关闭后如果还有事件最短展示时间间隔 + } + + // 用于自动关闭的 Handler + private val mHandler = Handler(Looper.getMainLooper()) + private var dismissTime = System.currentTimeMillis() - SHOW_INTERVAL //初始化时间必须大于 2秒 + + // 自动关闭的任务 + private val mDismissRunnable = Runnable { + dismiss(true) + } + + // 提供给外部的回调,用于清理引用或状态复位 + var onDialogDestroyListener: (() -> Unit)? = null + + init { + setContentView(R.layout.dialog_fm_data_show) + setCanceledOnTouchOutside(false) + tvResultClose.setOnClickListener { + dismiss(false) + } + } + + /** + * 展示/更新定位故障信息 + * @param msg 故障描述 + */ + fun showMsg(msg: String) { + if (System.currentTimeMillis() - dismissTime >= SHOW_INTERVAL) { + // 1. 只要收到新消息,就移除之前的自动关闭任务(重置计时) + mHandler.removeCallbacks(mDismissRunnable) + if (!isShowing) { + show() + } + if (msg.isNotEmpty()) { + tvResultContent.text = msg + } + // 2. 开启/重新开启 2s 后的自动关闭任务 + mHandler.postDelayed(mDismissRunnable, AUTO_DISMISS_DELAY) + } + + } + + fun dismiss(isDestroy: Boolean) { + if (isShowing) { + super.dismiss() + } + dismissTime = System.currentTimeMillis() + if (isDestroy) { + onDialogDestroyListener?.invoke() + mHandler.removeCallbacksAndMessages(null) + } else { + mHandler.removeCallbacks(mDismissRunnable) + mHandler.postDelayed(mDismissRunnable, AUTO_DISMISS_DELAY + 2000L) + } + } + + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_fm_data_show.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_fm_data_show.xml new file mode 100644 index 0000000000..67b28f3846 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_fm_data_show.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt index 2c6857b7dc..6d6381bcb0 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt @@ -374,4 +374,6 @@ interface IMoGoHmiProvider :IProvider{ * 展示数据落盘-终止数据拷贝确认弹窗 */ fun showTerminateCopyDataDialog() + + fun showFMDialog(errorMsg: String) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt index eab6b30451..db8d2ac660 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt @@ -6,9 +6,12 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgFmData import com.mogo.eagle.core.function.api.autopilot.IMoGoFaultManagementStateListener +import com.mogo.eagle.core.function.call.R import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.trace.CallerTrace +import com.mogo.eagle.core.utilcode.util.StringUtils import com.zhjt.mogo.adas.utils.ByteUtil import fault_management.FmInfo @@ -33,6 +36,9 @@ object CallerFaultManagementStateListenerManager : CallerBaseShowing intersection roaming, please try again later Roaming request exception, msg:%s Roaming in progress, intersection roaming not shown + Vehicle localization initialization failed, please move the vehicle to an unobstructed area TTS module initialization error diff --git a/core/mogo-core-res/src/main/res/values/string.xml b/core/mogo-core-res/src/main/res/values/string.xml index 54899b4b42..6a7accb596 100644 --- a/core/mogo-core-res/src/main/res/values/string.xml +++ b/core/mogo-core-res/src/main/res/values/string.xml @@ -181,6 +181,7 @@ 正在展示路口漫游,请稍后重试 漫游请求异常,msg:%s 正在漫游中,不展示路口漫游 + 车辆定位初始化失败,请将车辆移动至无遮挡地点 TTS 模块初始化异常