调试窗

优化上报历史逻辑,如有历史记录则显示“打开历史”按钮,并且显示最新一条数据
This commit is contained in:
xuxinchao
2022-05-27 18:23:47 +08:00
parent 430328ea7f
commit 0cfdcc27bc
4 changed files with 55 additions and 38 deletions

View File

@@ -438,9 +438,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
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){

View File

@@ -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<ReportEntity>){
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
}

View File

@@ -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)

View File

@@ -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"/>
<View
android:id="@+id/vReportSrcLine"
@@ -122,34 +123,6 @@
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/vReportResultLine" />
<View
android:id="@+id/vReportActionsLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/tvReportActions" />
<TextView
android:id="@+id/tvReportSec"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/vReportActionsLine" />
<View
android:id="@+id/vReportSecLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/tvReportSec" />
<TextView
android:id="@+id/tvReportNSec"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/vReportSecLine" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>