[Opt3.0]消息盒子

This commit is contained in:
xuxinchao
2023-01-31 16:56:57 +08:00
parent 5d8548e7ef
commit 0a10c1876c
17 changed files with 1007 additions and 420 deletions

View File

@@ -96,64 +96,16 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
override fun initViews() {
//todo 新超,封装至消息盒子
cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewDriverMsgBoxList.visibility = View.VISIBLE
viewDriverMsgBoxList.notifyData()
viewDriverMsgBoxBubble.visibility = View.GONE
viewDriverMsgBoxBubble.isShowData(false)
CallerHmiManager.updateDriverMsgBoxTipView(false)
} else {
viewDriverMsgBoxList.visibility = View.GONE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
viewDriverMsgBoxBubble.isShowData(true)
}
}
//todo 新超,封装至消息盒子
cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewPassengerMsgBoxList.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.GONE
viewPassengerMsgBoxBubble.isShowData(false)
CallerHmiManager.updatePassengerMsgBoxTipView(false)
} else {
viewPassengerMsgBoxList.visibility = View.GONE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.isShowData(true)
}
}
//todo 加载端自己控制 --- 新超 本期我们设置到bustaxisweep Fragment
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
cbMsgBoxDriver.visibility = View.VISIBLE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
) {
cbMsgBoxPassenger.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
}
}
// todo 新超
override fun updateDriverMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxTipView.visibility = View.VISIBLE
} else {
MsgBoxTipView.visibility = View.GONE
}
}
// todo 新超
override fun updatePassengerMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxPTipView.visibility = View.VISIBLE
} else {
MsgBoxPTipView.visibility = View.GONE
}
}
/** todo ----------------------------------------------**/

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 消息盒子司机端视图切换按钮
* @since: 2023/1/31
*/
class DriverMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
):ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "DriverMsgBoxButtonView"
}
init{
LayoutInflater.from(context).inflate(R.layout.view_driver_msg_box_button, this, true)
initView()
}
private fun initView(){
}
}

View File

