[6.5.1_exam]Taxi增加座椅压力

This commit is contained in:
xuxinchao
2024-07-31 17:07:51 +08:00
parent cca38246cc
commit 57edc8dffb
9 changed files with 176 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.setting.CallerSeatPressureManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_seat_pressure_setting.view.tb_co_driver
import kotlinx.android.synthetic.main.view_seat_pressure_setting.view.tb_main_driver
@@ -41,6 +42,7 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
mainDriverStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
//副驾
tb_co_driver.isChecked = coDriverStatus
@@ -50,6 +52,7 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
coDriverStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
//后排
tb_rear_row.isChecked = rearRowStatus
@@ -59,8 +62,18 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
rearRowStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
}
private fun updateBtnBg(driver: Boolean,copilot: Boolean,backRow: Boolean){
if(driver || copilot || backRow){
//主驾、副驾、后排只要有一个位置有人则开关按钮就显示有人状态
CallerSeatPressureManager.invokeUpdateBgEvent(true)
}else{
//所有座位都没有人则显示无人状态
CallerSeatPressureManager.invokeUpdateBgEvent(false)
}
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.setting
/**
* 座椅压力事件监听回调接口
*/
interface ISeatPressureEventListener {
fun onUpdateBgEvent(isPress: Boolean){}
}

View File

@@ -1,18 +1,19 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.ITakeOverEventListener
import com.mogo.eagle.core.function.api.setting.ISeatPressureEventListener
import com.mogo.eagle.core.function.call.base.CallerBase
import java.util.concurrent.ConcurrentHashMap
/**
* 接管请求事件监听管理
* 座椅压力事件监听管理
*/
object CallerTakeOverManager: CallerBase<ITakeOverEventListener>() {
object CallerSeatPressureManager: CallerBase<ISeatPressureEventListener>() {
fun invokeTakeOverEvent(isShow: Boolean){
fun invokeUpdateBgEvent(isPress: Boolean){
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onTakeOverEvent(isShow)
listener.onUpdateBgEvent(isPress)
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.ITakeOverEventListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 接管请求事件监听管理
*/
object CallerTakeOverManager: CallerBase<ITakeOverEventListener>() {
fun invokeTakeOverEvent(isShow: Boolean){
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onTakeOverEvent(isShow)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB