diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt index 364411654e..db78cd9935 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt @@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform @@ -112,7 +113,8 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView holder.tvPassengerSummaryContent.text = summaryMsg.content holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 - CallerHmiManager.showSmallFragment() +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeListener() } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt index 18c9695682..8bb23e0ed6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform @@ -104,7 +105,8 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A holder.tvPassengerSummaryContent.text = summaryMsg.content holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 - CallerHmiManager.showSmallFragment() +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeListener() } } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index a876d30687..dd4418e8db 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -453,23 +453,23 @@ enum class EventTypeEnumNew( ), TYPE_USECASE_ID_ACCIDENT( 244.toString(), - "事故", + "交通事故", poiTypeSrcVr = R.drawable.v2x_icon_jiaotongshigu_vr, - content = "前方%s米事故", - tts = "前方%s米事故" + content = "前方%s米交通事故", + tts = "前方%s米交通事故" ), //------------车内标牌 obu end --------------> TYPE_SOCKET_ROAD_CONGESTION( - "10007", - "道路拥堵", + "100071", + "交通拥堵", poiTypeSrcVr = R.drawable.v2x_icon_yongdu_vr, content = "前方%s米交通拥堵", tts = "前方%s米交通拥堵" ), TYPE_SOCKET_ROAD_JINGZHI( - "10025", + "100251", "前方%s米静止障碍物占道", poiTypeSrcVr = R.drawable.v2x_icon_jingzhi_zhangai, content = "前方%s米静止障碍物占道", diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt new file mode 100644 index 0000000000..cebfca9d9b --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt @@ -0,0 +1,9 @@ +package com.mogo.eagle.core.function.api.msgbox +/** + * @author XuXinChao + * @date 2023/1/16 + * 消息盒子事件监听回调 + */ +interface IMsgBoxEventListener { + fun onSummaryClickEvent() +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt new file mode 100644 index 0000000000..3696e0f471 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt @@ -0,0 +1,70 @@ +package com.mogo.eagle.core.function.call.msgbox + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.call.base.CallerBase +import java.util.concurrent.ConcurrentHashMap + +/** + * @author XuXinChao + * @date 2023/1/16 + * 消息盒子事件监听管理 + */ +object CallerMsgBoxEventListenerManager: CallerBase() { + + private val statusListeners: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加数据监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener(@Nullable tag: String,@Nullable listener: IMsgBoxEventListener){ + if (statusListeners.containsKey(tag)) { + return + } + statusListeners[tag] = listener + } + + /** + * 删除状态监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!statusListeners.containsKey(tag)) { + return + } + statusListeners.remove(tag) + } + + /** + * 删除状态监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMsgBoxEventListener){ + if (!statusListeners.containsValue(listener)) { + return + } + var tag = "" + statusListeners.forEach { + if (it.value == listener) { + tag = it.key + statusListeners.remove(it.key) + } + } + } + + /** + * 触发监听 + */ + fun invokeListener(){ + statusListeners.forEach { + val tag = it.key + val listener = it.value + listener.onSummaryClickEvent() + } + } + + +} \ No newline at end of file