From 0cfdcc27bc9319f1cd652d2e1cd0c3096c635997 Mon Sep 17 00:00:00 2001 From: xuxinchao <13522809046@163.com> Date: Fri, 27 May 2022 18:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化上报历史逻辑,如有历史记录则显示“打开历史”按钮,并且显示最新一条数据 --- .../core/function/hmi/ui/MoGoHmiFragment.kt | 4 ++ .../hmi/ui/setting/DebugSettingView.kt | 54 ++++++++++++++++--- .../hmi/ui/setting/ReportListAdapter.kt | 4 +- .../main/res/layout/view_debug_setting.xml | 31 +---------- 4 files changed, 55 insertions(+), 38 deletions(-) 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 f4619ee1ce..01f2f90208 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 @@ -438,9 +438,13 @@ class MoGoHmiFragment : MvpFragment(), WarningFloat.dismiss(mDebugSettingViewFloat!!.config.floatTag, false) mDebugSettingViewFloat = null mDebugSettingView = null + //关闭工控机上报列表 + reportListFloatWindow?.hideFloatWindow() + reportListFloatWindow = null } else { if (mDebugSettingView == null) { mDebugSettingView = DebugSettingView(it) + mDebugSettingView?.reportInit(reportList) mDebugSettingView?.setClickListener(object: DebugSettingView.ClickListener{ override fun showReportListWindow(show: Boolean) { if(show){ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 3c7f754c0a..181287c215 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -30,6 +30,7 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.gnss.AccelerationEntity import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.obu.ObuStatusInfo +import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.data.upgrade.UpgradeVersionEntity import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener @@ -1700,10 +1701,6 @@ class DebugSettingView @JvmOverloads constructor( } tvReportActions.text = actionStr - tvReportSec.text = "sec:${it.timestamp.sec}" - tvReportNSec.text = "nsec:${it.timestamp.nsec}" - - if ("error" == it.level) { //字体为红色,吐司提示 tvReportSrc.setTextColor(Color.RED) @@ -1712,8 +1709,6 @@ class DebugSettingView @JvmOverloads constructor( tvReportCode.setTextColor(Color.RED) tvReportResult.setTextColor(Color.RED) tvReportActions.setTextColor(Color.RED) - tvReportSec.setTextColor(Color.RED) - tvReportNSec.setTextColor(Color.RED) toastMsg(it.msg) } else { tvReportSrc.setTextColor(Color.BLACK) @@ -1722,8 +1717,6 @@ class DebugSettingView @JvmOverloads constructor( tvReportCode.setTextColor(Color.BLACK) tvReportResult.setTextColor(Color.BLACK) tvReportActions.setTextColor(Color.BLACK) - tvReportSec.setTextColor(Color.BLACK) - tvReportNSec.setTextColor(Color.BLACK) } } } @@ -1787,6 +1780,51 @@ class DebugSettingView @JvmOverloads constructor( } } + /** + * 初始化上报 + */ + fun reportInit(reportList: ArrayList){ + if(reportList.size > 0){ + reportMsgLayout.visibility = View.VISIBLE + reportList[0].let { + tvReportSrc.text = "src:${it.src}" + tvReportLevel.text = "level:${it.level}" + tvReportMsg.text = "msg:${it.msg}" + tvReportCode.text = "code:${it.code}" + var resultStr = "result:" + for (result in it.resultList) { + resultStr = + "$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} " + } + tvReportResult.text = resultStr + + var actionStr = "action:" + for (action in it.actionsList) { + actionStr = + "$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} " + } + tvReportActions.text = actionStr + if ("error" == it.level) { + //字体为红色 + tvReportSrc.setTextColor(Color.RED) + tvReportLevel.setTextColor(Color.RED) + tvReportMsg.setTextColor(Color.RED) + tvReportCode.setTextColor(Color.RED) + tvReportResult.setTextColor(Color.RED) + tvReportActions.setTextColor(Color.RED) + } else { + tvReportSrc.setTextColor(Color.BLACK) + tvReportLevel.setTextColor(Color.BLACK) + tvReportMsg.setTextColor(Color.BLACK) + tvReportCode.setTextColor(Color.BLACK) + tvReportResult.setTextColor(Color.BLACK) + tvReportActions.setTextColor(Color.BLACK) + } + + } + } + } + fun setClickListener(clickListener: ClickListener) { this.clickListener = clickListener } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ReportListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ReportListAdapter.kt index c10403b348..dd51e83326 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ReportListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ReportListAdapter.kt @@ -38,7 +38,7 @@ class ReportListAdapter(context: Context) : data?.let { it -> val reportEntity = it[position] reportEntity.let { - holder.tvReportTime.text = it.time + holder.tvReportTime.text = "上报时间:${it.time}" holder.tvReportSrc.text = "src:${it.src}" holder.tvReportLevel.text = "level:${it.level}" holder.tvReportMsg.text = "msg:${it.msg}" @@ -56,6 +56,7 @@ class ReportListAdapter(context: Context) : if ("error" == it.level) { //字体为红色,吐司提示 + holder.tvReportTime.setTextColor(Color.RED) holder.tvReportSrc.setTextColor(Color.RED) holder.tvReportLevel.setTextColor(Color.RED) holder.tvReportMsg.setTextColor(Color.RED) @@ -63,6 +64,7 @@ class ReportListAdapter(context: Context) : 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) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 6c50eca4b3..c6a7b0628d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -50,7 +50,8 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@id/tbReportMore" app:layout_constraintTop_toBottomOf="@id/vReportLine" - app:layout_constraintTop_toTopOf="@id/tbReportMore" /> + app:layout_constraintTop_toTopOf="@id/tbReportMore" + android:gravity="center_vertical"/> - - - - - - - -