[6.9.0]消息盒子增加OTA升级消息

This commit is contained in:
xuxinchao
2024-12-31 11:19:40 +08:00
parent 183d821fe5
commit a8b8f4cee8
12 changed files with 363 additions and 2 deletions

View File

@@ -47,6 +47,7 @@ class MsgBoxTabAdapter(private val activity: Activity) :
private val autopilot = 20 //工控机连接消息
private val fsm = 21 //fsm消息
private val nde = 22 //NDE消息车龙
private val ota = 23 //OTA升级消息
private val none = -1
@@ -150,6 +151,12 @@ class MsgBoxTabAdapter(private val activity: Activity) :
.inflate(R.layout.item_tab_nde,parent,false)
return MsgBoxNDE(view)
}
//OTA消息
ota -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_tab_ota,parent,false)
return MsgBoxOTA(view)
}
//V2X消息
else -> {
val view = LayoutInflater.from(parent.context)
@@ -558,6 +565,15 @@ class MsgBoxTabAdapter(private val activity: Activity) :
holder.tvNdeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
//OTA升级消息
is MsgBoxOTA ->{
data?.let {
val otaMsg = it[position].bean as OTAMsg
holder.tvOTATitle.text = otaMsg.title
holder.tvOTAContent.text = otaMsg.des
holder.tvOTATime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
}
}
@@ -602,6 +618,8 @@ class MsgBoxTabAdapter(private val activity: Activity) :
fsm
} else if(data!![position].type == MsgBoxType.NDE){
nde
} else if(data!![position].type == MsgBoxType.OTA){
ota
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
@@ -717,4 +735,11 @@ class MsgBoxTabAdapter(private val activity: Activity) :
var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent)
}
//OTA升级
class MsgBoxOTA(itemView: View) : RecyclerView.ViewHolder(itemView){
var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle)
var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime)
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
}

View File

@@ -49,6 +49,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val fsm: Int = 9
private val none: Int = 10
private val nde: Int = 11
private val ota: Int = 12
private var changeViewListener: ChangeViewListener?=null
@@ -113,6 +114,10 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_nde,parent,false)
return BubbleNDEHolder(view)
}
ota -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_ota,parent,false)
return BubbleOTAHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
@@ -341,6 +346,15 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
holder.tvNDETime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}
}
//OTA升级消息
is BubbleOTAHolder -> {
data?.let {
val otaMsg = it[position].msgBoxBean.bean as OTAMsg
holder.tvOTATitle.text = otaMsg.title
holder.tvOTAContent.text = otaMsg.des
holder.tvOTATime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
@@ -398,6 +412,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
fsm
}else if(data!![position].msgBoxBean.type == MsgBoxType.NDE){
nde
}else if(data!![position].msgBoxBean.type == MsgBoxType.OTA){
ota
}
else {
v2x
@@ -497,6 +513,13 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvNDEContent: TextView = itemView.findViewById(R.id.tvNDEContent)
}
//OTA升级消息
class BubbleOTAHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle)
var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime)
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -50,6 +50,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
private val autopilot = 20 //工控机连接消息
private val fsm = 21 //fsm消息
private val nde = 22 //NDE消息
private val ota = 23 //OTA升级消息
private val none = -1
@@ -142,6 +143,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
.inflate(R.layout.item_msg_box_nde,parent,false)
return MsgBoxNde(view)
}
ota ->{
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_ota,parent,false)
return MsgBoxOta(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
@@ -725,6 +731,15 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
holder.tvNDETime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
//OTA消息
is MsgBoxOta -> {
data?.let {
val otaMsg = it[position].bean as OTAMsg
holder.tvOTATitle.text = otaMsg.title
holder.tvOTAContent.text = otaMsg.des
holder.tvOTATime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
}
}
@@ -769,6 +784,8 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
fsm
} else if(data!![position].type == MsgBoxType.NDE){
nde
} else if(data!![position].type == MsgBoxType.OTA){
ota
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
@@ -900,4 +917,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var tvNDEContent: TextView = itemView.findViewById(R.id.tvNDEContent)
}
//OTA
class MsgBoxOta(itemView: View) : RecyclerView.ViewHolder(itemView){
var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle)
var tvOTATime: TextView = itemView.findViewById(R.id.tvOTATime)
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.data.msgbox.NDEMsg
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.OTAMsg
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.data.msgbox.SSMMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -48,6 +49,7 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
private val v2x: Int = 2
private val report: Int = 3
private val nde: Int = 4
private val ota: Int = 5
fun setData(data: ArrayList<MsgBoxCountDownBean>){
@@ -72,6 +74,10 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_nde,parent,false)
BubbleNDEHolder(view)
}
ota -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_ota,parent,false)
BubbleOTAHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_v2x,parent,false)
BubbleV2XHolder(view)
@@ -146,6 +152,14 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
holder.tvNdeContent.text = ndeMsg.des
}
}
//OTA升级消息
is BubbleOTAHolder ->{
data?.let {
val otaMsg = it[position].msgBoxBean.bean as OTAMsg
holder.tvOTATitle.text = otaMsg.title
holder.tvOTAContent.text = otaMsg.des
}
}
//V2X消息
is BubbleV2XHolder -> {
data?.let {
@@ -323,6 +337,9 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
MsgBoxType.NDE ->{
nde
}
MsgBoxType.OTA ->{
ota
}
else -> {
v2x
}
@@ -367,4 +384,10 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
var tvNdeContent: TextView = itemView.findViewById(R.id.tvNdeContent)
}
//OTA升级消息
class BubbleOTAHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvOTATitle: TextView = itemView.findViewById(R.id.tvOTATitle)
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
}