@@ -45,7 +45,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null
private fun initView() {
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context)
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity)
rvMsgBoxList.adapter = driverMsgBoxListAdapter
rvMsgBoxList.layoutManager = LinearLayoutManager(context)
@@ -171,13 +171,21 @@ class DriverMsgBoxListView @JvmOverloads constructor(
when (category) {
MsgCategory.NOTICE -> {
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.SYS_INFO -> {
ipcReportList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 1){
ipcReportList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.RECORD_BAG -> {
badCaseList?.add(0,msgBoxList)
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
if(MsgBoxConfig.getUserRecord() == 2){
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
}
}

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 消息盒子乘客端视图切换按钮
* @since: 2023/1/31
*/
class PassengerMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "PassengerMsgBoxButtonView"
}
init{
LayoutInflater.from(context).inflate(R.layout.view_passenger_msg_box_button, this, true)
initView()
}
private fun initView(){
}
}

View File

@@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
@@ -33,6 +34,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val notice: Int = 2
private val v2x: Int = 3
private val report: Int = 4
private val summary: Int = 5
var countDownTimer: CountDownTimer?=null
private var changeViewListener: ChangeViewListener?=null
@@ -46,91 +48,107 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
when (viewType) {
operation -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_summary,parent,false)
return BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleOperationHolder){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
}
}else if(holder is BubbleReportHolder){
data?.let {
val reportEntity = it[position].bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
when (holder) {
is BubbleOperationHolder -> {
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
}
holder.tvBubbleReportType.text = resultStr
}
}else if(holder is BubbleNoticeHolder){
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
is BubbleReportHolder -> {
data?.let {
val reportEntity = it[position].bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
holder.tvBubbleReportType.text = resultStr
}
}
is BubbleNoticeHolder -> {
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
@@ -155,14 +173,16 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.OPERATION){
return operation
return if(data!![position].type == MsgBoxType.OPERATION){
operation
}else if(data!![position].type == MsgBoxType.REPORT){
return report
report
}else if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -195,6 +215,12 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -10,6 +9,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
@@ -28,201 +28,263 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
* @description 司机端消息盒子列表视图RecyclerView适配器
* @since: 2022/11/25
*/
class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
class DriverMsgBoxListAdapter(private val activity: Activity) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: List<MsgBoxBean> ?= null
private var data: List<MsgBoxBean>? = null
private val operation: Int = 1
private val notice: Int = 2
private val v2x: Int = 3
private val obu: Int = 4
private val report: Int = 5
private val record: Int = 6
private val traffic: Int = 7
private val summary: Int = 8
companion object{
//Error
private const val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
private const val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
private const val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
}
//Error
val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
fun setData(data: List<MsgBoxBean>){
fun setData(data: List<MsgBoxBean>) {
this.data = data
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == record){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_bad_case,parent,false)
return BadCaseHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_ipc_report,parent,false)
return MsgBoxIpcReportHolder(view)
}else if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_operation,parent,false)
return MsgBoxOperation(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_notice,parent,false)
return MsgBoxNotice(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_v2x,parent,false)
return MsgBoxV2X(view)
when (viewType) {
record -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bad_case, parent, false)
return BadCaseHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_ipc_report, parent, false)
return MsgBoxIpcReportHolder(view)
}
operation -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_operation, parent, false)
return MsgBoxOperation(view)
}
notice -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_notice, parent, false)
return MsgBoxNotice(view)
}
summary -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_summary, parent, false)
return MsgBoxSummary(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
return MsgBoxV2X(view)
}
}
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BadCaseHolder){
data?.let {
holder.tvBagReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBagRecordTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,false)
}
}
}else if(holder is MsgBoxIpcReportHolder){
data?.let { it ->
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if(reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)){
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
}else{
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList){
actionStr = "${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if(holder.tvReportLevelNormal.isVisible){
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
}else{
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
when (holder) {
is BadCaseHolder -> {
data?.let {
holder.tvBagReceiveTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvBagRecordTime.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean, activity, false)
}
}
}
}else if(holder is MsgBoxOperation){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text = TimeUtils.millis2String(operationMsg.timestamp,getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if(holder.ivOperationImageNormal.isVisible){
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
is MsgBoxIpcReportHolder -> {
data?.let { it ->
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if (reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)
) {
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
} else {
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList) {
resultStr =
"${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList) {
actionStr =
"${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if (holder.tvReportLevelNormal.isVisible) {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
}else{
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
} else {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxNotice){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(context).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(context).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
is MsgBoxOperation -> {
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text =
TimeUtils.millis2String(operationMsg.timestamp, getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if (holder.ivOperationImageNormal.isVisible) {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
} else {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxV2X){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
holder.ivV2XImage.setImageDrawable(context.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(context.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
is MsgBoxNotice -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if (noticeFrCloudMsg.type == 0) {
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
} else if (noticeFrCloudMsg.type == 1) {
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl)
.optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 ->
CallerHmiManager.showTrafficBanner(
it1
)
}
}
}
}
}
is MsgBoxV2X -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))
)
}
}
is MsgBoxSummary -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
@@ -232,26 +294,30 @@ class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapt
override fun getItemViewType(position: Int): Int {
return when(data!![position].type){
MsgBoxType.OPERATION -> operation
MsgBoxType.NOTICE -> notice
MsgBoxType.V2X -> v2x
MsgBoxType.OBU -> obu
MsgBoxType.REPORT -> report
MsgBoxType.RECORD -> record
MsgBoxType.TRAFFIC -> traffic
}
return if (data!![position].type == MsgBoxType.OPERATION) {
operation
} else if (data!![position].type == MsgBoxType.NOTICE) {
notice
} else if (data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY) {
summary
} else if (data!![position].type == MsgBoxType.REPORT) {
report
} else if (data!![position].type == MsgBoxType.RECORD) {
record
} else {
v2x
}
}
//录包实体
class BadCaseHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBagRecordTime: TextView= itemView.findViewById(R.id.tvBagRecordTime)
class BadCaseHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvBagRecordTime: TextView = itemView.findViewById(R.id.tvBagRecordTime)
var tvBagReceiveTime: TextView = itemView.findViewById(R.id.tvBagReceiveTime)
var tvRecordCheck: TextView = itemView.findViewById(R.id.tvRecordCheck)
}
//车辆系统信息
class MsgBoxIpcReportHolder(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxIpcReportHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivReportImageNormal: ImageView = itemView.findViewById(R.id.ivReportImageNormal)
var tvReportLevelNormal: TextView = itemView.findViewById(R.id.tvReportLevelNormal)
var tvReportTimeNormal: TextView = itemView.findViewById(R.id.tvReportTimeNormal)
@@ -267,10 +333,11 @@ class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapt
}
//运营平台
class MsgBoxOperation(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxOperation(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivOperationImageNormal: ImageView = itemView.findViewById(R.id.ivOperationImageNormal)
var tvOperationTitleNormal: TextView = itemView.findViewById(R.id.tvOperationTitleNormal)
var tvOperationContentNormal: TextView = itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationContentNormal: TextView =
itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationStatusSelect: TextView = itemView.findViewById(R.id.tvOperationStatusSelect)
var tvOperationTime: TextView = itemView.findViewById(R.id.tvOperationTime)
var ivOperationImageOpen: ImageView = itemView.findViewById(R.id.ivOperationImageOpen)
@@ -279,7 +346,7 @@ class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapt
}
//Notice
class MsgBoxNotice(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxNotice(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivNoticeImage: ImageView = itemView.findViewById(R.id.ivNoticeImage)
var tvNoticeTitle: TextView = itemView.findViewById(R.id.tvNoticeTitle)
var tvNoticeTime: TextView = itemView.findViewById(R.id.tvNoticeTime)
@@ -288,11 +355,17 @@ class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapt
}
//V2X,OBU
class MsgBoxV2X(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxV2X(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage)
var tvV2XTime: TextView = itemView.findViewById(R.id.tvV2XTime)
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
//汇总消息
class MsgBoxSummary(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
}

View File

@@ -8,15 +8,14 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
@@ -32,6 +31,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
var countDownTimer: CountDownTimer?=null
@@ -44,65 +44,83 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
return BubbleV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_summary,parent,false)
BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeListener()
}
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
@@ -123,10 +141,12 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -146,4 +166,11 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -7,12 +7,11 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
@@ -30,6 +29,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
fun setData(data: List<MsgBoxBean>){
this.data = data
@@ -37,73 +37,92 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_summary,parent,false)
ListSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is ListNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
when (holder) {
is ListNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is ListV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
is ListV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}
}
is ListSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeListener()
}
}
}
}
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -123,4 +142,11 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
}
//汇总消息
class ListSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -0,0 +1,64 @@
<?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="804dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#53000000"
app:roundLayoutRadius="24dp"
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/ivSummaryImage"
android:layout_width="140dp"
android:layout_height="130dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="15dp"
android:src="@drawable/icon_notice_default"
/>
<TextView
android:id="@+id/tvSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="32dp"
app:layout_constraintLeft_toRightOf="@id/ivSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSummaryContent"
android:layout_marginStart="15dp"
/>
<TextView
android:id="@+id/tvSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvSummaryTime"
android:gravity="start"
android:textColor="#B3FFFFFF"
android:textSize="28dp"
/>
<TextView
android:id="@+id/tvSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?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="804dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#53000000"
app:roundLayoutRadius="24dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivSummaryImage"
android:layout_width="140dp"
android:layout_height="130dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="15dp"
android:src="@drawable/icon_notice_default"
/>
<TextView
android:id="@+id/tvSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="32dp"
app:layout_constraintLeft_toRightOf="@id/ivSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSummaryContent"
android:layout_marginStart="15dp"
/>
<TextView
android:id="@+id/tvSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvSummaryTime"
android:gravity="start"
android:textColor="#B3FFFFFF"
android:textSize="28dp"
/>
<TextView
android:id="@+id/tvSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,83 @@
<?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="650dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#465878"
app:roundLayoutRadius="24dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
>
<ImageView
android:id="@+id/ivPassengerSummaryImage"
android:layout_width="160dp"
android:layout_height="160dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_passenger_operation"
/>
<TextView
android:id="@+id/tvPassengerSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="36dp"
android:layout_marginStart="20dp"
app:layout_constraintLeft_toRightOf="@id/ivPassengerSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvPassengerSummaryContent"
/>
<TextView
android:id="@+id/tvPassengerSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvPassengerSummaryTitle"
app:layout_constraintTop_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvPassengerSummaryTime"
android:gravity="start"
/>
<TextView
android:id="@+id/tvPassengerSummaryCheck"
android:layout_width="140dp"
android:layout_height="160dp"
android:text="查 看"
android:textColor="#FF84D4FF"
android:textSize="28dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
/>
<View
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#5E70A6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
/>
<TextView
android:id="@+id/tvPassengerSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="26dp"
app:layout_constraintTop_toTopOf="@id/tvPassengerSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
android:layout_marginEnd="20dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,78 @@
<?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="150dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ivPassengerSummaryImage"
android:layout_width="96dp"
android:layout_height="96dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_passenger_operation"
/>
<TextView
android:id="@+id/tvPassengerSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="36dp"
android:layout_marginStart="20dp"
app:layout_constraintLeft_toRightOf="@id/ivPassengerSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvPassengerSummaryContent"
/>
<TextView
android:id="@+id/tvPassengerSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintLeft_toLeftOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvPassengerSummaryTime"
android:gravity="start"
/>
<TextView
android:id="@+id/tvPassengerSummaryCheck"
android:layout_width="140dp"
android:layout_height="150dp"
android:text="查 看"
android:textColor="#FF84D4FF"
android:textSize="28dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
/>
<View
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#5E70A6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
/>
<TextView
android:id="@+id/tvPassengerSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="26dp"
app:layout_constraintTop_toTopOf="@id/tvPassengerSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
android:layout_marginEnd="20dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_height="150dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--消息盒子司机端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxDriver"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/selector_msg_box"
android:button="@null"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
<!--司机端消息提示-->
<View
android:id="@+id/MsgBoxTipView"
android:layout_width="8dp"
android:layout_height="8dp"
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/cbMsgBoxDriver"
app:layout_constraintCircleAngle="40"
app:layout_constraintCircleRadius="32dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--消息盒子乘客端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxPassenger"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/selector_msg_box_p"
android:button="@null"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--乘客端消息提示-->
<View
android:id="@+id/MsgBoxPTipView"
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/cbMsgBoxPassenger"
app:layout_constraintCircleAngle="40"
app:layout_constraintCircleRadius="50dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>