[6.10.0]数据上车-消息盒子车龙消息增加车道展示

This commit is contained in:
xuxinchao
2025-02-17 16:19:39 +08:00
parent 7d53169242
commit a322b609f7
24 changed files with 688 additions and 13 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
}
}

View File

@@ -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)

View File

@@ -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<MsgBoxCountDownBean>){
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)
}
}

View File

@@ -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<Re
private val notice: Int = 1
private val v2x: Int = 2
private val operation: Int = 3
private val nde: Int = 4
fun setData(data: ArrayList<MsgBoxCountDownBean>){
@@ -43,6 +45,10 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_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_box_v2x,parent,false)
BubbleV2XHolder(view)
@@ -85,6 +91,21 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
holder.tvMV2XTitle.text = EventTypeEnumNew.getEventTitle(v2XMsg.type)
}
}
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]
@@ -114,6 +135,9 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
MsgBoxType.OPERATION -> {
operation
}
MsgBoxType.NDE -> {
nde
}
else -> {
v2x
}
@@ -142,5 +166,12 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
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)
}
}

View File

@@ -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
@@ -31,6 +32,7 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
private val v2x: Int = 2
private val summary: Int = 3
private val operation: Int = 4
private val nde: Int = 5
fun setData(data: ArrayList<MsgBoxCountDownBean>){
@@ -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)
}
}

View File

@@ -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升级消息

View File

@@ -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<NDERoadAdapter.RoadHolder>() {
private var roadList: List<NDEMsg.RoadMsg> ?= null
fun setData(list: List<NDEMsg.RoadMsg>){
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)
}
}

View File

@@ -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<MsgBoxCountDownBean>){
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)
}
}

View File

@@ -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<PassengerNDERoadAdapter.PassengerRoadHolder>() {
private var roadList: List<NDEMsg.RoadMsg> ?= null
fun setData(list: List<NDEMsg.RoadMsg>){
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)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#991466FB"
android:endColor="#001466FB"
android:angle="270"
/>
<corners
android:radius="@dimen/dp_0"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<size android:height="@dimen/dp_5" />
</shape>

View File

@@ -2,9 +2,9 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clV2XLayout"
android:layout_width="@dimen/dp_694"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_439"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_toast"
android:background="@drawable/bg_msg_box_toast_nde"
android:layout_gravity="center_horizontal"
>
@@ -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"
/>
<TextView
@@ -26,6 +28,7 @@
app:layout_constraintLeft_toRightOf="@id/ivNdeImage"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_59"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_40"
/>
@@ -42,4 +45,14 @@
android:layout_marginTop="@dimen/dp_6"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvRoadList"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_197"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivNdeImage"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clRoadLayout"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_197"
android:minWidth="@dimen/dp_90"
android:maxWidth="@dimen/dp_180"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ImageView
android:id="@+id/ivRoadType"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/nde_road_icon"
/>
<TextView
android:id="@+id/tvRoadStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivRoadType"
android:textSize="@dimen/sp_36"
android:layout_marginTop="@dimen/dp_14"
/>
<View
android:id="@+id/viewDivider"
android:layout_width="@dimen/dp_2"
android:layout_height="@dimen/dp_0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@color/msg_nde_road_divider"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_229"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#E3ECFE"
app:roundLayoutRadius="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12"
>
<ImageView
android:id="@+id/ivNdeImage"
android:layout_width="@dimen/dp_96"
android:layout_height="@dimen/dp_96"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_nde"
android:contentDescription="@string/nde_icon"
/>
<TextView
android:id="@+id/tvNdeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/ivNdeImage"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginStart="@dimen/dp_10"
android:textColor="#FF203555"
android:textSize="@dimen/dp_18"
/>
<TextView
android:id="@+id/tvNdeContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvNdeTitle"
app:layout_constraintLeft_toLeftOf="@id/tvNdeTitle"
android:layout_marginTop="@dimen/dp_4"
android:textColor="#CC203555"
android:textSize="@dimen/sp_14"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvNdeList"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivNdeImage"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clRoadLayout"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_120"
android:minWidth="@dimen/dp_90"
android:maxWidth="@dimen/dp_180"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ImageView
android:id="@+id/ivRoadType"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/nde_road_icon"
/>
<TextView
android:id="@+id/tvRoadStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivRoadType"
android:textSize="@dimen/sp_18"
android:layout_marginTop="@dimen/dp_12"
/>
<View
android:id="@+id/viewDivider"
android:layout_width="@dimen/dp_2"
android:layout_height="@dimen/dp_0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@color/msg_nde_road_passenger_divider"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -93,6 +93,11 @@
<color name="auto_exploration_content_p">#131415</color>
<color name="msg_nde_road_recommend">#2EACFF</color>
<color name="msg_nde_road_slow">#FF852E</color>
<color name="msg_nde_road_divider">#666666</color>
<color name="msg_nde_road_passenger_divider">#99FFFFFF</color>
<color name="cold_start_fail">#FF4E41</color>
<color name="color_disk_copy_date">#666666</color>

View File

@@ -212,6 +212,9 @@
<string name="v2x_icon">V2X图标</string>
<string name="nde_icon">NDE图标</string>
<string name="ota_icon">OTA图标</string>
<string name="nde_road_icon">NDE车道图标</string>
<string name="nde_road_recommend">推荐</string>
<string name="nde_road_slow">缓慢</string>
<string name="fault_time_reduce">故障发生时间减少</string>
<string name="fault_time_add">故障发生时间增加</string>