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 new file mode 100644 index 0000000000..6774246ebe --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt @@ -0,0 +1,80 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +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.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MMsgBoxBubbleAdapter +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter +import com.mogo.eagle.core.function.msgbox.MsgBoxConfig +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import kotlinx.android.synthetic.main.layout_m_msg_box_bubble.view.* + +class MMsgBoxBubbleView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener { + + private val TAG = "MMsgBoxBubbleView" + private val dataList :ArrayList = ArrayList() + private var mMsgBoxBubbleAdapter: MMsgBoxBubbleAdapter?= null + private var isShowData = true + + init { + LayoutInflater.from(context).inflate(R.layout.layout_m_msg_box_bubble, this, true) + initView() + } + + private fun initView(){ + val linearLayoutManager = LinearLayoutManager(context) + linearLayoutManager.orientation = LinearLayoutManager.VERTICAL + mMsgBoxBubbleAdapter = MMsgBoxBubbleAdapter(context as Activity) + rvMBubbleList.adapter = mMsgBoxBubbleAdapter + rvMBubbleList.layoutManager = linearLayoutManager + } + + /** + * 是否展示接收消息,消息盒子打开状态下不再展示气泡消息 + * @param show true 展示;false 不展示 + */ + fun isShowData(show: Boolean){ + isShowData = show + } + + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post { + if(category == MsgCategory.NOTICE){ + if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X + || msgBoxList.type == MsgBoxType.OBU){ + MsgBoxConfig.noticeList.add(msgBoxList) + if(isShowData){ + CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) + dataList.add(msgBoxList) + mMsgBoxBubbleAdapter?.setData(dataList) + } + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxListenerManager.removeListener(TAG) + } + +} \ 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/MMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxButtonView.kt new file mode 100644 index 0000000000..29d36332f3 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxButtonView.kt @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_m1_msg_box_button.view.* + +class MMsgBoxButtonView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { + + companion object { + const val TAG = "MMsgBoxButtonView" + } + + private var clickListener: ClickListener? = null + + init{ + LayoutInflater.from(context).inflate(R.layout.view_m1_msg_box_button, this, true) + initView() + } + + private fun initView(){ + cbMsgBoxM1.setOnCheckedChangeListener { _, isChecked -> + clickListener?.showMsgBoxList(isChecked) + msgBoxMTipView.visibility = View.GONE + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { + + } + + /** + * 更新新消息提醒红点 + * @param isShow true:展示;false:不展示 + */ + override fun onUpdateTipEvent(isShow: Boolean) { + if(isShow){ + msgBoxMTipView.visibility = View.VISIBLE + }else{ + msgBoxMTipView.visibility = View.GONE + } + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + fun setClickListener(clickListener: ClickListener) { + this.clickListener = clickListener + } + + interface ClickListener{ + fun showMsgBoxList(show: Boolean) + } + + +} \ 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/MMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt new file mode 100644 index 0000000000..f5d04d3eb3 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt @@ -0,0 +1,106 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.recyclerview.widget.DividerItemDecoration +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.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MMsgBoxListAdapter +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxListAdapter +import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import kotlinx.android.synthetic.main.layout_m_msg_box_list.view.* + +class MMsgBoxListView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener { + + private val TAG = "MMsgBoxListView" + var mMsgBoxListAdapter: MMsgBoxListAdapter?= null + private var noticeList: ArrayList ?= null + + init{ + LayoutInflater.from(context).inflate(R.layout.layout_m_msg_box_list, this, true) + initView() + } + + private fun initView(){ + val linearLayoutManager = LinearLayoutManager(context) + linearLayoutManager.orientation = LinearLayoutManager.VERTICAL + val divider = DividerItemDecoration(context, linearLayoutManager.orientation) + getDrawable(R.drawable.rv_divider_line_m)?.let { divider.setDrawable(it) } + mMsgBoxListAdapter = MMsgBoxListAdapter(context as Activity) + rvMList.adapter = mMsgBoxListAdapter + rvMList.layoutManager = linearLayoutManager + rvMList.addItemDecoration(divider) + //获取通知消息列表 + noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList? + noticeList = noticeList?.let { ArrayList(it.reversed()) } + noticeList?.let { + mMsgBoxListAdapter?.setData(it) + } + + } + + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post{ + if(category == MsgCategory.NOTICE){ + if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X + || msgBoxList.type == MsgBoxType.OBU){ + noticeList?.add(0,msgBoxList) + noticeList?.let { + mMsgBoxListAdapter?.setData(it) + } + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxListenerManager.addListener(TAG,this) + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxListenerManager.removeListener(TAG) + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { + + } + + override fun onUpdateTipEvent(isShow: Boolean) { + + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + noticeList?.let { + rvMList.scrollToPosition(it.indexOf(msgBoxBean)) + } + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + + } + +} \ 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/MMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt new file mode 100644 index 0000000000..add1c7f5de --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt @@ -0,0 +1,176 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.app.Activity +import android.os.CountDownTimer +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +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.* +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 +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout + +class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter() { + + private var data: ArrayList ?= null + + private val notice: Int = 1 + private val v2x: Int = 2 + private val summary: Int = 3 + + var countDownTimer: CountDownTimer?=null + + fun setData(data: ArrayList){ + this.data = data + if(data.size>3){ + data.removeAt(0) + } + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + notice -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_notice,parent,false) + BubbleNoticeHolder(view) + } + summary -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_summary,parent,false) + BubbleSummaryHolder(view) + } + else -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_v2x,parent,false) + BubbleV2XHolder(view) + } + } + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is BubbleNoticeHolder -> { + data?.let { + val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg + if(noticeFrCloudMsg.type == 0){ + val noticeNormalData = noticeFrCloudMsg.noticeNormalData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeNormalData?.content + GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) } + } + }else if(noticeFrCloudMsg.type == 1){ + val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content + GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) } + } + } + + } + } + is BubbleV2XHolder -> { + data?.let { + val msgBoxBean = it[position] + val v2XMsg = msgBoxBean.bean as V2XMsg + holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMV2XContent.text = v2XMsg.content + holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable( + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clMVeXLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } + } + } + is BubbleSummaryHolder -> { + data?.let { + val summaryMsg= it[position].bean as V2XMsg + holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMSummaryContent.text = summaryMsg.content + holder.tvMSummaryCheck.setOnClickListener { + //跳转全览模式 +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeSummaryListener() + } + } + } + } + + val msgBoxBean: MsgBoxBean = data!![position] + countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){ + override fun onTick(p0: Long) { + + } + + override fun onFinish() { + data?.remove(msgBoxBean) + notifyDataSetChanged() +// notifyItemRemoved(index) +// notifyItemRangeChanged(index,recordTypeEntity.size-index) + } + + } + countDownTimer?.start() + } + + override fun getItemCount() = data?.size ?: 0 + + override fun getItemViewType(position: Int): Int { + return if(data!![position].type == MsgBoxType.NOTICE){ + notice + }else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){ + summary + } else{ + v2x + } + } + + //Notice + class BubbleNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMNoticeImage: ImageView = itemView.findViewById(R.id.ivMNoticeImage) + var tvMNoticeTitle: TextView = itemView.findViewById(R.id.tvMNoticeTitle) + var tvMNoticeContent: TextView = itemView.findViewById(R.id.tvMNoticeContent) + var tvMNoticeCheck: TextView = itemView.findViewById(R.id.tvMNoticeCheck) + var tvMNoticeTime: TextView = itemView.findViewById(R.id.tvMNoticeTime) + } + + //OBU、V2X + class BubbleV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMV2XImage: ImageView = itemView.findViewById(R.id.ivMV2XImage) + var tvMV2XTime: TextView = itemView.findViewById(R.id.tvMV2XTime) + var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent) + var clMVeXLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clMVeXLayout) + } + + //汇总消息 + class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvMSummaryContent: TextView = itemView.findViewById(R.id.tvMSummaryContent) + var tvMSummaryCheck: TextView = itemView.findViewById(R.id.tvMSummaryCheck) + var tvMSummaryTime: TextView = itemView.findViewById(R.id.tvMSummaryTime) + } + +} \ 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 new file mode 100644 index 0000000000..dc29be12d2 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt @@ -0,0 +1,150 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.app.Activity +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +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.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.transform.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp + +class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter() { + + private var data: List ?= null + + private val notice: Int = 1 + private val v2x: Int = 2 + private val summary: Int = 3 + + fun setData(data: List){ + this.data = data + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + notice -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_notice,parent,false) + ListNoticeHolder(view) + } + summary -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_summary,parent,false) + ListSummaryHolder(view) + } + else -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_v2x,parent,false) + ListV2XHolder(view) + } + } + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is ListNoticeHolder -> { + data?.let { + val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg + if(noticeFrCloudMsg.type == 0){ + val noticeNormalData = noticeFrCloudMsg.noticeNormalData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeNormalData?.content + GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) } + } + }else if(noticeFrCloudMsg.type == 1){ + val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content + GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) } + } + } + } + } + is ListV2XHolder -> { + data?.let { + val msgBoxBean = it[position] + val v2XMsg = msgBoxBean.bean as V2XMsg + holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMV2XContent.text = v2XMsg.content + holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable( + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + } + } + is ListSummaryHolder -> { + data?.let { + val summaryMsg= it[position].bean as V2XMsg + holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMSummaryContent.text = summaryMsg.content + holder.tvMSummaryCheck.setOnClickListener { + //跳转全览模式 +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeSummaryListener() + } + } + } + } + } + + override fun getItemCount() = data?.size ?: 0 + + override fun getItemViewType(position: Int): Int { + return if(data!![position].type == MsgBoxType.NOTICE){ + notice + }else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){ + summary + } else{ + v2x + } + } + + //Notice + class ListNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMNoticeImage: ImageView = itemView.findViewById(R.id.ivMNoticeImage) + var tvMNoticeTitle: TextView = itemView.findViewById(R.id.tvMNoticeTitle) + var tvMNoticeContent: TextView = itemView.findViewById(R.id.tvMNoticeContent) + var tvMNoticeCheck: TextView = itemView.findViewById(R.id.tvMNoticeCheck) + var tvMNoticeTime: TextView = itemView.findViewById(R.id.tvMNoticeTime) + } + + //OBU、V2X + class ListV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMV2XImage: ImageView = itemView.findViewById(R.id.ivMV2XImage) + var tvMV2XTime: TextView = itemView.findViewById(R.id.tvMV2XTime) + var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent) + } + + //汇总消息 + class ListSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvMSummaryContent: TextView = itemView.findViewById(R.id.tvMSummaryContent) + var tvMSummaryCheck: TextView = itemView.findViewById(R.id.tvMSummaryCheck) + var tvMSummaryTime: TextView = itemView.findViewById(R.id.tvMSummaryTime) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png new file mode 100644 index 0000000000..858ead6571 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png new file mode 100644 index 0000000000..500dc5a450 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml new file mode 100644 index 0000000000..6dfeab3203 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml new file mode 100644 index 0000000000..e1cbe83c46 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml new file mode 100644 index 0000000000..c25e5ca499 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml new file mode 100644 index 0000000000..4f9b1507ec --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml new file mode 100644 index 0000000000..552a42b559 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml @@ -0,0 +1,51 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml new file mode 100644 index 0000000000..b63bcf7478 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml new file mode 100644 index 0000000000..6c41f48932 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml new file mode 100644 index 0000000000..0c60db148f --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml @@ -0,0 +1,46 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml new file mode 100644 index 0000000000..43bd8f8e43 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml new file mode 100644 index 0000000000..1dfd4cf013 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml new file mode 100644 index 0000000000..8bb164354d --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file