[2.13.0][fix]解决读取消息盒子历史信息的Bug

This commit is contained in:
chenfufeng
2022-12-01 14:14:44 +08:00
parent be671fb471
commit 38096e1a2a
8 changed files with 54 additions and 41 deletions

View File

@@ -84,18 +84,20 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
}else if(holder is BubbleNoticeHolder){
data?.let {
val noticeNormalData = it[position].bean as NoticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData.content
GlideApp.with(activity).load(noticeNormalData.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
CallerHmiManager.showNoticeNormalData(noticeNormalData)
val noticeNormalData = it[position].bean
if (noticeNormalData is NoticeNormalData) {
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData.content
GlideApp.with(activity).load(noticeNormalData.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}
}else if(holder is BubbleV2XHolder){

View File

@@ -172,18 +172,20 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
}else if(holder is MsgBoxNotice){
data?.let {
val noticeNormalData = it[position].bean as NoticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData.content
GlideApp.with(activity).load(noticeNormalData.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
CallerHmiManager.showNoticeNormalData(noticeNormalData)
val noticeNormalData = it[position].bean
if (noticeNormalData is NoticeNormalData) {
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData.content
GlideApp.with(activity).load(noticeNormalData.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}
}else if(holder is MsgBoxV2X){

View File

@@ -81,28 +81,28 @@ object DataManager {
}
}
private fun realSaveMsg(bean: MsgBoxBean) {
val type = bean.type
bean.timestamp = System.currentTimeMillis()
bean.bean2Json = GsonUtils.toJson(bean)
private fun realSaveMsg(msg: MsgBoxBean) {
val type = msg.type
msg.timestamp = System.currentTimeMillis()
msg.bean2Json = GsonUtils.toJson(msg.bean)
when (type) {
MsgBoxType.V2X, MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> {
synchronized(this) {
notifyList.add(bean)
notifyList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, bean)
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
}
MsgBoxType.REPORT -> {
synchronized(this) {
sysInfoList.add(bean)
sysInfoList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, bean)
CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg)
}
MsgBoxType.RECORD -> {
synchronized(this) {
recordBagList.add(bean)
recordBagList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.RECORD_BAG, bean)
CallerMsgBoxListenerManager.invokeListener(MsgCategory.RECORD_BAG, msg)
}
else -> {}
}
@@ -215,7 +215,7 @@ object DataManager {
MsgBoxType.NOTICE.ordinal -> {
return@map MsgBoxBean(
MsgBoxType.NOTICE,
GsonUtils.fromJson(json, NoticeNormalData::class.java)
GsonUtils.fromJson(json, NoticeFrCloudMsg::class.java)
).apply {
withContext(Dispatchers.Main) {
cacheNotifyList.add(this@apply)

View File

@@ -1,6 +1,8 @@
package com.mogo.eagle.core.data.msgbox
import java.io.Serializable
/**
* 运营消息:-1表示初始值
*/
data class OperationMsg(val timestamp : Long, val content: String, val type: Int = -1)
data class OperationMsg(val timestamp : Long, val content: String, val type: Int = -1): Serializable

View File

@@ -1,3 +1,5 @@
package com.mogo.eagle.core.data.msgbox
data class RecordBagMsg(var key: Long, var stat: Int, var id: Int, var type: Int, var fileName: String, var note: String)
import java.io.Serializable
data class RecordBagMsg(var key: Long, var stat: Int, var id: Int, var type: Int, var fileName: String, var note: String): Serializable

View File

@@ -1,3 +1,5 @@
package com.mogo.eagle.core.data.msgbox
data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = "")
import java.io.Serializable
data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = ""): Serializable

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.data.notice
import androidx.annotation.Keep
import java.io.Serializable
/**
* @description 普通公告数据类型
@@ -27,10 +28,10 @@ data class NoticeNormalData(
val cancelVoiceCmd: List<String>? = null, //隐藏当前push命令词
val buttons: List<Button>? = null, //底部buttons列表
var timestamp: Long = System.currentTimeMillis()
)
): Serializable
data class Button(
val text: String = "", // button名称
val action: String = "", //scheme 协议
val voiceCmd: List<String>? = null //注册命令词
)
): Serializable

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.data.report
import java.io.Serializable
/**
* @author XuXinChao
* @description 工控机上报实例
@@ -15,6 +17,6 @@ data class ReportEntity(
var actionsList: List<String>,//试验性字段。消息发出者希望触发的动作例如触发短信报警自动创建工单要求pad弹框等
// var sec: Int,//秒
// var nsec: Int//纳秒 sec和nsec拼接起来是消息发送事件
) {
): Serializable {
}