From 2c8e80eca8373c5c4c15450daeee1b87a7660b00 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Mon, 29 Jul 2024 17:30:00 +0800 Subject: [PATCH] =?UTF-8?q?[6.5.1]Bus=E8=80=83=E8=AF=95UI=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=88=B0=E4=B8=BB=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmi/ui/setting/ExamSettingView.kt | 49 ++++++++++++ .../hmi/ui/setting/SeatPressureSettingView.kt | 80 +++++++++++++++++++ .../res/drawable/bg_seat_pressure_setting.xml | 10 +++ .../drawable/seat_pressure_item_normal_bg.xml | 5 ++ .../drawable/seat_pressure_item_press_bg.xml | 8 ++ .../drawable/selector_seat_pressure_item.xml | 7 ++ .../src/main/res/layout/view_exam_setting.xml | 57 +++++++++++++ .../res/layout/view_seat_pressure_setting.xml | 49 ++++++++++++ .../src/main/res/values/strings.xml | 4 + .../api/setting/ISeatPressureEventListener.kt | 10 +++ .../call/setting/CallerSeatPressureManager.kt | 20 +++++ 11 files changed, 299 insertions(+) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ExamSettingView.kt create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SeatPressureSettingView.kt create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_seat_pressure_setting.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_normal_bg.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_press_bg.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_seat_pressure_item.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_seat_pressure_setting.xml create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/setting/ISeatPressureEventListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSeatPressureManager.kt diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ExamSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ExamSettingView.kt new file mode 100644 index 0000000000..dd27120d94 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ExamSettingView.kt @@ -0,0 +1,49 @@ +package com.mogo.eagle.core.function.hmi.ui.setting + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendPlanningCmd +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendPlanningLineChangeCmd +import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_exam_setting.view.mOverTakeBtn +import kotlinx.android.synthetic.main.view_exam_setting.view.mStartCarBtn +import kotlinx.android.synthetic.main.view_exam_setting.view.mStopCarBtn + +class ExamSettingView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + + companion object { + const val TAG = "ExamSettingView" + } + + init { + LayoutInflater.from(context).inflate(R.layout.view_exam_setting, this, true) + initView() + } + + private fun initView(){ + initBusView() + } + + private fun initBusView(){ + //停车 + mStopCarBtn.setOnClickListener { + sendPlanningCmd(1) + } + //出发 + mStartCarBtn.setOnClickListener { + sendPlanningCmd(2) + } + //超车 + mOverTakeBtn.setOnClickListener { + sendPlanningLineChangeCmd(3) + } + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SeatPressureSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SeatPressureSettingView.kt new file mode 100644 index 0000000000..f11bae3308 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SeatPressureSettingView.kt @@ -0,0 +1,80 @@ +package com.mogo.eagle.core.function.hmi.ui.setting + +import android.content.Context +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 +import kotlinx.android.synthetic.main.view_seat_pressure_setting.view.tb_rear_row + +/** + * 座椅压力设置页面(设座位是否有人) + */ +class SeatPressureSettingView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + + companion object { + const val TAG = "SeatPressureSettingView" + } + + private var mainDriverStatus = false //主驾是否有人,默认没人 + private var coDriverStatus = false //副驾是否有人,默认没人 + private var rearRowStatus = false //后排是否有人,默认没人 + + init { + LayoutInflater.from(context).inflate(R.layout.view_seat_pressure_setting, this, true) + initView() + } + + private fun initView(){ + //主驾 + tb_main_driver.isChecked = mainDriverStatus + tb_main_driver.setOnCheckedChangeListener{compoundButton, isChecked -> + if(!compoundButton.isPressed){ + return@setOnCheckedChangeListener + } + mainDriverStatus = isChecked + CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus) + updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus) + } + //副驾 + tb_co_driver.isChecked = coDriverStatus + tb_co_driver.setOnCheckedChangeListener{compoundButton, isChecked -> + if(!compoundButton.isPressed){ + return@setOnCheckedChangeListener + } + coDriverStatus = isChecked + CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus) + updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus) + } + //后排 + tb_rear_row.isChecked = rearRowStatus + tb_rear_row.setOnCheckedChangeListener{compoundButton, isChecked -> + if(!compoundButton.isPressed){ + return@setOnCheckedChangeListener + } + rearRowStatus = isChecked + CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus) + updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus) + } + } + + //TODO 看是否有需要 + private fun updateBtnBg(driver: Boolean,copilot: Boolean,backRow: Boolean){ + if(driver || copilot || backRow){ + //主驾、副驾、后排只要有一个位置有人则开关按钮就显示有人状态 + CallerSeatPressureManager.invokeUpdateBgEvent(true) + }else{ + //所有座位都没有人则显示无人状态 + CallerSeatPressureManager.invokeUpdateBgEvent(false) + } + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_seat_pressure_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_seat_pressure_setting.xml new file mode 100644 index 0000000000..fd4a583b7a --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_seat_pressure_setting.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_normal_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_normal_bg.xml new file mode 100644 index 0000000000..69b21b5e56 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_normal_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_press_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_press_bg.xml new file mode 100644 index 0000000000..a37e58b5b1 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/seat_pressure_item_press_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_seat_pressure_item.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_seat_pressure_item.xml new file mode 100644 index 0000000000..1095dab9eb --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_seat_pressure_item.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml new file mode 100644 index 0000000000..43bdacfd09 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml @@ -0,0 +1,57 @@ + + + +