diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt index 4d83ebd265..d825834309 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt @@ -167,7 +167,7 @@ object DataManager { CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg) } - MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { + MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION,MsgBoxType.OTA -> { synchronized(this) { notifyList.add(msg) } @@ -370,6 +370,18 @@ object DataManager { } } + MsgBoxType.OTA.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.OTA, + GsonUtils.fromJson(json,OTAMsg::class.java) + ).apply { + this.timestamp = msgInfo.timeStamp + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + else -> { return@map null } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/adapter/MsgBoxTabAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/adapter/MsgBoxTabAdapter.kt index df5ad368e8..2e05b3b7c7 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/adapter/MsgBoxTabAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/adapter/MsgBoxTabAdapter.kt @@ -47,6 +47,7 @@ class MsgBoxTabAdapter(private val activity: Activity) : private val autopilot = 20 //工控机连接消息 private val fsm = 21 //fsm消息 private val nde = 22 //NDE消息车龙 + private val ota = 23 //OTA升级消息 private val none = -1 @@ -150,6 +151,12 @@ class MsgBoxTabAdapter(private val activity: Activity) : .inflate(R.layout.item_tab_nde,parent,false) return MsgBoxNDE(view) } + //OTA消息 + ota -> { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_tab_ota,parent,false) + return MsgBoxOTA(view) + } //V2X消息 else -> { val view = LayoutInflater.from(parent.context) @@ -558,6 +565,15 @@ class MsgBoxTabAdapter(private val activity: Activity) : holder.tvNdeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) } } + //OTA升级消息 + is MsgBoxOTA ->{ + data?.let { + val otaMsg = it[position].bean as OTAMsg + holder.tvOTATitle.text = otaMsg.title + holder.tvOTAContent.text = otaMsg.des + holder.tvOTATime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + } + } } } @@ -602,6 +618,8 @@ class MsgBoxTabAdapter(private val activity: Activity) : fsm } else if(data!![position].type == MsgBoxType.NDE){ nde + } else if(data!![position].type == MsgBoxType.OTA){ + ota } else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){ v2x } else { @@ -717,4 +735,11 @@ class MsgBoxTabAdapter(private val activity: Activity) : var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) } + //OTA升级 + class MsgBoxOTA(itemView: View) : RecyclerView.ViewHolder(itemView){ + var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle) + var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime) + var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent) + } + } \ 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/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 b418bbc97e..b3114d14fd 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 @@ -49,6 +49,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A private val fsm: Int = 9 private val none: Int = 10 private val nde: Int = 11 + private val ota: Int = 12 private var changeViewListener: ChangeViewListener?=null @@ -113,6 +114,10 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_nde,parent,false) return BubbleNDEHolder(view) } + ota -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_ota,parent,false) + return BubbleOTAHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false) return BubbleV2XHolder(view) @@ -341,6 +346,15 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A holder.tvNDETime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat()) } } + //OTA升级消息 + is BubbleOTAHolder -> { + data?.let { + val otaMsg = it[position].msgBoxBean.bean as OTAMsg + holder.tvOTATitle.text = otaMsg.title + holder.tvOTAContent.text = otaMsg.des + holder.tvOTATime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat()) + } + } } val msgBoxBean: MsgBoxCountDownBean = data!![position] @@ -398,6 +412,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A fsm }else if(data!![position].msgBoxBean.type == MsgBoxType.NDE){ nde + }else if(data!![position].msgBoxBean.type == MsgBoxType.OTA){ + ota } else { v2x @@ -497,6 +513,13 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A var tvNDEContent: TextView = itemView.findViewById(R.id.tvNDEContent) } + //OTA升级消息 + class BubbleOTAHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle) + var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime) + var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent) + } + fun setChangeListener(listener: ChangeViewListener){ changeViewListener = listener } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt index b5037002c0..0bd8bd02e7 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt @@ -50,6 +50,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : private val autopilot = 20 //工控机连接消息 private val fsm = 21 //fsm消息 private val nde = 22 //NDE消息 + private val ota = 23 //OTA升级消息 private val none = -1 @@ -142,6 +143,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : .inflate(R.layout.item_msg_box_nde,parent,false) return MsgBoxNde(view) } + ota ->{ + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_msg_box_ota,parent,false) + return MsgBoxOta(view) + } else -> { val view = LayoutInflater.from(parent.context) .inflate(R.layout.item_msg_box_v2x, parent, false) @@ -725,6 +731,15 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : holder.tvNDETime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) } } + //OTA消息 + is MsgBoxOta -> { + data?.let { + val otaMsg = it[position].bean as OTAMsg + holder.tvOTATitle.text = otaMsg.title + holder.tvOTAContent.text = otaMsg.des + holder.tvOTATime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + } + } } } @@ -769,6 +784,8 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : fsm } else if(data!![position].type == MsgBoxType.NDE){ nde + } else if(data!![position].type == MsgBoxType.OTA){ + ota } else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){ v2x } else { @@ -900,4 +917,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : var tvNDEContent: TextView = itemView.findViewById(R.id.tvNDEContent) } + //OTA + class MsgBoxOta(itemView: View) : RecyclerView.ViewHolder(itemView){ + var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle) + var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime) + var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent) + } + } \ 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/msgbox/adapter/MsgBoxToastAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MsgBoxToastAdapter.kt index 765c8065c7..27c9eea585 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MsgBoxToastAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MsgBoxToastAdapter.kt @@ -22,6 +22,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgFmData import com.mogo.eagle.core.data.msgbox.NDEMsg import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg +import com.mogo.eagle.core.data.msgbox.OTAMsg import com.mogo.eagle.core.data.msgbox.OperationMsg import com.mogo.eagle.core.data.msgbox.SSMMsg import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -48,6 +49,7 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< private val v2x: Int = 2 private val report: Int = 3 private val nde: Int = 4 + private val ota: Int = 5 fun setData(data: ArrayList){ @@ -72,6 +74,10 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_nde,parent,false) BubbleNDEHolder(view) } + ota -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_ota,parent,false) + BubbleOTAHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_v2x,parent,false) BubbleV2XHolder(view) @@ -146,6 +152,14 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< holder.tvNdeContent.text = ndeMsg.des } } + //OTA升级消息 + is BubbleOTAHolder ->{ + data?.let { + val otaMsg = it[position].msgBoxBean.bean as OTAMsg + holder.tvOTATitle.text = otaMsg.title + holder.tvOTAContent.text = otaMsg.des + } + } //V2X消息 is BubbleV2XHolder -> { data?.let { @@ -323,6 +337,9 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< MsgBoxType.NDE ->{ nde } + MsgBoxType.OTA ->{ + ota + } else -> { v2x } @@ -367,4 +384,10 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) } + //OTA升级消息 + class BubbleOTAHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle) + var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent) + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ota.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ota.xml new file mode 100644 index 0000000000..581bbe9e10 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ota.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_ota.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_ota.xml new file mode 100644 index 0000000000..9305375750 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_ota.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_ota.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_ota.xml new file mode 100644 index 0000000000..fe6ffe40ad --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_ota.xml @@ -0,0 +1,45 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_tab_ota.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_tab_ota.xml new file mode 100644 index 0000000000..af7433aee0 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_tab_ota.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index acc6795011..f13b8d7efb 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -209,6 +209,7 @@ FSM图标 V2X图标 NDE图标 + OTA图标 故障发生时间减少 故障发生时间增加 diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxType.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxType.kt index 507cfa8937..7889ba4625 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxType.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxType.kt @@ -2,5 +2,5 @@ package com.mogo.eagle.core.data.msgbox enum class MsgBoxType { // 按功能划分为几大类:运营、通知、V2X模块、OBU模块、工控机Report、录制、交通、FM、语音、SSM、工控机相关等 - OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT, FSM, NDE + OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT, FSM, NDE,OTA } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/OTAMsg.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/OTAMsg.kt new file mode 100644 index 0000000000..f05c5bc94c --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/OTAMsg.kt @@ -0,0 +1,21 @@ +package com.mogo.eagle.core.data.msgbox + +import android.util.Log +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import java.io.Serializable + +/** + * OTA升级相关消息 + */ +data class OTAMsg(var type: String = "", var title: String? = "", var des: String? = ""): + Serializable { + + private var timeStamp: Long = 0 + + init { + timeStamp = System.currentTimeMillis() + if (des.isNullOrEmpty()) { + CallerLogger.e("MsgBox", Log.getStackTraceString(Throwable())) + } + } +} \ No newline at end of file