diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index ace76de97a..b30ccde589 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -942,58 +942,60 @@ class MoGoHmiFragment : MvpFragment(), playTts: Boolean, expireTime: Long ) { - val playTTS = - playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) - activity?.let { - val warningContent = alertContent - ?: EventTypeEnumNew.getWarningContent(v2xType) + ThreadUtils.runOnUiThread { + val playTTS = + playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) + activity?.let { + val warningContent = alertContent + ?: EventTypeEnumNew.getWarningContent(v2xType) // Log.d("liyz", "warningV2X v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent") - //占道施工预警 - if (v2xType.equals("10006") || v2xType.equals("100061")) { - val currentTime = System.currentTimeMillis() / 1000 - val oldTime = - context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) } - if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒 - context?.let { it -> - SharedPrefsMgr.getInstance(it) - .putLong("roadwork", System.currentTimeMillis() / 1000) + //占道施工预警 + if (v2xType == "10006" || v2xType == "100061") { + val currentTime = System.currentTimeMillis() / 1000 + val oldTime = + context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) } + if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒 + context?.let { it -> + SharedPrefsMgr.getInstance(it) + .putLong("roadwork", System.currentTimeMillis() / 1000) + } + CallerAutoPilotManager.sendTripInfo(5, "", "", "", false) } - CallerAutoPilotManager.sendTripInfo(5, "", "", "", false) } - } - if (warningContent.isEmpty()) { - CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") - return - } - listener?.onShow() - CallerLogger.d( - "$M_HMI$TAG", - "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime" - ) - lastShowV2XJob?.safeCancel() - lifecycleScope.launch { - delay(expireTime) - }.also { itx -> - lastShowV2XJob = itx - }.invokeOnCompletion { _ -> - listener?.onDismiss() - showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - - if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) { - val last = lastSpeakJob.get() - Log.d("CODE", "---- 0 ------: last: $last") - if (last != null && !last.isCompleted) { - Log.d("CODE", "---- 1 ------") - return + if (warningContent.isEmpty()) { + CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") + return@runOnUiThread } - lifecycleScope.launch(Dispatchers.Default) { - Log.d("CODE", "---- 2 ------") - speak(it, ttsContent) - Log.d("CODE", "---- 3 ------") + listener?.onShow() + CallerLogger.d( + "$M_HMI$TAG", + "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime" + ) + lastShowV2XJob?.safeCancel() + lifecycleScope.launch { + delay(expireTime) }.also { itx -> - lastSpeakJob.set(itx) + lastShowV2XJob = itx + }.invokeOnCompletion { _ -> + listener?.onDismiss() + showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + } + + if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) { + val last = lastSpeakJob.get() + Log.d("CODE", "---- 0 ------: last: $last") + if (last != null && !last.isCompleted) { + Log.d("CODE", "---- 1 ------") + return@runOnUiThread + } + lifecycleScope.launch(Dispatchers.Default) { + Log.d("CODE", "---- 2 ------") + speak(it, ttsContent) + Log.d("CODE", "---- 3 ------") + }.also { itx -> + lastSpeakJob.set(itx) + } } } } diff --git a/gradle.properties b/gradle.properties index 8e90721114..a18de3eb6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.3.27 MOGO_TELEMATIC_VERSION=1.4.3.27 ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=2.9.0.14_test_03 +MAP_SDK_VERSION=2.9.0.14_test_05 MAP_SDK_OPERATION_VERSION=1.1.4.1 # websocket WEBSOCKET_VERSION=1.1.7