[dev_arch_opt_3.0]fix调试面板,点击打开历史,APP崩溃
This commit is contained in:
@@ -30,6 +30,7 @@ import com.zhjt.mogo_core_function_devatools.mofang.MoFangManager.Companion.moFa
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.MonitorManager
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb.Companion.getDb
|
||||
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.iPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
|
||||
import com.zhjt.mogo_core_function_devatools.status.StatusManager
|
||||
@@ -162,6 +163,10 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
BadCaseManager.showBadCaseManagerWindow(context)
|
||||
}
|
||||
|
||||
override fun showReportListWindow(context: Context, isShow: Boolean) {
|
||||
iPCReportManager.showReportListWindow(context, isShow)
|
||||
}
|
||||
|
||||
override fun downLoadPackage(downloadKey: String, downloadUrl: String) {
|
||||
upgradeManager.downLoadPackage(mContext!!, downloadKey, downloadUrl)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhjt.mogo_core_function_devatools.report
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
@@ -37,6 +39,11 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
|
||||
|
||||
}
|
||||
|
||||
//工控机上报列表悬浮窗
|
||||
private var reportListFloatWindow: ReportListFloatWindow? = null
|
||||
//工控机节点上报列表
|
||||
private val reportList = arrayListOf<ReportEntity>()
|
||||
|
||||
fun initServer(){
|
||||
//乘客屏不显示监控信息弹窗,只在司机端提示
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
@@ -45,6 +52,19 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
|
||||
}
|
||||
}
|
||||
|
||||
fun showReportListWindow(context: Context, isShow: Boolean){
|
||||
if(isShow){
|
||||
//打开工控机上报列表
|
||||
reportListFloatWindow =
|
||||
ReportListFloatWindow(context as Activity)
|
||||
reportListFloatWindow?.showFloatWindow()
|
||||
reportListFloatWindow?.refreshData(reportList)
|
||||
}else {
|
||||
//关闭工控机上报列表
|
||||
reportListFloatWindow?.hideFloatWindow()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*工控机监控节点上报
|
||||
*/
|
||||
@@ -61,6 +81,18 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
|
||||
CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.REPORT, reportEntity))
|
||||
}
|
||||
|
||||
if (reportList.size > 49) {
|
||||
reportList.removeLast()
|
||||
}
|
||||
reportList.add(
|
||||
0,
|
||||
ReportEntity(
|
||||
TimeUtils.millis2String(System.currentTimeMillis()),
|
||||
it.src, it.level, it.msg, it.code, it.resultList, it.actionsList
|
||||
)
|
||||
)
|
||||
reportListFloatWindow?.refreshData(reportList)
|
||||
|
||||
// //Error 弹窗并有提示音
|
||||
// if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|
||||
// || it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zhjt.mogo_core_function_devatools.report
|
||||
|
||||
import android.app.Activity
|
||||
import android.graphics.PixelFormat
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.report.adapter.ReportListAdapter
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 工控机上报列表面板
|
||||
* @since: 2022/4/13
|
||||
*/
|
||||
class ReportListFloatWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
|
||||
private var mActivity: Activity = activity
|
||||
private var mWindowParams: WindowManager.LayoutParams? = null
|
||||
private var mWindowManager: WindowManager? = null
|
||||
private lateinit var rvReportList: RecyclerView
|
||||
private var reportListAdapter: ReportListAdapter?=null
|
||||
|
||||
private lateinit var mFloatLayout: View
|
||||
private var mInViewX = 0f
|
||||
private var mInViewY = 0f
|
||||
private var mDownInScreenX = 0f
|
||||
private var mDownInScreenY = 0f
|
||||
private var mInScreenX = 0f
|
||||
private var mInScreenY = 0f
|
||||
|
||||
init {
|
||||
initFloatWindow();
|
||||
}
|
||||
|
||||
private fun initFloatWindow() {
|
||||
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_report_list, null) as View
|
||||
mFloatLayout.setOnTouchListener(this)
|
||||
rvReportList= mFloatLayout.findViewById(R.id.rv_report_list)
|
||||
mWindowParams = WindowManager.LayoutParams()
|
||||
mWindowManager = mActivity.windowManager
|
||||
mWindowParams?.let {
|
||||
it.format = PixelFormat.RGBA_8888
|
||||
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
it.gravity = Gravity.START or Gravity.TOP
|
||||
it.width = 800
|
||||
it.height = 1000
|
||||
it.alpha = 0.9f
|
||||
}
|
||||
reportListAdapter= ReportListAdapter(mActivity)
|
||||
rvReportList.layoutManager = LinearLayoutManager(mActivity,
|
||||
LinearLayoutManager.VERTICAL,false)
|
||||
rvReportList.adapter = reportListAdapter
|
||||
}
|
||||
|
||||
fun refreshData(data:List<ReportEntity>){
|
||||
reportListAdapter?.setDada(data)
|
||||
reportListAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean {
|
||||
when (motionEvent?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
// 获取相对View的坐标,即以此View左上角为原点
|
||||
mInViewX = motionEvent.x
|
||||
mInViewY = motionEvent.y
|
||||
// 获取相对屏幕的坐标,即以屏幕左上角为原点
|
||||
mDownInScreenX = motionEvent.rawX
|
||||
mDownInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight()
|
||||
mInScreenX = motionEvent.rawX
|
||||
mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight()
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
// 更新浮动窗口位置参数
|
||||
mInScreenX = motionEvent.rawX
|
||||
mInScreenY = motionEvent.rawY - BarUtils.getStatusBarHeight()
|
||||
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
|
||||
}
|
||||
|
||||
fun showFloatWindow() {
|
||||
if (mFloatLayout.parent == null) {
|
||||
val metrics = DisplayMetrics()
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels / 2 - BarUtils.getStatusBarHeight()
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}
|
||||
}
|
||||
|
||||
fun hideFloatWindow() {
|
||||
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.zhjt.mogo_core_function_devatools.report.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 工控机上报列表适配器
|
||||
* @since: 2022/4/13
|
||||
*/
|
||||
class ReportListAdapter(context: Context) :
|
||||
RecyclerView.Adapter<ReportListAdapter.ReportListHolder>() {
|
||||
|
||||
private var context: Context? = context
|
||||
private var data:List<ReportEntity>? = null
|
||||
|
||||
public fun setDada( data: List<ReportEntity>?){
|
||||
this.data = data
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReportListHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_report_detail, parent, false)
|
||||
return ReportListHolder(view)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: ReportListHolder, position: Int) {
|
||||
data?.let { it ->
|
||||
val reportEntity = it[position]
|
||||
reportEntity.let {
|
||||
holder.tvReportTime.text = "上报时间:${it.time}"
|
||||
holder.tvReportSrc.text = "src:${it.src}"
|
||||
holder.tvReportLevel.text = "level:${it.level}"
|
||||
holder.tvReportMsg.text = "msg:${it.msg}"
|
||||
holder.tvReportCode.text = "code:${it.code}"
|
||||
var resultStr = "result:"
|
||||
for (result in it.resultList) {
|
||||
resultStr = "$resultStr$result${CallerAutoPilotControlManager.getReportResultDesc(result)} "
|
||||
}
|
||||
holder.tvReportResult.text = resultStr
|
||||
var actionStr = "action:"
|
||||
for (action in it.actionsList) {
|
||||
actionStr = "$actionStr$action${CallerAutoPilotControlManager.getReportActionDesc(action)} "
|
||||
}
|
||||
holder.tvReportActions.text = actionStr
|
||||
|
||||
if ("error" == it.level) {
|
||||
//字体为红色,吐司提示
|
||||
holder.tvReportTime.setTextColor(Color.RED)
|
||||
holder.tvReportSrc.setTextColor(Color.RED)
|
||||
holder.tvReportLevel.setTextColor(Color.RED)
|
||||
holder.tvReportMsg.setTextColor(Color.RED)
|
||||
holder.tvReportCode.setTextColor(Color.RED)
|
||||
holder.tvReportResult.setTextColor(Color.RED)
|
||||
holder.tvReportActions.setTextColor(Color.RED)
|
||||
} else {
|
||||
holder.tvReportTime.setTextColor(Color.WHITE)
|
||||
holder.tvReportSrc.setTextColor(Color.WHITE)
|
||||
holder.tvReportLevel.setTextColor(Color.WHITE)
|
||||
holder.tvReportMsg.setTextColor(Color.WHITE)
|
||||
holder.tvReportCode.setTextColor(Color.WHITE)
|
||||
holder.tvReportResult.setTextColor(Color.WHITE)
|
||||
holder.tvReportActions.setTextColor(Color.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
class ReportListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
var tvReportTime: TextView = itemView.findViewById(R.id.tvReportTime)
|
||||
var tvReportSrc: TextView = itemView.findViewById(R.id.tvReportSrc)
|
||||
var tvReportLevel: TextView = itemView.findViewById(R.id.tvReportLevel)
|
||||
var tvReportMsg: TextView = itemView.findViewById(R.id.tvReportMsg)
|
||||
var tvReportCode: TextView = itemView.findViewById(R.id.tvReportCode)
|
||||
var tvReportResult: TextView = itemView.findViewById(R.id.tvReportResult)
|
||||
var tvReportActions: TextView = itemView.findViewById(R.id.tvReportActions)
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportTime"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportSrc"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportLevel"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportMsg"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportCode"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportResult"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReportActions"
|
||||
android:textColor="#1A1A1A"
|
||||
android:textSize="24dp"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#F0F0F0" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="840dp"
|
||||
android:layout_height="584dp"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_drag"
|
||||
android:padding="15dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#3B4577"
|
||||
app:roundLayoutRadius="10dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_report_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user