[8.1.0]云控基础平台消息接入

This commit is contained in:
xuxinchao
2025-06-11 10:59:25 +08:00
parent 6cf2dce10c
commit fcbb538919
19 changed files with 1093 additions and 3 deletions

View File

@@ -88,6 +88,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerCaptureImgManager
import com.mogo.eagle.core.function.call.devatools.CallerDiskCopyManager
import com.mogo.eagle.core.function.call.devatools.CallerNDECloudManager
import com.mogo.eagle.core.function.call.devatools.CallerV2XManager
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -1508,6 +1509,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
astFuncPojo: AstFuncPojo,
astFuncTlmInfo: AstFuncTlmInfo
) {
CallerNDECloudManager.onNdeCloudAstFuncTlm(astFuncPojo,astFuncTlmInfo)
}
/**
@@ -1522,6 +1524,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
advicePojo: AdvicePojo,
adviceGlosaInfo: AdviceGlosaInfo
) {
CallerNDECloudManager.onNdeCloudAdviceGlosa(advicePojo,adviceGlosaInfo)
}
/**
@@ -1545,6 +1548,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
advicePojo: AdvicePojo,
adviceComRsiInfo: AdviceComRsiInfo
) {
CallerNDECloudManager.onNdeCloudAdviceComRsi(advicePojo,adviceComRsiInfo)
}
/**
@@ -1559,6 +1563,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
advicePojo: AdvicePojo,
adviceEvwInfo: AdviceEvwInfo
) {
CallerNDECloudManager.onNdeCloudAdviceEvw(advicePojo,adviceEvwInfo)
}
/**
@@ -1573,6 +1578,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
advicePojo: AdvicePojo,
adviceLaneSpdLmtInfo: AdviceLaneSpdLmtInfo
) {
CallerNDECloudManager.onNdeCloudAdviceLaneSpdLmt(advicePojo,adviceLaneSpdLmtInfo)
}
/**
@@ -1587,6 +1593,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
advicePojo: AdvicePojo,
adviceAvwInfo: AdviceAvwInfo
) {
CallerNDECloudManager.onNdeCloudAdviceAvw(advicePojo,adviceAvwInfo)
}
/**

View File

@@ -167,7 +167,7 @@ object DataManager {
CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg)
}
MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION,MsgBoxType.OTA, MsgBoxType.NDE -> {
MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION,MsgBoxType.OTA, MsgBoxType.NDE,MsgBoxType.CLOUD -> {
synchronized(this) {
notifyList.add(msg)
}
@@ -381,6 +381,17 @@ object DataManager {
}
}
}
MsgBoxType.CLOUD.ordinal -> {
return@map MsgBoxBean(
MsgBoxType.CLOUD,
GsonUtils.fromJson(json,CloudControlMsg::class.java)
).apply {
this.timestamp = msgInfo.timeStamp
withContext(Dispatchers.Main) {
cacheNotifyList.add(this@apply)
}
}
}
else -> {
return@map null

View File

@@ -61,6 +61,7 @@ import com.zhjt.mogo_core_function_devatools.coldstart.ColdStartManager
import com.zhjt.mogo_core_function_devatools.driver.video.DriveSeatVideoProviderImpl
import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.zhjt.mogo_core_function_devatools.cloudcontrol.CloudControlManager
import com.zhjt.mogo_core_function_devatools.diskcopy.DiskCopyManager
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.exam.ExamControlManager
@@ -208,6 +209,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
ColdStartManager.init(mContext!!)
OTAUpgradeManager.init(mContext!!)
DiskCopyManager.init(mContext!!)
CloudControlManager.init(mContext!!)
if (DebugConfig.isDebug()) {
SdtManager.init(mContext!!, true, DetectResultImpl())
}

View File

@@ -0,0 +1,427 @@
package com.zhjt.mogo_core_function_devatools.cloudcontrol
import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.CloudControlMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.devatools.INDECloudListener
import com.mogo.eagle.core.function.call.devatools.CallerNDECloudManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.zhjt.mogo.adas.common.cloud.AdviceEvwType
import com.zhjt.mogo.adas.common.cloud.AdviceType
import com.zhjt.mogo.adas.data.bean.cloud.info.AdviceAvwInfo
import com.zhjt.mogo.adas.data.bean.cloud.info.AdviceComRsiInfo
import com.zhjt.mogo.adas.data.bean.cloud.info.AdviceEvwInfo
import com.zhjt.mogo.adas.data.bean.cloud.info.AdviceGlosaInfo
import com.zhjt.mogo.adas.data.bean.cloud.info.AdviceLaneSpdLmtInfo
import com.zhjt.mogo.adas.data.bean.cloud.info.AstFuncTlmInfo
import com.zhjt.mogo.adas.data.bean.cloud.pojo.AdvicePojo
import com.zhjt.mogo.adas.data.bean.cloud.pojo.AstFuncPojo
/**
* 云控基础平台信息管理
*/
object CloudControlManager: INDECloudListener{
const val TAG = "CloudControlManager"
fun init(context: Context){
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerNDECloudManager.addListener(TAG,this)
}
}
/**
* NDE下发 信号灯信息
* @param astFuncPojo 云端辅助功能信息
* @param astFuncTlmInfo 云端下发信号灯信息
*/
override fun onNdeCloudAstFuncTlm(astFuncPojo: AstFuncPojo, astFuncTlmInfo: AstFuncTlmInfo) {
}
/**
* NDE下发 信号灯路口车速引导功能指令
* @param advicePojo 实时决策建议
* @param adviceGlosaInfo 信号灯路口车速引导功能指令
*/
override fun onNdeCloudAdviceGlosa(advicePojo: AdvicePojo, adviceGlosaInfo: AdviceGlosaInfo) {
//绿波车速引导
if(adviceGlosaInfo.spdExpNum > 0){
val speedMin = adviceGlosaInfo.spdExps[0].spdMin*3.6
val speedMax = adviceGlosaInfo.spdExps[0].spdMax*3.6
val num = adviceGlosaInfo.spdExps[0].numIntersection
val desc = if(num ==0 || num == 255){
"建议车速${speedMin}km/h-${speedMax}km/h"
}else{
"建议车速${speedMin}km/h-${speedMax}km/h可绿灯通过前方${num}个路口"
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_GREEN_WAVE_SPEED.poiType,
EventTypeEnumNew.CLOUD_GREEN_WAVE_SPEED.poiTypeStr,
desc
)
)
)
}
}
/**
* NDE下发 通用 RSI 预警指令
* 包含:
* 闯红灯预警
* 行驶车道建议
* 交通拥堵提醒
* 道路危险状况提示
* 超视距弱势交通参与者提醒
* 路口其他车辆闯红灯预警
* 障碍物(路面遗撒)预警
* 能见度预警
* @param advicePojo 实时决策建议
* @param adviceComRsiInfo 通用RSI预警指令
*/
override fun onNdeCloudAdviceComRsi(
advicePojo: AdvicePojo,
adviceComRsiInfo: AdviceComRsiInfo
) {
if(adviceComRsiInfo.rsisNum > 0){
adviceComRsiInfo.rsis.forEach {
when(it.eventType){
//闯红灯预警
6011->{
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_RED_LIGHT_WARN.poiType,
EventTypeEnumNew.CLOUD_RED_LIGHT_WARN.poiTypeStr,
"存在闯红灯风险"
)
)
)
}
//行驶车道建议
6031,6032->{
if(it.adviceRsiLaneProposalInfo.tagLaneDataNum > 0){
var desc = "推荐车道:"
it.adviceRsiLaneProposalInfo.tagLaneData.forEach {lane->
desc += "${lane.tagLaneSeq}车道 "
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_SUGGEST_DRIVE_LANE.poiType,
EventTypeEnumNew.CLOUD_SUGGEST_DRIVE_LANE.poiTypeStr,
""
)
)
)
}
}
//交通拥堵提醒
6061->{
//eventLevel 2:拥堵; 3:重拥堵
if(it.adviceRsiTrafficJamInfo.eventLevel ==2 || it.adviceRsiTrafficJamInfo.eventLevel == 3){
val desc = "前方${it.adviceRsiTrafficJamInfo.queueLength}${it.adviceRsiTrafficJamInfo.roadIdNum}车道拥堵"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_TRAFFIC_REMIND.poiType,
EventTypeEnumNew.CLOUD_TRAFFIC_REMIND.poiTypeStr,
desc
)
)
)
}
}
//道路危险状况提示
6021,6022->{
if(it.adviceRsiRoadDangerHintInfo.valid == 1){
if(it.adviceRsiRoadDangerHintInfo.laneOfEventNum > 0){
var lane = ""
it.adviceRsiRoadDangerHintInfo.laneOfEvent.forEach {
lane += "${it}"
}
val desc = "前方${it.eventRadius}米有${getAlterType(it.adviceRsiRoadDangerHintInfo.alterType)},影响${lane}车道通行"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_DANGEROUS_ROAD_WARN.poiType,
EventTypeEnumNew.CLOUD_DANGEROUS_ROAD_WARN.poiTypeStr,
desc
)
)
)
}
}
}
//超视距弱势交通参与者提醒
6051->{
if(it.adviceRsiOverSightDistanceInfo.valid == 1){
val desc = "前方${it.adviceRsiOverSightDistanceInfo.distance}米有${getWeakType(it.adviceRsiOverSightDistanceInfo.type)}"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_BEYOND_VISUAL_RANGE.poiType,
EventTypeEnumNew.CLOUD_BEYOND_VISUAL_RANGE.poiTypeStr,
desc
)
)
)
}
}
//路口其他车辆闯红灯预警
6041->{
if(it.adviceRsiOtherCarBreakReadWarningInfo.valid == 1){
val desc = if(it.adviceRsiOtherCarBreakReadWarningInfo.d2StopLine == -1.0){
"路口内有他车闯红灯"
}else{
"路口前有他车闯红灯"
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_OTHER_VEHICLE_RED_LIGHT_WARN.poiType,
EventTypeEnumNew.CLOUD_OTHER_VEHICLE_RED_LIGHT_WARN.poiTypeStr,
desc
)
)
)
}
}
//障碍物(路面遗撒)预警
6081->{
if(it.adviceRsiAbandonInfo.valid == 1){
if(it.adviceRsiAbandonInfo.laneOfEventNum > 0){
var lane = ""
it.adviceRsiAbandonInfo.lanOfEvent.forEach {lan->
lane = "$lane${lan}车道"
}
val desc = "前方${it.adviceRsiAbandonInfo.distance}${lane}存在障碍物,影响${lane}通行"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_OBSTACLE_WARN.poiType,
EventTypeEnumNew.CLOUD_OBSTACLE_WARN.poiTypeStr,
desc
)
)
)
}
}
}
//能见度预警
6071->{
if(it.adviceRsiVisibilityInfo.valid == 1){
val desc = "当前能见度为${it.adviceRsiVisibilityInfo.visibilityDis}"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_VISIBILITY_WARN.poiType,
EventTypeEnumNew.CLOUD_VISIBILITY_WARN.poiTypeStr,
desc
)
)
)
}
}
}
}
}
}
/**
* NDE下发 紧急车辆预警指令
* @param advicePojo 实时决策建议
* @param adviceEvwInfo 紧急车辆预警指令
*/
override fun onNdeCloudAdviceEvw(advicePojo: AdvicePojo, adviceEvwInfo: AdviceEvwInfo) {
//紧急车辆优先通行 TODO 没有具体车道
if(adviceEvwInfo.valid == 1){
val desc = if(adviceEvwInfo.alertRadius == 6553.5){
"前方有${getVehicleType(adviceEvwInfo.type.desc)}"
}else{
"后方${adviceEvwInfo.alertRadius}米有${getVehicleType(adviceEvwInfo.type.desc)}"
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_PRIORITY_VEHICLE.poiType,
EventTypeEnumNew.CLOUD_PRIORITY_VEHICLE.poiTypeStr,
desc
)
)
)
}
}
/**
* NDE下发 动态车道级限速指令
* @param advicePojo 实时决策建议
* @param adviceLaneSpdLmtInfo 动态车道级限速指令
*/
override fun onNdeCloudAdviceLaneSpdLmt(
advicePojo: AdvicePojo,
adviceLaneSpdLmtInfo: AdviceLaneSpdLmtInfo
) {
//动态限速信息
if(adviceLaneSpdLmtInfo.valid == 1){
val desc = "道路限速${adviceLaneSpdLmtInfo.speedLmt[0].speedLimit}km/h"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_LIMIT_SPEED.poiType,
EventTypeEnumNew.CLOUD_LIMIT_SPEED.poiTypeStr,
desc
)
)
)
}
}
/**
* NDE下发 异常车辆预警指令
* @param advicePojo 实时决策建议
* @param adviceAvwInfo 异常车辆预警指令
*/
override fun onNdeCloudAdviceAvw(advicePojo: AdvicePojo, adviceAvwInfo: AdviceAvwInfo) {
//异常车辆预警
if(adviceAvwInfo.valid == 1){
val desc = "前方${adviceAvwInfo.distance}${adviceAvwInfo.rsiLaneId}车道存在异常车辆"
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.CLOUD,
CloudControlMsg(EventTypeEnumNew.CLOUD_ABNORMAL_VEHICLE_WARN.poiType,
EventTypeEnumNew.CLOUD_ABNORMAL_VEHICLE_WARN.poiTypeStr,
desc
)
)
)
}
}
/**
* 获取车辆类型
*/
private fun getVehicleType(type: String): String{
return when(type){
AdviceEvwType.AMBULANCE.desc->{
AdviceEvwType.AMBULANCE.desc
}
AdviceEvwType.POLICE_CAR.desc->{
AdviceEvwType.POLICE_CAR.desc
}
AdviceEvwType.FIRE_TRUCK.desc->{
AdviceEvwType.FIRE_TRUCK.desc
}
else->{
"应急车辆"
}
}
}
private fun getAlterType(alterType: Int): String{
return when(alterType){
5501->{
"行人提醒"
}
5502->{
"非机动车提醒"
}
5503->{
"紧急制动预警"
}
5504->{
"倒车预警"
}
5505->{
"逆行预警"
}
5506->{
"异常低速预警"
}
5507->{
"异常停车预警"
}
5508->{
"超速预"
}
5509->{
"交通拥堵预警"
}
5510->{
"特殊车辆预警"
}
5511->{
"紧急车辆预警"
}
5512->{
"车辆状态异常预警"
}
5513->{
"连续并道预警"
}
5514->{
"匝道退回主路预警"
}
5515->{
"交通管控预警"
}
5516->{
"路面低摩阻预警"
}
5517->{
"动态车道级限速预警"
}
5518->{
"障碍物提醒"
}
5519->{
"红绿灯故障预警"
}
5520->{
"弱势交通参与者预警"
}
5521->{
"闯红灯"
}
5522->{
"机动车压实线变道"
}
5523->{
"机动车不按导向标识行驶"
}
else->{
"预警"
}
}
}
/**
* 获取弱势交通参与者类型
*/
private fun getWeakType(type: Int): String{
return when(type){
0->{
"未知"
}
1->{
"行人"
}
2->{
"非机动车"
}
else->{
""
}
}
}
}

