解决长时间绘制导致Anr问题

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-21 21:08:38 +08:00
parent 483b7c694d
commit be4084a726
2 changed files with 15 additions and 6 deletions

View File

@@ -158,11 +158,18 @@ class DebugSettingView @JvmOverloads constructor(
* OBU状态回调
*/
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
tvObuInfo.post {
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
}
}
/**
* 自动驾驶状态回调
*/
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
tvAutopilotInfo.post {
tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
}
}
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {

View File

@@ -126,10 +126,12 @@ class SpeedPanelView @JvmOverloads constructor(
}
override fun onCarLocationChanged2(latLng: Location) {
val speed = (latLng.speed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > 60) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > 60) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
mSpeedChartView.post {
val speed = (latLng.speed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > 60) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > 60) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {