[dev_robotaxi-d_230412_2.15.0]增加订单回调+汇总消息过滤
This commit is contained in:
@@ -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.MsgBoxCountDownBean
|
||||
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.devatools.CallerDevaToolsManager
|
||||
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.DriverMsgBoxBubbleAdapter
|
||||
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
|
||||
@@ -30,7 +33,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,IOrderListener {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_bubble, this, true)
|
||||
@@ -42,6 +45,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
|
||||
private val TAG = "DriverMsgBoxBubbleView"
|
||||
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
|
||||
private var isShowData = true
|
||||
private var isShowSummary = false //是否展示汇总消息
|
||||
|
||||
private fun initView() {
|
||||
val linearLayoutManager = LinearLayoutManager(context)
|
||||
@@ -92,10 +96,15 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
|
||||
} else if(category == MsgCategory.SYS_INFO){
|
||||
//todo 过滤MAP系统异常报警
|
||||
} else{
|
||||
clMsgBubbleLayout.visibility = View.VISIBLE
|
||||
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
|
||||
dataList.add(msgBoxCountDownBean)
|
||||
driverMsgBoxBubbleAdapter?.setData(dataList)
|
||||
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
|
||||
//在一次订单中汇总消息只展示一次
|
||||
if(isShowSummary){
|
||||
showData(msgBoxBean)
|
||||
isShowSummary = false
|
||||
}
|
||||
}else{
|
||||
showData(msgBoxBean)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
@@ -104,11 +113,24 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
|
||||
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
|
||||
}
|
||||
|
||||
private fun showData(msgBoxBean: MsgBoxBean){
|
||||
clMsgBubbleLayout.visibility = View.VISIBLE
|
||||
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
|
||||
dataList.add(msgBoxCountDownBean)
|
||||
driverMsgBoxBubbleAdapter?.setData(dataList)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user