From a43523e76ca3146661d6e1db65151f11aaf6e2d5 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Wed, 15 Feb 2023 17:14:51 +0800 Subject: [PATCH] [2.13.0-arch-opt] thread problm --- .../hmi/ui/vehicle/SteeringBrakeView.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt index a0494eb6c6..42c4e62409 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt @@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr +import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.Utils import kotlinx.android.synthetic.main.view_steering_brake.view.* @@ -73,15 +74,17 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo //can数据转发 转向灯状态 0是正常 1是左转 2是右转 if (lightSwitch != null) { CallerLogger.d("$M_HMI$TAG", "---lightSwitch.getNumber() = " + lightSwitch.number) - if (lightSwitch.number == 1 || lightSwitch.number == 2) { - isShowTurnLight = true - brakeView.visibility = View.VISIBLE - brakeView.setBrakeLight(0) - } else { - brakeView.visibility = View.GONE - isShowTurnLight = false + ThreadUtils.runOnUiThread { + if (lightSwitch.number == 1 || lightSwitch.number == 2) { + isShowTurnLight = true + brakeView.visibility = View.VISIBLE + brakeView.setBrakeLight(0) + } else { + brakeView.visibility = View.GONE + isShowTurnLight = false + } + turnLightView.visibility = View.VISIBLE } - turnLightView.visibility = View.VISIBLE } }