From 0d2e5877a538bb786cc19158340d3b2bf83d6674 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Mon, 5 Dec 2022 15:49:14 +0800 Subject: [PATCH] =?UTF-8?q?[2.13.0]fix=E6=B6=88=E6=81=AF=E7=9B=92=E5=AD=90?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE=E9=87=8D=E5=A4=8D=E5=92=8C?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badcase/biz/AIDataCollectWindow.kt | 6 +-- .../badcase/biz/InitiativeBadCaseWindow.kt | 8 +-- .../core/function/hmi/ui/MoGoHmiFragment.kt | 1 - .../hmi/ui/msgbox/DriverMsgBoxListView.kt | 53 +++++++++++++++---- .../hmi/ui/msgbox/PassengerMsgBoxListView.kt | 45 ++++++++++++---- 5 files changed, 86 insertions(+), 27 deletions(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt index f692c0d90a..499e30d784 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt @@ -300,14 +300,14 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener mInViewY = motionEvent.y // 获取相对屏幕的坐标,即以屏幕左上角为原点 mDownInScreenX = motionEvent.rawX - mDownInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mDownInScreenY = motionEvent.rawY mInScreenX = motionEvent.rawX - mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mInScreenY = motionEvent.rawY } MotionEvent.ACTION_MOVE -> { // 更新浮动窗口位置参数 mInScreenX = motionEvent.rawX - mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mInScreenY = motionEvent.rawY mWindowParams!!.x = (mInScreenX - mInViewX).toInt() mWindowParams!!.y = (mInScreenY - mInViewY).toInt() // 手指移动的时候更新小悬浮窗的位置 diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt index 6518eb66ac..8f2f8cdda3 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt @@ -315,14 +315,14 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList mInViewY = motionEvent.y // 获取相对屏幕的坐标,即以屏幕左上角为原点 mDownInScreenX = motionEvent.rawX - mDownInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mDownInScreenY = motionEvent.rawY mInScreenX = motionEvent.rawX - mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mInScreenY = motionEvent.rawY } MotionEvent.ACTION_MOVE -> { // 更新浮动窗口位置参数 mInScreenX = motionEvent.rawX - mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight() + mInScreenY = motionEvent.rawY mWindowParams!!.x = (mInScreenX - mInViewX).toInt() mWindowParams!!.y = (mInScreenY - mInViewY).toInt() // 手指移动的时候更新小悬浮窗的位置 @@ -338,7 +338,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList // 默认固定位置,靠屏幕右边缘的中间 mWindowManager!!.defaultDisplay.getMetrics(metrics) mWindowParams!!.x = metrics.widthPixels - mWindowParams!!.y = metrics.heightPixels / 2 - BarUtils.getStatusBarHeight()-350 + mWindowParams!!.y = metrics.heightPixels / 2 - BarUtils.getStatusBarHeight()-950 mWindowManager!!.addView(mFloatLayout, mWindowParams) //开启录包 if(recordCaseEntity!=null){ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index b7d7139a43..984e95b476 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -270,7 +270,6 @@ class MoGoHmiFragment : MvpFragment(), if(isChecked){ viewPassengerMsgBoxList.visibility = View.VISIBLE viewPassengerMsgBoxBubble.visibility = View.GONE - viewPassengerMsgBoxList.notifyData() viewPassengerMsgBoxBubble.isShowData(false) CallerHmiManager.updatePassengerMsgBoxTipView(false) }else{ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt index a4606ebcd6..554403778b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt @@ -3,15 +3,24 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox import android.app.Activity import android.content.Context import android.util.AttributeSet +import android.util.Log import android.view.LayoutInflater 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.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.data.msgbox.OperationMsg +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager 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 +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.* /** @@ -23,13 +32,13 @@ class DriverMsgBoxListView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr){ +) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener { init { LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true) initView() } - + private val TAG = "DriverMsgBoxListView" private var noticeList: ArrayList ?= null private var ipcReportList: ArrayList ?= null private var badCaseList: ArrayList ?= null @@ -42,10 +51,13 @@ class DriverMsgBoxListView @JvmOverloads constructor( //获取通知消息列表 noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList? + noticeList = noticeList?.let { ArrayList(it.reversed()) } //获取车辆系统信息列表 ipcReportList = CallerMsgBoxManager.getCachedSysInfoData() as ArrayList? + ipcReportList = ipcReportList?.let { ArrayList(it.reversed()) } //获取录包信息列表 badCaseList = CallerMsgBoxManager.getCachedRecordBagData() as ArrayList? + badCaseList = badCaseList?.let { ArrayList(it.reversed()) } //通知 tvMsgNotice.setOnClickListener { tvMsgNotice.setTextColor(resources.getColor(R.color.msg_box_title_color)) @@ -103,14 +115,6 @@ class DriverMsgBoxListView @JvmOverloads constructor( } fun notifyData(){ - val localNoticeList = MsgBoxConfig.noticeList.reversed() - noticeList?.addAll(0,localNoticeList) - val localSysInfoList = MsgBoxConfig.systemInfoList.reversed() - ipcReportList?.addAll(0,localSysInfoList) - val localRecordList = MsgBoxConfig.recordBagList.reversed() - - badCaseList?.addAll(0,localRecordList) - //获取当前Tab选择 when(MsgBoxConfig.getUserRecord()){ 0 ->{ @@ -162,6 +166,35 @@ class DriverMsgBoxListView @JvmOverloads constructor( } + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post{ + when (category) { + MsgCategory.NOTICE -> { + noticeList?.add(0,msgBoxList) + } + MsgCategory.SYS_INFO -> { + ipcReportList?.add(0,msgBoxList) + } + MsgCategory.RECORD_BAG -> { + badCaseList?.add(0,msgBoxList) + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ + CallerMsgBoxListenerManager.addListener(TAG,this) + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ + CallerMsgBoxListenerManager.removeListener(TAG) + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt index 9b231d917b..f0720f387c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt @@ -7,14 +7,18 @@ 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.config.FunctionBuildConfig 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.data.msgbox.MsgCategory +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxListAdapter -import com.mogo.eagle.core.function.msgbox.MsgBoxConfig +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable +import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.layout_passenger_msg_box_list.view.* /** @@ -26,8 +30,9 @@ class PassengerMsgBoxListView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr){ +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener { + private val TAG = "PassengerMsgBoxListView" var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null private var noticeList: ArrayList ?= null @@ -47,18 +52,40 @@ class PassengerMsgBoxListView @JvmOverloads constructor( rvPassengerList.addItemDecoration(divider) //获取通知消息列表 noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList? - noticeList?.reversed() + noticeList = noticeList?.let { ArrayList(it.reversed()) } noticeList?.let { passengerMsgBoxListAdapter?.setData(it) } } - fun notifyData(){ - val localNoticeList = MsgBoxConfig.noticeList.reversed() - noticeList?.addAll(0,localNoticeList) - noticeList?.let { - passengerMsgBoxListAdapter?.setData(it) + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post{ + 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) + } + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && + AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ + CallerMsgBoxListenerManager.addListener(TAG,this) + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && + AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ + CallerMsgBoxListenerManager.removeListener(TAG) } }