View File

@@ -0,0 +1,66 @@
<?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="wrap_content"
android:minHeight="@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/ivOTAImage"
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_nde"
android:contentDescription="@string/ota_icon"
/>
<TextView
android:id="@+id/tvOTATitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvOTAContent"
app:layout_constraintLeft_toRightOf="@id/ivOTAImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_32"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
/>
<TextView
android:id="@+id/tvOTATime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvOTATitle"
app:layout_constraintBottom_toBottomOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="@dimen/sp_24"
/>
<TextView
android:id="@+id/tvOTAContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvOTATitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="@id/tvOTATime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/sp_28"
android:layout_marginBottom="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_5"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clOTALayout"
android:layout_width="@dimen/dp_804"
android:layout_height="wrap_content"
android:minHeight="@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/ivOTAImage"
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_nde"
android:contentDescription="@string/ota_icon"
/>
<TextView
android:id="@+id/tvOTATitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvOTAContent"
app:layout_constraintLeft_toRightOf="@id/ivOTAImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_32"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
/>
<TextView
android:id="@+id/tvOTATime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvOTATitle"
app:layout_constraintBottom_toBottomOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="@dimen/sp_24"
/>
<TextView
android:id="@+id/tvOTAContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvOTATitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="@id/tvOTATime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/sp_28"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clOTALayout"
android:layout_width="@dimen/dp_694"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_toast"
android:layout_gravity="center_horizontal"
>
<ImageView
android:id="@+id/ivOTAImage"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_nde"
android:contentDescription="@string/msg_box_toast_icon"
/>
<TextView
android:id="@+id/tvOTATitle"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/ivOTAImage"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="@dimen/dp_20"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_40"
/>
<TextView
android:id="@+id/tvOTAContent"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvOTATitle"
app:layout_constraintLeft_toLeftOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="parent"
android:textColor="@color/white"
android:textSize="@dimen/sp_32"
android:layout_marginTop="@dimen/dp_6"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dp_180"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ivOTAImage"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_30"
android:contentDescription="@string/ota_icon"
android:src="@drawable/icon_nde"
/>
<TextView
android:id="@+id/tvOTATitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivOTAImage"
app:layout_constraintLeft_toRightOf="@id/ivOTAImage"
android:layout_marginStart="@dimen/dp_30"
android:textSize="@dimen/sp_38"
android:textColor="@color/white"
android:textStyle="bold"
/>
<TextView
android:id="@+id/tvOTATime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvOTATitle"
app:layout_constraintBottom_toBottomOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="parent"
android:textSize="@dimen/sp_32"
android:textColor="#999999"
/>
<TextView
android:id="@+id/tvOTAContent"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvOTATitle"
app:layout_constraintLeft_toLeftOf="@id/tvOTATitle"
app:layout_constraintRight_toRightOf="@id/tvOTATime"
android:textSize="@dimen/sp_32"
android:textColor="#CCCCCC"
android:layout_marginTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_30"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -209,6 +209,7 @@
<string name="fsm_icon">FSM图标</string>
<string name="v2x_icon">V2X图标</string>
<string name="nde_icon">NDE图标</string>
<string name="ota_icon">OTA图标</string>
<string name="fault_time_reduce">故障发生时间减少</string>
<string name="fault_time_add">故障发生时间增加</string>