View File

@@ -48,6 +48,7 @@ class MsgBoxTabAdapter(private val activity: Activity) :
private val fsm = 21 //fsm消息
private val nde = 22 //NDE消息车龙
private val ota = 23 //OTA升级消息
private val cloud = 24 //云控基础平台
private val none = -1
@@ -157,6 +158,12 @@ class MsgBoxTabAdapter(private val activity: Activity) :
.inflate(R.layout.item_tab_ota,parent,false)
return MsgBoxOTA(view)
}
//云控基础平台
cloud -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_tab_cloud,parent,false)
return MsgBoxCloud(view)
}
//V2X消息
else -> {
val view = LayoutInflater.from(parent.context)
@@ -579,6 +586,17 @@ class MsgBoxTabAdapter(private val activity: Activity) :
}
}
}
//云控基础平台
is MsgBoxCloud->{
data?.let {
val cloudMsg = it[position].bean as CloudControlMsg
holder.ivCloudImage.setImageDrawable(ResourcesCompat.getDrawable
(activity.resources,EventTypeEnumNew.getUpdateIconRes(cloudMsg.msgType),null))
holder.tvCloudTitle.text = cloudMsg.title
holder.tvCloudContent.text = cloudMsg.des
holder.tvCloudTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
}
}
@@ -625,6 +643,8 @@ class MsgBoxTabAdapter(private val activity: Activity) :
nde
} else if(data!![position].type == MsgBoxType.OTA){
ota
} else if(data!![position].type == MsgBoxType.CLOUD){
cloud
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
@@ -748,4 +768,12 @@ class MsgBoxTabAdapter(private val activity: Activity) :
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
//云控基础平台
class MsgBoxCloud(itemView: View) : RecyclerView.ViewHolder(itemView){
var ivCloudImage: ImageView = itemView.findViewById(R.id.ivCloudImage)
var tvCloudTitle: TextView = itemView.findViewById(R.id.tvCloudTitle)
var tvCloudTime: TextView = itemView.findViewById(R.id.tvCloudTime)
var tvCloudContent: TextView = itemView.findViewById(R.id.tvCloudContent)
}
}

