「Change」

修复「工具面板」没有及时移除订阅的bug

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-04-02 13:05:01 +08:00
parent a9a7acc302
commit 66dfc6b216

View File

@@ -54,7 +54,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
@SuppressLint("ClickableViewAccessibility")
private fun initView() {
background = ColorDrawable(Color.parseColor("#F0151D41"))
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
if (keyBoardUtil == null) {
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
}
@@ -182,11 +181,13 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
@@ -202,8 +203,10 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
UiThreadHandler.post {
tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
etInputSpeed.setText((carConfigResp.speedLimit * 3.6).toInt().toString())
tvAcceleration?.let {
tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
etInputSpeed.setText((carConfigResp.speedLimit * 3.6).toInt().toString())
}
}
}
}