From 84eb439850d34c4d3f22feb6a2a96b99421752b1 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Tue, 7 Mar 2023 14:45:18 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=E6=B6=88=E6=81=AF=E7=9B=92=E5=AD=90?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=81=9C=E8=BD=A6=E9=A2=84=E5=91=8A=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmi/ui/msgbox/MMsgBoxBubbleView.kt | 11 ++++ .../function/hmi/ui/msgbox/MMsgBoxListView.kt | 10 ++++ .../ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt | 20 ++++++++ .../ui/msgbox/adapter/MMsgBoxListAdapter.kt | 27 ++++++++-- .../res/layout/item_m_msg_box_operation.xml | 51 +++++++++++++++++++ .../res/layout/item_m_msg_list_operation.xml | 46 +++++++++++++++++ 6 files changed, 160 insertions(+), 5 deletions(-) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_operation.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_operation.xml diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt index 0c4c752c14..78f9002e4a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt @@ -9,6 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.data.msgbox.OperationMsg import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager @@ -62,6 +63,16 @@ class MMsgBoxBubbleView @JvmOverloads constructor( mMsgBoxBubbleAdapter?.setData(dataList) } } + if(msgBoxList.type == MsgBoxType.OPERATION){ + if((msgBoxList.bean as OperationMsg).type == 2){ + MsgBoxConfig.noticeList.add(msgBoxList) + if(isShowData){ + CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) + dataList.add(msgBoxList) + mMsgBoxBubbleAdapter?.setData(dataList) + } + } + } } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt index 6b71ed67b8..e881c94369 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.data.msgbox.OperationMsg import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager @@ -64,6 +65,15 @@ class MMsgBoxListView @JvmOverloads constructor( mMsgBoxListAdapter?.setData(it) } } + if(msgBoxList.type == MsgBoxType.OPERATION){ + if((msgBoxList.bean as OperationMsg).type == 2){ + noticeList?.add(0,msgBoxList) + noticeList?.let { + mMsgBoxListAdapter?.setData(it) + } + } + } + } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt index 057bdf0cb6..a679403300 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt @@ -28,6 +28,7 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter private val notice: Int = 1 private val v2x: Int = 2 private val summary: Int = 3 + private val operation: Int = 4 var countDownTimer: CountDownTimer?=null @@ -49,6 +50,10 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_summary,parent,false) BubbleSummaryHolder(view) } + operation -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_operation,parent,false) + BubbleOperationHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_v2x,parent,false) BubbleV2XHolder(view) @@ -120,6 +125,13 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter } } } + is BubbleOperationHolder ->{ + data?.let { + val operationMsg = it[position].bean as OperationMsg + holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMOperationContent.text = operationMsg.content + } + } } val msgBoxBean: MsgBoxBean = data!![position] @@ -146,6 +158,8 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter notice }else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){ summary + }else if(data!![position].type == MsgBoxType.OPERATION){ + operation } else{ v2x } @@ -175,4 +189,10 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter var tvMSummaryTime: TextView = itemView.findViewById(R.id.tvMSummaryTime) } + //通知消息 + class BubbleOperationHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvMOperationTime: TextView = itemView.findViewById(R.id.tvMOperationTime) + var tvMOperationContent: TextView = itemView.findViewById(R.id.tvMOperationContent) + } + } \ 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/MMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt index 9e44371868..9b2c0c0e9d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt @@ -9,10 +9,7 @@ import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.enums.EventTypeEnumNew -import com.mogo.eagle.core.data.msgbox.MsgBoxBean -import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg -import com.mogo.eagle.core.data.msgbox.V2XMsg +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 @@ -28,6 +25,7 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter){ this.data = data @@ -44,6 +42,10 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_operation,parent,false) + ListOperationHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_v2x,parent,false) ListV2XHolder(view) @@ -111,6 +113,13 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter { + data?.let { + val operationMsg = it[position].bean as OperationMsg + holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMOperationContent.text = operationMsg.content + } + } } } @@ -121,7 +130,9 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_operation.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_operation.xml new file mode 100644 index 0000000000..d2a3127cbc --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_operation.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + \ No newline at end of file