View File

@@ -50,6 +50,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val none: Int = 10
private val nde: Int = 11
private val ota: Int = 12
private val cloud: Int = 13 //云控基础平台
private var changeViewListener: ChangeViewListener?=null
@@ -118,6 +119,11 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_ota,parent,false)
return BubbleOTAHolder(view)
}
//云控基础平台
cloud -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_cloud,parent,false)
return BubbleCloudHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
@@ -360,6 +366,17 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
}
}
//云控基础平台消息
is BubbleCloudHolder -> {
data?.let {
val cloudMsg = it[position].msgBoxBean.bean as CloudControlMsg
holder.ivCloudImage.setImageDrawable(ResourcesCompat.getDrawable
(activity.resources,EventTypeEnumNew.getUpdateIconRes(cloudMsg.msgType),null))
holder.tvCloudTitle.text = cloudMsg.title
holder.tvCloudContent.text = cloudMsg.des
holder.tvCloudTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
@@ -419,6 +436,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
nde
}else if(data!![position].msgBoxBean.type == MsgBoxType.OTA){
ota
}else if(data!![position].msgBoxBean.type == MsgBoxType.CLOUD){
cloud
}
else {
v2x
@@ -526,6 +545,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvOTAContent: TextView = itemView.findViewById(R.id.tvOTAContent)
}
//云控基础平台消息
class BubbleCloudHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivCloudImage: ImageView = itemView.findViewById(R.id.ivCloudImage)
var tvCloudTitle: TextView = itemView.findViewById(R.id.tvCloudTitle)
var tvCloudTime: TextView = itemView.findViewById(R.id.tvCloudTime)
var tvCloudContent: TextView = itemView.findViewById(R.id.tvCloudContent)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -51,6 +51,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
private val fsm = 21 //fsm消息
private val nde = 22 //NDE消息
private val ota = 23 //OTA升级消息
private val cloud = 24 //云控基础平台
private val none = -1
@@ -148,6 +149,12 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
.inflate(R.layout.item_msg_box_ota,parent,false)
return MsgBoxOta(view)
}
//云控基础平台
cloud->{
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_cloud,parent,false)
return MsgBoxCloud(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
@@ -745,6 +752,17 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
}
}
}
//云控基础平台消息
is MsgBoxCloud -> {
data?.let {
val cloudMsg = it[position].bean as CloudControlMsg
holder.ivCloudImage.setImageDrawable(ResourcesCompat.getDrawable
(activity.resources,EventTypeEnumNew.getUpdateIconRes(cloudMsg.msgType),null))
holder.tvCloudTitle.text = cloudMsg.title
holder.tvCloudContent.text = cloudMsg.des
holder.tvCloudTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
}
}
}
}
@@ -791,6 +809,8 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
nde
} else if(data!![position].type == MsgBoxType.OTA){
ota
} else if(data!![position].type == MsgBoxType.CLOUD){
cloud
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
@@ -930,4 +950,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var ivOTAImage: ImageView = itemView.findViewById(R.id.ivOTAImage)
}
//云控基础平台
class MsgBoxCloud(itemView: View) : RecyclerView.ViewHolder(itemView){
var ivCloudImage: ImageView = itemView.findViewById(R.id.ivCloudImage)
var tvCloudTitle: TextView = itemView.findViewById(R.id.tvCloudTitle)
var tvCloudTime: TextView = itemView.findViewById(R.id.tvCloudTime)
var tvCloudContent: TextView = itemView.findViewById(R.id.tvCloudContent)
}
}

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.AutopilotMsg
import com.mogo.eagle.core.data.msgbox.CloudControlMsg
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.FSMMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
@@ -52,6 +53,7 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
private val report: Int = 3
private val nde: Int = 4
private val ota: Int = 5
private val cloud: Int = 6
fun setData(data: ArrayList<MsgBoxCountDownBean>){
@@ -80,6 +82,11 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_ota,parent,false)
BubbleOTAHolder(view)
}
//云控基础平台
cloud -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_cloud,parent,false)
BubbleCloudHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_v2x,parent,false)
BubbleV2XHolder(view)
@@ -176,6 +183,16 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
}
}
}
//云控基础平台消息
is BubbleCloudHolder->{
data?.let {
val cloudMsg = it[position].msgBoxBean.bean as CloudControlMsg
holder.ivCloudImage.setImageDrawable(ResourcesCompat.getDrawable
(activity.resources,EventTypeEnumNew.getUpdateIconRes(cloudMsg.msgType),null))
holder.tvCloudTitle.text = cloudMsg.title
holder.tvCloudContent.text = cloudMsg.des
}
}
//V2X消息
is BubbleV2XHolder -> {
data?.let {
@@ -356,6 +373,9 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
MsgBoxType.OTA ->{
ota
}
MsgBoxType.CLOUD ->{
cloud
}
else -> {
v2x
}
@@ -408,4 +428,10 @@ class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<
var ivOTAImage: ImageView = itemView.findViewById(R.id.ivOTAImage)
}
//云控基础平台
class BubbleCloudHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivCloudImage: ImageView = itemView.findViewById(R.id.ivCloudImage)
var tvCloudTitle: TextView = itemView.findViewById(R.id.tvCloudTitle)
var tvCloudContent: TextView = itemView.findViewById(R.id.tvCloudContent)
}
}

