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 97805cca30..d2e159753b 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 @@ -111,6 +111,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils import mogo_msg.MogoReportMsg import record_cache.RecordPanelOuterClass import java.util.* +import java.util.concurrent.atomic.AtomicReference /** @@ -171,7 +172,7 @@ class MoGoHmiFragment : MvpFragment(), private var adUpgradeDialog: AdUpgradeDialog? = null - private var lastSpeakJob: Job? = null + private val lastSpeakJob by lazy { AtomicReference() } private var lastShowV2XJob: Job? = null @@ -901,7 +902,7 @@ class MoGoHmiFragment : MvpFragment(), override fun onShow(reminder: IReminder) { listener?.onShow() lastShowV2XJob?.safeCancel() - lastSpeakJob?.safeCancel() + lastSpeakJob.get()?.safeCancel() showingV2XTip = reminder lifecycleScope.launch { delay(expireTime) @@ -914,7 +915,7 @@ class MoGoHmiFragment : MvpFragment(), lifecycleScope.launch { speak(it, ttsContent) }.also { itx -> - lastSpeakJob = itx + lastSpeakJob.set(itx) } } } @@ -969,10 +970,7 @@ class MoGoHmiFragment : MvpFragment(), "$M_HMI$TAG", "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime" ) - lastShowV2XJob?.safeCancel() - lastSpeakJob?.safeCancel() - lifecycleScope.launch { delay(expireTime) }.also { itx -> @@ -983,10 +981,18 @@ class MoGoHmiFragment : MvpFragment(), } if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) { - lifecycleScope.launch { + val last = lastSpeakJob.get() + Log.d("CODE", "---- 0 ------: last: $last") + if (last != null && !last.isCompleted) { + Log.d("CODE", "---- 1 ------") + return + } + lifecycleScope.launch(Dispatchers.Default) { + Log.d("CODE", "---- 2 ------") speak(it, ttsContent) + Log.d("CODE", "---- 3 ------") }.also { itx -> - lastSpeakJob = itx + lastSpeakJob.set(itx) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt index e7b7342600..1f656db107 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt @@ -61,7 +61,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A return BubbleNoticeHolder(view) } summary -> { - val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_summary,parent,false) + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_summary,parent,false) return BubbleSummaryHolder(view) } else -> { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_summary.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_summary.xml index 158fb1f2c6..9f2439221a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_summary.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_summary.xml @@ -38,11 +38,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XAiRoadEventMarker.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XAiRoadEventMarker.kt index 3fd2422a9c..563aada462 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XAiRoadEventMarker.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XAiRoadEventMarker.kt @@ -69,7 +69,7 @@ class V2XAiRoadEventMarker { options.zIndex(75000f) options.maxIndex(800000f) val line = overlayManager.addPolyline(options) - current.set(Pair(line, null)) + current.set(Pair(line, wrapper.markers)) if (line != null) { line.isVisible = true wrapper.addLine(line) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index b96d19cd12..4eb32d0dc2 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -27,6 +27,7 @@ import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; import com.mogo.eagle.core.network.utils.GsonUtil; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.concurrent.TimeUnit; /** @@ -72,16 +73,23 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp try { if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { //只展示不播报 不广播 - boolean onlyShow = getV2XMessageEntity().isOnlyShow(); + V2XMessageEntity entity = getV2XMessageEntity(); + boolean onlyShow = entity.isOnlyShow(); if (!onlyShow) { // 设置TTS - getV2XMessageEntity().getContent().getTts(false); + V2XRoadEventEntity content = entity.getContent(); + if (content != null && !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType()) + && !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType()) + && !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType()) + && !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_CONGESTION.getPoiType())) { + content.getTts(false); + } } showWindow(); - String poiType = getV2XMessageEntity().getContent().getPoiType(); - String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat()); - String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon()); - String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId(); + String poiType = entity.getContent().getPoiType(); + String lat = String.valueOf(entity.getContent().getLocation().getLat()); + String lon = String.valueOf(entity.getContent().getLocation().getLon()); + String infoId = entity.getContent().getNoveltyInfo().getInfoId(); String style = "1"; Map properties = new HashMap<>(); properties.put("dbid", infoId); @@ -117,7 +125,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp if (carLocation != null && noveltyInfo != null) { MarkerLocation eventLocation = noveltyInfo.getLocation(); if (eventLocation != null) { - double distance = CoordinateUtils.calculateLineDistance(carLocation.getLongitude(), carLocation.getLatitude(), eventLocation.getLon(), eventLocation.getLat()); + double distance = content.getDistance(); alarmText = String.format(alarmText, Math.round(distance) + ""); ttsText = String.format(ttsText, Math.round(distance) + ""); }