diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/BusPassengerMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/BusPassengerMsgBoxBubbleView.kt index ed9c9303bc..cee53028c3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/BusPassengerMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/BusPassengerMsgBoxBubbleView.kt @@ -55,7 +55,8 @@ class BusPassengerMsgBoxBubbleView @JvmOverloads constructor( UiThreadHandler.post({ if(category == MsgCategory.NOTICE){ if(msgBoxList.type == MsgBoxType.NOTICE - || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){ + || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION + || msgBoxList.type == MsgBoxType.NDE){ MsgBoxConfig.noticeList.add(msgBoxList) if(isShowData){ CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MBoxBubbleView.kt index f581c4f496..5fb6671983 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MBoxBubbleView.kt @@ -58,7 +58,8 @@ class MBoxBubbleView @JvmOverloads constructor( UiThreadHandler.post({ if(category == MsgCategory.NOTICE){ if(msgBoxList.type == MsgBoxType.NOTICE - || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){ + || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION + || msgBoxList.type == MsgBoxType.NDE){ MsgBoxConfig.noticeList.add(msgBoxList) if(isShowData){ CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) 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 6fc7280b14..86e2990083 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 @@ -55,7 +55,8 @@ class MMsgBoxBubbleView @JvmOverloads constructor( UiThreadHandler.post({ if(category == MsgCategory.NOTICE){ if(msgBoxList.type == MsgBoxType.NOTICE - || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){ + || msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION + || msgBoxList.type == MsgBoxType.NDE){ update(msgBoxList) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt index 809a47c7aa..02f3b39bca 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt @@ -70,7 +70,8 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor( override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { UiThreadHandler.post({ if(category == MsgCategory.NOTICE){ - if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.OBU){ + if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.OBU + || msgBoxList.type == MsgBoxType.NDE){ if(isCacheMsg){ //将消息缓存到未播放列表等待小智语音播放完成后取出播放 MsgBoxConfig.unPlayList.add(msgBoxList) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/BusPassengerMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/BusPassengerMsgBoxBubbleAdapter.kt index d39ac2adae..8f643dca85 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/BusPassengerMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/BusPassengerMsgBoxBubbleAdapter.kt @@ -8,6 +8,7 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.core.content.res.ResourcesCompat +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* @@ -23,6 +24,7 @@ class BusPassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerV private val notice: Int = 1 private val v2x: Int = 2 private val operation: Int = 3 + private val nde: Int = 4 fun setData(data: ArrayList){ this.data = data @@ -42,6 +44,10 @@ class BusPassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerV val view = LayoutInflater.from(parent.context).inflate(R.layout.item_bus_box_operation,parent,false) BusBubbleOperationHolder(view) } + nde->{ + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_nde,parent,false) + BusBubbleNdeHolder(view) + } else ->{ val view = LayoutInflater.from(parent.context).inflate(R.layout.item_bus_box_v2x,parent,false) BusBubbleV2XHolder(view) @@ -84,6 +90,21 @@ class BusPassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerV holder.tvBusPV2XTitle.text = EventTypeEnumNew.getEventTitle(v2XMsg.type) } } + is BusBubbleNdeHolder ->{ + data?.let { + val ndeMsg = it[position].msgBoxBean.bean as NDEMsg + holder.tvNdeTitle.text = ndeMsg.title + holder.tvNdeContent.text = ndeMsg.des + val linearLayoutManager = LinearLayoutManager(activity) + linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL + val ndeRoadAdapter = PassengerNDERoadAdapter(activity) + holder.rvNdeList.adapter = ndeRoadAdapter + holder.rvNdeList.layoutManager = linearLayoutManager + ndeMsg.getRoadList()?.let {roadList-> + ndeRoadAdapter.setData(roadList) + } + } + } } val msgBoxBean: MsgBoxCountDownBean = data!![position] @@ -107,12 +128,19 @@ class BusPassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerV override fun getItemCount() = data?.size ?: 0 override fun getItemViewType(position: Int): Int{ - return if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){ - notice - }else if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){ - operation - } else{ - v2x + return when (data!![position].msgBoxBean.type) { + MsgBoxType.NOTICE -> { + notice + } + MsgBoxType.OPERATION -> { + operation + } + MsgBoxType.NDE -> { + nde + } + else -> { + v2x + } } } @@ -136,4 +164,12 @@ class BusPassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerV var tvBusPOperationContent: TextView = itemView.findViewById(R.id.tvBusPOperationContent) } + //NDE + class BusBubbleNdeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivNdeImage: ImageView = itemView.findViewById(R.id.ivNdeImage) + var tvNdeTitle: TextView = itemView.findViewById(R.id.tvNdeTitle) + var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) + var rvNdeList: RecyclerView = itemView.findViewById(R.id.rvNdeList) + } + } \ 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/MBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MBoxBubbleAdapter.kt index 57f1c7afe1..8c66767006 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MBoxBubbleAdapter.kt @@ -8,6 +8,7 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.core.content.res.ResourcesCompat +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* @@ -23,6 +24,7 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter){ @@ -43,6 +45,10 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter{ + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_nde,parent,false) + BubbleNdeHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_v2x,parent,false) BubbleV2XHolder(view) @@ -85,6 +91,21 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter{ + data?.let { + val ndeMsg = it[position].msgBoxBean.bean as NDEMsg + holder.tvNdeTitle.text = ndeMsg.title + holder.tvNdeContent.text = ndeMsg.des + val linearLayoutManager = LinearLayoutManager(activity) + linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL + val ndeRoadAdapter = PassengerNDERoadAdapter(activity) + holder.rvNdeList.adapter = ndeRoadAdapter + holder.rvNdeList.layoutManager = linearLayoutManager + ndeMsg.getRoadList()?.let {roadList-> + ndeRoadAdapter.setData(roadList) + } + } + } } val msgBoxBean: MsgBoxCountDownBean = data!![position] @@ -114,6 +135,9 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter { operation } + MsgBoxType.NDE -> { + nde + } else -> { v2x } @@ -142,5 +166,12 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter){ @@ -55,6 +57,10 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_operation,parent,false) BubbleOperationHolder(view) } + nde -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_nde,parent,false) + BubbleNdeHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_v2x,parent,false) BubbleV2XHolder(view) @@ -137,6 +143,21 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter holder.tvMOperationContent.text = operationMsg.content } } + is BubbleNdeHolder ->{ + data?.let { + val ndeMsg = it[position].msgBoxBean.bean as NDEMsg + holder.tvNdeTitle.text = ndeMsg.title + holder.tvNdeContent.text = ndeMsg.des + val linearLayoutManager = LinearLayoutManager(activity) + linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL + val ndeRoadAdapter = PassengerNDERoadAdapter(activity) + holder.rvNdeList.adapter = ndeRoadAdapter + holder.rvNdeList.layoutManager = linearLayoutManager + ndeMsg.getRoadList()?.let {roadList-> + ndeRoadAdapter.setData(roadList) + } + } + } } val msgBoxBean: MsgBoxCountDownBean = data!![position] @@ -165,7 +186,9 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter summary }else if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){ operation - } else{ + }else if(data!![position].msgBoxBean.type == MsgBoxType.NDE){ + nde + }else{ v2x } } @@ -201,4 +224,12 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter var tvMOperationContent: TextView = itemView.findViewById(R.id.tvMOperationContent) } + //NDE + class BubbleNdeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivNdeImage: ImageView = itemView.findViewById(R.id.ivNdeImage) + var tvNdeTitle: TextView = itemView.findViewById(R.id.tvNdeTitle) + var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) + var rvNdeList: RecyclerView = itemView.findViewById(R.id.rvNdeList) + } + } \ 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 3a11acdf89..f56e3a49af 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 @@ -10,6 +10,8 @@ import android.widget.TextView import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat +import androidx.recyclerview.widget.DividerItemDecoration +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.deva.report.ReportEntity import com.mogo.eagle.core.data.enums.DataSourceType @@ -150,6 +152,15 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< val ndeMsg = it[position].msgBoxBean.bean as NDEMsg holder.tvNdeTitle.text = ndeMsg.title holder.tvNdeContent.text = ndeMsg.des + val linearLayoutManager = LinearLayoutManager(activity) + linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL + val ndeRoadAdapter = NDERoadAdapter(activity) + holder.rvRoadList.adapter = ndeRoadAdapter + holder.rvRoadList.layoutManager = linearLayoutManager +// holder.rvRoadList.addItemDecoration(divider) + ndeMsg.getRoadList()?.let {roadList-> + ndeRoadAdapter.setData(roadList) + } } } //OTA升级消息 @@ -387,6 +398,7 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter< class BubbleNDEHolder(itemView: View): RecyclerView.ViewHolder(itemView){ var tvNdeTitle: TextView = itemView.findViewById(R.id.tvNdeTitle) var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) + var rvRoadList: RecyclerView = itemView.findViewById(R.id.rvRoadList) } //OTA升级消息 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/NDERoadAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/NDERoadAdapter.kt new file mode 100644 index 0000000000..5472c160da --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/NDERoadAdapter.kt @@ -0,0 +1,183 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.content.Context +import android.util.TypedValue +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.data.msgbox.NDEMsg +import com.mogo.eagle.core.function.hmi.R + +/** + * NDE消息车龙车道列表适配器 + */ +class NDERoadAdapter(private val context: Context): RecyclerView.Adapter() { + + private var roadList: List ?= null + + fun setData(list: List){ + roadList = list + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RoadHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_nde_road, parent, false) + return RoadHolder(view) + } + + override fun onBindViewHolder(holder: RoadHolder, position: Int) { + roadList?.let { + val roadMsg = it[position] + if(it.size <= 3){ + //设置item宽度为最大宽度180dp + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else if(it.size == 4){ + //设置item宽度为最大宽度180dp + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 152f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else if(it.size == 5){ + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 120f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else{ + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 90f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + } + when(roadMsg.arrowType){ + //直行 + 201->{ + holder.ivRoadType.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_road_forward + )) + } + //直行或左转 + 202->{ + + } + //直行或右转 + 203->{ + + } + //直行或掉头 + 204->{ + + } + //左转 + 205->{ + + } + //左转或掉头 + 206->{ + + } + //左弯或向左合流 + 207->{ + + } + //右转 + 208->{ + + } + //右转或向右合流 + 209->{ + + } + //左右转弯 + 210->{ + + } + //掉头 + 211->{ + + } + //禁止左转 + 212->{ + + } + //禁止右转 + 213->{ + + } + //禁止掉头 + 214->{ + + } + //直行或左转或右转 + 215->{ + + } + //直行或掉头或左转 + 216->{ + + } + //右转或掉头 + 217->{ + + } + //禁止右转或向右合流 + 218->{ + + } + } + //是否是推荐车道 + if(roadMsg.isRecommend){ + holder.tvRoadStatus.text = context.getString(R.string.nde_road_recommend) + holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_recommend)) + if(it.size<=3){ + holder.clRoadLayout.background = ContextCompat.getDrawable( + context, + R.drawable.bg_road_recommend_one + ) + }else if(it.size == 4){ + holder.clRoadLayout.background = ContextCompat.getDrawable( + context, + R.drawable.bg_road_recommend_two + ) + }else{ + holder.clRoadLayout.background = ContextCompat.getDrawable( + context, + R.drawable.bg_road_recommend_three + ) + } + } + //是否有车龙,代表拥堵、行驶缓慢 + if(roadMsg.isCheLong){ + holder.tvRoadStatus.text = context.getString(R.string.nde_road_slow) + holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_slow)) + } + if(position == it.lastIndex){ + holder.viewDivider.visibility = View.INVISIBLE + } + } + } + + override fun getItemCount() = roadList?.size ?: 0 + + class RoadHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ + var clRoadLayout: ConstraintLayout = itemView.findViewById(R.id.clRoadLayout) + var ivRoadType: ImageView = itemView.findViewById(R.id.ivRoadType) + var tvRoadStatus: TextView = itemView.findViewById(R.id.tvRoadStatus) + var viewDivider: View = itemView.findViewById(R.id.viewDivider) + } + +} \ 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/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 8207016a7e..6f1854dc0c 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 @@ -8,6 +8,7 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.core.content.res.ResourcesCompat +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.enums.EventTypeEnumNew @@ -35,6 +36,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView private val v2x: Int = 2 private val summary: Int = 3 private val voice: Int = 4 + private val nde: Int = 5 fun setData(data: ArrayList){ this.data = data @@ -70,6 +72,10 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_voice,parent,false) BubbleVoiceHolder(view) } + nde -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_nde,parent,false) + BubbleNdeHolder(view) + } else -> { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false) BubbleV2XHolder(view) @@ -149,6 +155,21 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView } } } + is BubbleNdeHolder ->{ + data?.let { + val ndeMsg = it[position].msgBoxBean.bean as NDEMsg + holder.tvNdeTitle.text = ndeMsg.title + holder.tvNdeContent.text = ndeMsg.des + val linearLayoutManager = LinearLayoutManager(activity) + linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL + val ndeRoadAdapter = PassengerNDERoadAdapter(activity) + holder.rvNdeList.adapter = ndeRoadAdapter + holder.rvNdeList.layoutManager = linearLayoutManager + ndeMsg.getRoadList()?.let {roadList-> + ndeRoadAdapter.setData(roadList) + } + } + } } val msgBoxBean: MsgBoxCountDownBean = data!![position] @@ -181,6 +202,8 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView summary }else if(data!![position].msgBoxBean.type == MsgBoxType.VOICE){ voice + }else if(data!![position].msgBoxBean.type == MsgBoxType.NDE){ + nde }else{ v2x } @@ -213,4 +236,12 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView var tvVoiceRes: AlignTwoTextView = itemView.findViewById(R.id.tvVoiceRes) } + //NDE + class BubbleNdeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivNdeImage: ImageView = itemView.findViewById(R.id.ivNdeImage) + var tvNdeTitle: TextView = itemView.findViewById(R.id.tvNdeTitle) + var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent) + var rvNdeList: RecyclerView = itemView.findViewById(R.id.rvNdeList) + } + } \ 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/PassengerNDERoadAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerNDERoadAdapter.kt new file mode 100644 index 0000000000..50f81786c3 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerNDERoadAdapter.kt @@ -0,0 +1,168 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.content.Context +import android.util.TypedValue +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.data.msgbox.NDEMsg +import com.mogo.eagle.core.function.hmi.R + +class PassengerNDERoadAdapter(private val context: Context): RecyclerView.Adapter() { + + private var roadList: List ?= null + + fun setData(list: List){ + roadList = list + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PassengerRoadHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_passenger_nde_road, parent, false) + return PassengerRoadHolder(view) + } + + override fun onBindViewHolder(holder: PassengerRoadHolder, position: Int) { + roadList?.let{ + val roadMsg = it[position] + if(it.size < 3){ + //设置item宽度为最大宽度180dp + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else if(it.size == 3){ + //设置item宽度为最大宽度180dp + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 120f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else if(it.size == 4){ + //设置item宽度为最大宽度180dp + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + }else{ + val params = ConstraintLayout.LayoutParams( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 90f, + context.resources.displayMetrics).toInt(), + ConstraintLayout.LayoutParams.WRAP_CONTENT) + holder.clRoadLayout.layoutParams = params + } + when(roadMsg.arrowType){ + //直行 + 201->{ + holder.ivRoadType.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_road_forward + )) + } + //直行或左转 + 202->{ + + } + //直行或右转 + 203->{ + + } + //直行或掉头 + 204->{ + + } + //左转 + 205->{ + + } + //左转或掉头 + 206->{ + + } + //左弯或向左合流 + 207->{ + + } + //右转 + 208->{ + + } + //右转或向右合流 + 209->{ + + } + //左右转弯 + 210->{ + + } + //掉头 + 211->{ + + } + //禁止左转 + 212->{ + + } + //禁止右转 + 213->{ + + } + //禁止掉头 + 214->{ + + } + //直行或左转或右转 + 215->{ + + } + //直行或掉头或左转 + 216->{ + + } + //右转或掉头 + 217->{ + + } + //禁止右转或向右合流 + 218->{ + + } + } + //是否是推荐车道 + if(roadMsg.isRecommend){ + holder.tvRoadStatus.text = context.getString(R.string.nde_road_recommend) + holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_recommend)) + holder.clRoadLayout.background = ContextCompat.getDrawable( + context, + R.drawable.bg_nde_road_recommend + ) + } + //是否有车龙,代表拥堵、行驶缓慢 + if(roadMsg.isCheLong){ + holder.tvRoadStatus.text = context.getString(R.string.nde_road_slow) + holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_slow)) + } + if(position == it.lastIndex){ + holder.viewDivider.visibility = View.INVISIBLE + } + } + } + + override fun getItemCount() = roadList?.size ?: 0 + + class PassengerRoadHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ + var clRoadLayout: ConstraintLayout = itemView.findViewById(R.id.clRoadLayout) + var ivRoadType: ImageView = itemView.findViewById(R.id.ivRoadType) + var tvRoadStatus: TextView = itemView.findViewById(R.id.tvRoadStatus) + var viewDivider: View = itemView.findViewById(R.id.viewDivider) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_road_forward.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_road_forward.png new file mode 100644 index 0000000000..968513dc7f Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_road_forward.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_msg_box_toast_nde.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_msg_box_toast_nde.png new file mode 100644 index 0000000000..28169aeaea Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_msg_box_toast_nde.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_nde_road_recommend.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_nde_road_recommend.xml new file mode 100644 index 0000000000..5055168409 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_nde_road_recommend.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_one.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_one.png new file mode 100644 index 0000000000..21dd9b8d2c Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_one.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_three.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_three.png new file mode 100644 index 0000000000..21dd9b8d2c Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_three.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_two.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_two.png new file mode 100644 index 0000000000..b4e6e33b69 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_recommend_two.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_road.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_road.xml new file mode 100644 index 0000000000..1173a22cdb --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_road.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/item_msg_toast_nde.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_nde.xml index c44a3b0348..8e5fcda9fc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_nde.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_toast_nde.xml @@ -2,9 +2,9 @@ @@ -16,6 +16,8 @@ app:layout_constraintLeft_toLeftOf="parent" android:src="@drawable/icon_nde" android:contentDescription="@string/msg_box_toast_icon" + android:layout_marginTop="@dimen/dp_50" + android:layout_marginStart="@dimen/dp_50" /> @@ -42,4 +45,14 @@ android:layout_marginTop="@dimen/dp_6" /> + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_nde_road.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_nde_road.xml new file mode 100644 index 0000000000..f74d45eac7 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_nde_road.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde.xml new file mode 100644 index 0000000000..da101ee8c3 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde_road.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde_road.xml new file mode 100644 index 0000000000..6b573f2f8d --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_nde_road.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 30aa0833f5..81f9c49d33 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -93,6 +93,11 @@ #131415 + #2EACFF + #FF852E + #666666 + #99FFFFFF + #FF4E41 #666666 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 647a91337f..e97f35b990 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 @@ -212,6 +212,9 @@ V2X图标 NDE图标 OTA图标 + NDE车道图标 + 推荐 + 缓慢 故障发生时间减少 故障发生时间增加