View File

@@ -0,0 +1,64 @@
<?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/ivCloudImage"
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"
/>
<TextView
android:id="@+id/tvCloudTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvCloudContent"
app:layout_constraintLeft_toRightOf="@id/ivCloudImage"
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/tvCloudTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvCloudTitle"
app:layout_constraintBottom_toBottomOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="@dimen/sp_24"
/>
<TextView
android:id="@+id/tvCloudContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvCloudTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="@id/tvCloudTime"
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,64 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clCloudLayout"
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/ivCloudImage"
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"
/>
<TextView
android:id="@+id/tvCloudTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvCloudContent"
app:layout_constraintLeft_toRightOf="@id/ivCloudImage"
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/tvCloudTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvCloudTitle"
app:layout_constraintBottom_toBottomOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="@dimen/sp_24"
/>
<TextView
android:id="@+id/tvCloudContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvCloudTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="@id/tvCloudTime"
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,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clCloudLayout"
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/ivCloudImage"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<TextView
android:id="@+id/tvCloudTitle"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/ivCloudImage"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="@dimen/dp_20"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_40"
/>
<TextView
android:id="@+id/tvCloudContent"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvCloudTitle"
app:layout_constraintLeft_toLeftOf="@id/tvCloudTitle"
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,54 @@
<?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/ivCloudImage"
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_14"
/>
<TextView
android:id="@+id/tvCloudTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/ivCloudImage"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_30"
android:textSize="@dimen/sp_38"
android:textColor="@color/white"
android:textStyle="bold"
/>
<TextView
android:id="@+id/tvCloudTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvCloudTitle"
app:layout_constraintBottom_toBottomOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="parent"
android:textSize="@dimen/sp_32"
android:textColor="#999999"
/>
<TextView
android:id="@+id/tvCloudContent"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvCloudTitle"
app:layout_constraintLeft_toLeftOf="@id/tvCloudTitle"
app:layout_constraintRight_toRightOf="@id/tvCloudTime"
android:textSize="@dimen/sp_32"
android:textColor="#CCCCCC"
android:layout_marginTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_30"
/>
</androidx.constraintlayout.widget.ConstraintLayout>