[6.1.0][Fix]解决平行驾驶状态导致的UI问题

This commit is contained in:
chenfufeng
2023-09-28 15:30:56 +08:00
parent 636daf05d9
commit e957b6b5d6

View File

@@ -93,16 +93,19 @@ class ParallelDriveView @JvmOverloads constructor(
reqParaDrive()
listener?.onReqClick()
}
APP_REQUESTING -> {
cancelParaDrive()
Log.d(TAG, "Click-请求已取消")
ToastUtils.showShort("请求已取消!")
checkAvailableAndUpdateUI()
}
AD_REQUESTING -> {
Log.d(TAG, "Click-自动驾驶正在请求平行驾驶")
ToastUtils.showShort("自动驾驶正在请求平行驾驶")
}
UNAVAILABLE -> {
Log.d(TAG, "Click-请P档驻车并松开油门刹车后请求")
ToastUtils.showShort("请P档驻车并松开油门刹车后请求")
@@ -118,41 +121,42 @@ class ParallelDriveView @JvmOverloads constructor(
override fun onAutopilotStatusResponse(state: Int) {
super.onAutopilotStatusResponse(state)
if (state != autopilotState) {
synchronized(this) {
when (state) {
7 -> {
if (this.autopilotState != 7) {
isAutoDriving = false
Log.d(TAG, "onAutopilotStatusResponse-7")
ThreadUtils.runOnUiThread({
updateUI(PARALLEL_DRIVING)
}, ThreadUtils.MODE.QUEUE)
}
}
when (state) {
7 -> {
if (this.autopilotState != 7) {
isAutoDriving = false
Log.d(TAG, "onAutopilotStatusResponse-7")
ThreadUtils.runOnUiThread({
updateUI(PARALLEL_DRIVING)
}, ThreadUtils.MODE.QUEUE)
}
}
2 -> {
if (this.autopilotState != state) {
isAutoDriving = true
Log.d(TAG, "onAutopilotStatusResponse-2")
}
}
else -> {
if (this.autopilotState != state) {
isAutoDriving = false
Log.d(TAG, "onAutopilotStatusResponse-else")
if (this.autopilotState == 7) {
ThreadUtils.runOnUiThread({
checkAvailableAndUpdateUI()
}, ThreadUtils.MODE.QUEUE)
}
}
2 -> {
if (this.autopilotState != state) {
isAutoDriving = true
Log.d(TAG, "onAutopilotStatusResponse-2")
if (this.autopilotState == 7) {
ThreadUtils.runOnUiThread({
checkAvailableAndUpdateUI()
}, ThreadUtils.MODE.QUEUE)
}
}
}
else -> {
if (this.autopilotState != state) {
isAutoDriving = false
Log.d(TAG, "onAutopilotStatusResponse-else")
if (this.autopilotState == 7) {
ThreadUtils.runOnUiThread({
checkAvailableAndUpdateUI()
}, ThreadUtils.MODE.QUEUE)
}
}
this.autopilotState = state
}
}
this.autopilotState = state
}
override fun onParallelDrivingAbility(