[dev_robotaxi-d_230412_2.15.0]汇总消息过滤

This commit is contained in:
xuxinchao
2023-04-20 18:33:23 +08:00
parent a339ccfb1d
commit 4b3db42de1
4 changed files with 86 additions and 16 deletions

View File

@@ -87,23 +87,26 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
}
}
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(category == MsgCategory.RECORD_BAG){
if(!FunctionBuildConfig.isDemoMode){
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
} else if(category == MsgCategory.SYS_INFO){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
//todo 过滤MAP系统异常报警
} else{
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
//在一次订单中汇总消息只展示一次
if(isShowSummary){
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
isShowSummary = false
}
}else{
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
}
}

View File

@@ -8,13 +8,16 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxListAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -34,7 +37,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true)
@@ -47,6 +51,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null
private var linearLayoutManager: LinearLayoutManager ?= null
private var isShowSummary = false //是否展示汇总消息
private fun initView() {
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity)
rvMsgBoxList.adapter = driverMsgBoxListAdapter
@@ -174,9 +180,20 @@ class DriverMsgBoxListView @JvmOverloads constructor(
UiThreadHandler.post({
when (category) {
MsgCategory.NOTICE -> {
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
if(msgBoxList.sourceType == DataSourceType.SUMMARY){
//在一次订单中汇总消息只展示一次
if(isShowSummary){
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
isShowSummary = false
}
}else{
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
}
MsgCategory.SYS_INFO -> {
@@ -199,6 +216,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
EventBus.getDefault().register(this)
}
@@ -206,6 +224,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@@ -249,4 +268,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
driverMsgBoxListAdapter?.setReportShowData(msgBoxBean)
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -6,13 +6,16 @@ import android.util.AttributeSet
import android.view.*
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -28,12 +31,13 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IOrderListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var passengerMsgBoxBubbleAdapter: PassengerMsgBoxBubbleAdapter ?= null
private var isShowData = true
private var isShowSummary = false //是否展示汇总消息
init {
LayoutInflater.from(context).inflate(R.layout.layout_passenger_msg_box_bubble, this, true)
@@ -61,26 +65,44 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxList)
dataList.add(msgBoxCountDownBean)
passengerMsgBoxBubbleAdapter?.setData(dataList)
if(msgBoxList.sourceType == DataSourceType.SUMMARY){
//在一次订单中汇总消息只展示一次
if(isShowSummary){
operationalData(msgBoxList)
isShowSummary = false
}
}else{
operationalData(msgBoxList)
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
private fun operationalData(msgBoxList: MsgBoxBean){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxList)
dataList.add(msgBoxCountDownBean)
passengerMsgBoxBubbleAdapter?.setData(dataList)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -7,14 +7,17 @@ import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxListAdapter
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
@@ -30,11 +33,13 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
private val TAG = "PassengerMsgBoxListView"
var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null
private var noticeList: ArrayList<MsgBoxBean> ?= null
private var isShowSummary = false //是否展示汇总消息
init{
LayoutInflater.from(context).inflate(R.layout.layout_passenger_msg_box_list, this, true)
@@ -64,9 +69,20 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
noticeList?.add(0,msgBoxList)
noticeList?.let {
passengerMsgBoxListAdapter?.setData(it)
if(msgBoxList.sourceType == DataSourceType.SUMMARY){
//在一次订单中汇总消息只展示一次
if(isShowSummary){
noticeList?.add(0,msgBoxList)
noticeList?.let {
passengerMsgBoxListAdapter?.setData(it)
}
isShowSummary = false
}
}else{
noticeList?.add(0,msgBoxList)
noticeList?.let {
passengerMsgBoxListAdapter?.setData(it)
}
}
}
}
@@ -77,12 +93,14 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -107,4 +125,8 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}