[3.4.0]修复调试面板中打开历史消息之后关闭调试面板再打开无法关闭上报历史窗Bug

This commit is contained in:
xuxinchao
2023-07-28 18:36:48 +08:00
parent fa8f144869
commit 37a2710dd9
6 changed files with 45 additions and 11 deletions

View File

@@ -294,6 +294,10 @@ class DevaToolsProvider : IDevaToolsProvider {
iPCReportManager.showReportListWindow(context, isShow)
}
override fun getReportWindowStatus(): Boolean {
return iPCReportManager.getReportWindowStatus()
}
override fun downLoadPackage(type: DownloadType, downloadKey: String, downloadUrl: String) {
upgradeManager.downLoadPackage(mContext!!,type, downloadKey, downloadUrl)
}

View File

@@ -23,6 +23,8 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
private var ipcErrorReportList = arrayListOf<ReportEntity>() //错误上报列表
private var ipcWarningReportList = arrayListOf<ReportEntity>() //警告上报列表
private var ipcReportWindowIsShow = false //IPC上报窗口是否处于展示状态
companion object{
const val TAG ="IPCReportManager"
val iPCReportManager: IPCReportManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@@ -55,16 +57,31 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
fun showReportListWindow(context: Context, isShow: Boolean){
if(isShow){
//打开工控机上报列表
reportListFloatWindow =
ReportListFloatWindow(context as Activity)
reportListFloatWindow?.showFloatWindow()
reportListFloatWindow?.refreshData(reportList)
if(reportListFloatWindow == null){
reportListFloatWindow =
ReportListFloatWindow(context as Activity)
}
reportListFloatWindow?.let {
it.showFloatWindow()
it.refreshData(reportList)
ipcReportWindowIsShow = true
}
}else {
//关闭工控机上报列表
reportListFloatWindow?.hideFloatWindow()
reportListFloatWindow?.let {
it.hideFloatWindow()
ipcReportWindowIsShow = false
}
}
}
/**
* 获取窗口展示状态
*/
fun getReportWindowStatus(): Boolean{
return ipcReportWindowIsShow
}
/**
*工控机监控节点上报
*/

View File

@@ -69,22 +69,20 @@ class ReportListFloatWindow constructor(activity: Activity) : View.OnTouchListen
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()
// 手指移动的时候更新小悬浮窗的位置
mWindowManager!!.updateViewLayout(mFloatLayout, mWindowParams)
}
// MotionEvent.ACTION_UP -> // 如果手指离开屏幕时xDownInScreen和xInScreen相等且yDownInScreen和yInScreen相等则视为触发了单击事件。
// if (mDownInScreenX === mInScreenX && mDownInScreenY === mInScreenY) {
// }
}
return true
}