[6.3.0]消息盒子增加SSM和域控制器连接状态消息

This commit is contained in:
xuxinchao
2024-03-07 12:12:08 +08:00
parent ec327e2206
commit 5ef0e3807f
6 changed files with 355 additions and 4 deletions

View File

@@ -43,6 +43,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val report: Int = 4
private val summary: Int = 5
private val fm: Int = 6
private val ssm: Int = 7
private val autopilot: Int = 8
private val none: Int = 9
private var changeViewListener: ChangeViewListener?=null
@@ -91,6 +94,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_fm,parent,false)
return BubbleFmHolder(view)
}
ssm -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_ssm,parent,false)
return BubbleSsmHolder(view)
}
autopilot -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_autopilot,parent,false)
return BubbleAutopilotHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
@@ -262,6 +273,24 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
}
}
//SSM连接消息
is BubbleSsmHolder ->{
data?.let {
val ssmMsg = it[position].msgBoxBean.bean as SSMMsg
holder.tvSsmTitle.text = ssmMsg.title
holder.tvSsmContent.text= ssmMsg.content
holder.tvSsmTime.text = TimeUtils.millis2String(ssmMsg.timestamp,getHourMinFormat())
}
}
//域控制器连接消息
is BubbleAutopilotHolder ->{
data?.let {
val autopilotMsg = it[position].msgBoxBean.bean as AutopilotMsg
holder.tvAutopilotTitle.text = autopilotMsg.title
holder.tvAutopilotContent.text = autopilotMsg.content
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
@@ -311,7 +340,11 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
summary
}else if(data!![position].msgBoxBean.type == MsgBoxType.FMINFO){
fm
} else{
}else if(data!![position].msgBoxBean.type == MsgBoxType.SSMINFO){
ssm
}else if(data!![position].msgBoxBean.type == MsgBoxType.AUTOPILOT){
autopilot
} else {
v2x
}
}
@@ -378,6 +411,22 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvBubbleFmTime: TextView = itemView.findViewById(R.id.tvBubbleFmTime)
}
//SSM连接消息
class BubbleSsmHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivSsmImage: ImageView = itemView.findViewById(R.id.ivSsmImage)
var tvSsmTitle: TextView = itemView.findViewById(R.id.tvSsmTitle)
var tvSsmTime: TextView = itemView.findViewById(R.id.tvSsmTime)
var tvSsmContent: TextView = itemView.findViewById(R.id.tvSsmContent)
}
//域控制器连接状态消息
class BubbleAutopilotHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivAutopilotImage: ImageView = itemView.findViewById(R.id.ivAutopilotImage)
var tvAutopilotTitle: TextView = itemView.findViewById(R.id.tvAutopilotTitle)
var tvAutopilotTime: TextView = itemView.findViewById(R.id.tvAutopilotTime)
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -45,7 +45,12 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
private val fm: Int = 4 //FM信息
private val report: Int = 5 //系统信息
private val record: Int = 6 //录包
private val summary: Int = 8
private val summary: Int = 8 //汇总消息
private val ssm: Int = 9 //SSM连接消息
private val autopilot = 20 //工控机连接消息
private val none = -1
//Error
private val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
@@ -116,6 +121,16 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
.inflate(R.layout.item_msg_box_summary, parent, false)
return MsgBoxSummary(view)
}
ssm -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_ssm,parent,false)
return MsgBoxSsm(view)
}
autopilot -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_autopilot,parent,false)
return MsgBoxAutopilot(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
@@ -648,6 +663,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
}
}
}
//汇总消息
is MsgBoxSummary -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
@@ -656,6 +672,24 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
holder.tvSummaryContent.text = summaryMsg.content
}
}
//SSM连接状态消息
is MsgBoxSsm -> {
data?.let {
val ssmMsg = it[position].bean as SSMMsg
holder.tvSsmTitle.text = ssmMsg.title
holder.tvSsmContent.text = ssmMsg.content
holder.tvSsmTime.text = TimeUtils.millis2String(ssmMsg.timestamp,getHourMinFormat())
}
}
//域控制器连接状态消息
is MsgBoxAutopilot ->{
data?.let {
val autopilotMsg = it[position].bean as AutopilotMsg
holder.tvAutopilotTitle.text = autopilotMsg.title
holder.tvAutopilotContent.text = autopilotMsg.content
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
}
}
}
}
@@ -692,9 +726,14 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
record
} else if(data!![position].type == MsgBoxType.FMINFO){
fm
}
else {
} else if(data!![position].type == MsgBoxType.SSMINFO){
ssm
} else if(data!![position].type == MsgBoxType.AUTOPILOT){
autopilot
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
none
}
}
@@ -791,5 +830,20 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
//SSM连接状态
class MsgBoxSsm(itemView: View) : RecyclerView.ViewHolder(itemView){
var ivSsmImage: ImageView = itemView.findViewById(R.id.ivSsmImage)
var tvSsmTitle: TextView = itemView.findViewById(R.id.tvSsmTitle)
var tvSsmTime: TextView = itemView.findViewById(R.id.tvSsmTime)
var tvSsmContent: TextView = itemView.findViewById(R.id.tvSsmContent)
}
//域控制器连接状态
class MsgBoxAutopilot(itemView: View) : RecyclerView.ViewHolder(itemView){
var ivAutopilotImage: ImageView = itemView.findViewById(R.id.ivAutopilotImage)
var tvAutopilotTitle: TextView = itemView.findViewById(R.id.tvAutopilotTitle)
var tvAutopilotTime: TextView = itemView.findViewById(R.id.tvAutopilotTime)
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
}
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp">
<ImageView
android:id="@+id/ivAutopilotImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvAutopilotTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvAutopilotContent"
app:layout_constraintLeft_toRightOf="@id/ivAutopilotImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvAutopilotTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvAutopilotTitle"
app:layout_constraintBottom_toBottomOf="@id/tvAutopilotTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvAutopilotContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvAutopilotTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvAutopilotTitle"
app:layout_constraintRight_toRightOf="@id/tvAutopilotTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp">
<ImageView
android:id="@+id/ivSsmImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvSsmTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSsmContent"
app:layout_constraintLeft_toRightOf="@id/ivSsmImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvSsmTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSsmTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSsmTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvSsmContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvSsmTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvSsmTitle"
app:layout_constraintRight_toRightOf="@id/tvSsmTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clAutopilotLayout"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivAutopilotImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvAutopilotTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvAutopilotContent"
app:layout_constraintLeft_toRightOf="@id/ivAutopilotImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvAutopilotTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvAutopilotTitle"
app:layout_constraintBottom_toBottomOf="@id/tvAutopilotTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvAutopilotContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvAutopilotTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvAutopilotTitle"
app:layout_constraintRight_toRightOf="@id/tvAutopilotTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clSsmLayout"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivSsmImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvSsmTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSsmContent"
app:layout_constraintLeft_toRightOf="@id/ivSsmImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvSsmTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSsmTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSsmTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvSsmContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvSsmTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvSsmTitle"
app:layout_constraintRight_toRightOf="@id/tvSsmTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>