[8.2.4][hmi][运营面板-车辆相关] AIP按钮与驾驶模式按钮自驾状态时不可点击

This commit is contained in:
xinfengkun
2025-09-16 19:18:21 +08:00
parent f5a2ec0a57
commit 7c7f8d6f5b
4 changed files with 107 additions and 19 deletions

View File

@@ -56,6 +56,8 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.unmanned.CallerUnmannedListenerManager
import com.mogo.eagle.core.function.call.vehicle.CallerSweeperModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableCheckBox
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableSwitch
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithMoFang
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithSpeedSetting
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithUnmanInterval
@@ -1501,7 +1503,7 @@ class OperatePanelLayout : LinearLayout {
// CallerAutoPilotControlManager
class VehiclesPreferenceFragmentCompat : OperatePanelDetailBase(), IMoGoAutopilotCarConfigListener,
ISopSettingListener, IViewControlListener, IMoGoGetParamResponseListener, IMoGoAutopilotStatusListener{
private var v2xIsShow: Boolean = false
private var vehIsShow: Boolean = false
private var operatePaneIsShow = true
private var prevIpcConnectStatus = false
private var customToast: Toast? = null
@@ -1509,7 +1511,7 @@ class OperatePanelLayout : LinearLayout {
private const val TAG = "VehiclesPreferenceFragmentCompat"
private const val IS_CHECKED_DRIVING_STYLE = "is_checked_driving_style"
private const val WHAT_UPDATE_ENABLE = 0x00//更新按钮状态
private const val WHAT_UPDATE_ENABLE = 0x01//更新按钮状态
private const val KEY_PNC_PARK_INTERSECTION_CAR = "pnc_park_intersection_car"
private const val KEY_PNC_PARK_OVERTAKE_CAR = "pnc_park_overtake_car"
@@ -1560,12 +1562,13 @@ class OperatePanelLayout : LinearLayout {
FunctionBuildConfig.appIdentityMode
)
) {
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_AIP_FUNCTION)?.isVisible= false
preferenceScreen.findPreferenceReal<PreferenceGrayableSwitch>(KEY_AIP_FUNCTION)?.isVisible= false
preferenceScreen.findPreference<Preference>("header_driving_style")?.isVisible = false
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_DRIVING_STYLE_NORMAL)?.isVisible= false
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_DRIVING_STYLE_SAFETY)?.isVisible= false
preferenceScreen.findPreferenceReal<CheckBoxPreference>( KEY_DRIVING_STYLE_PROFESSIONAL)?.isVisible= false
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_NORMAL)?.isVisible= false
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_SAFETY)?.isVisible= false
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>( KEY_DRIVING_STYLE_PROFESSIONAL)?.isVisible= false
}
updateAutopilotActiveBtnDisableState()
return super.onCreateView(inflater, container, savedInstanceState)
}
@@ -1583,7 +1586,7 @@ class OperatePanelLayout : LinearLayout {
super.operatePanelDisplayStatus(isShow)
operatePaneIsShow = isShow
if (isShow) {
if (v2xIsShow) {
if (vehIsShow) {
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
} else {
@@ -1596,7 +1599,7 @@ class OperatePanelLayout : LinearLayout {
override fun onResume() {
super.onResume()
prevIpcConnectStatus = AppConfigInfo.isConnectAutopilot
v2xIsShow = true
vehIsShow = true
if (operatePaneIsShow) {
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
@@ -1604,7 +1607,7 @@ class OperatePanelLayout : LinearLayout {
override fun onPause() {
super.onPause()
v2xIsShow = false
vehIsShow = false
handler.removeMessages(WHAT_UPDATE_ENABLE)
customToast?.cancel()
customToast = null
@@ -1619,6 +1622,7 @@ class OperatePanelLayout : LinearLayout {
}
setEnableStatus(AppConfigInfo.isConnectAutopilot)
if (AppConfigInfo.isConnectAutopilot) {
updateAutopilotActiveBtnDisableState()
customToast?.cancel()
customToast = null
} else {
@@ -1653,7 +1657,7 @@ class OperatePanelLayout : LinearLayout {
reason: String?
) {
if (prevIpcConnectStatus != AppConfigInfo.isConnectAutopilot) {
if (operatePaneIsShow && v2xIsShow) {
if (operatePaneIsShow && vehIsShow) {
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
}
@@ -1689,13 +1693,25 @@ class OperatePanelLayout : LinearLayout {
//融合模式 - 纯路侧模式
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_PURE_OBU_MODE)?.isEnabled = isEnable
//AIP功能
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_AIP_FUNCTION)?.isEnabled = isEnable
preferenceScreen.findPreferenceReal<PreferenceGrayableSwitch>(KEY_AIP_FUNCTION)?.let {
it.shouldDisableView = true
it.isEnabled = isEnable
}
//驾驶模式 - 正常模式
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_DRIVING_STYLE_NORMAL)?.isEnabled = isEnable
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_NORMAL)?.let {
it.shouldDisableView = true
it.isEnabled = isEnable
}
//驾驶模式 - 安全模式
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_DRIVING_STYLE_SAFETY)?.isEnabled = isEnable
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_SAFETY)?.let {
it.shouldDisableView = true
it.isEnabled = isEnable
}
//驾驶模式 - 专业模式
preferenceScreen.findPreferenceReal<CheckBoxPreference>(KEY_DRIVING_STYLE_PROFESSIONAL)?.isEnabled = isEnable
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_PROFESSIONAL)?.let {
it.shouldDisableView = true
it.isEnabled = isEnable
}
//自动驾驶速度阈值
preferenceScreen.findPreferenceReal<PreferenceWithSpeedSetting>(KEY_AUTO_PILOT_SPEED_THRESHOLDS)?.isEnabled = isEnable
//变道速度阈值
@@ -1704,6 +1720,43 @@ class OperatePanelLayout : LinearLayout {
preferenceScreen.findPreferenceReal<PreferenceWithSpeedSetting>(KEY_OVERTAKE_SPEED_THRESHOLDSS)?.isEnabled = isEnable
}
override fun onAutopilotStatusResponse(state: Int) {
super.onAutopilotStatusResponse(state)
CallerLogger.i(TAG,"自驾状态=${state}")
ThreadUtils.runOnUiThread {
updateAutopilotActiveBtnDisableState()
}
}
//自驾中不允许操作的按钮
private fun updateAutopilotActiveBtnDisableState() {
if (AppConfigInfo.isConnectAutopilot) {
val isEnable = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
CallerLogger.i(TAG, "isEnable=$isEnable 自驾状态=${CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state}")
//AIP功能
preferenceScreen.findPreferenceReal<PreferenceGrayableSwitch>(KEY_AIP_FUNCTION)?.let {
it.shouldDisableView = isEnable
it.isEnabled = isEnable
}
//驾驶模式 - 正常模式
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_NORMAL)?.let {
it.shouldDisableView = isEnable
it.isEnabled = isEnable
}
//驾驶模式 - 安全模式
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_SAFETY)?.let {
it.shouldDisableView = isEnable
it.isEnabled = isEnable
}
//驾驶模式 - 专业模式
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_PROFESSIONAL)?.let {
it.shouldDisableView = isEnable
it.isEnabled = isEnable
}
}
}
override fun updateFuncMode(tag: String, boolean: Boolean) {
super.updateFuncMode(tag, boolean)
if (tag == FUNC_MODE_RAIN) {
@@ -1795,7 +1848,7 @@ class OperatePanelLayout : LinearLayout {
)
if (adasParam.activateAip != -1) {
ThreadUtils.runOnUiThread {
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(
preferenceScreen.findPreferenceReal<TwoStatePreference>(
KEY_AIP_FUNCTION
)?.also { changeValue(it, adasParam.activateAip == 1) }
}

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.core.function.hmi.ui.operate.preferences
import android.content.Context
import android.util.AttributeSet
import androidx.preference.CheckBoxPreference
import androidx.preference.PreferenceViewHolder
class PreferenceGrayableCheckBox(context: Context, attrs: AttributeSet) :
CheckBoxPreference(context, attrs) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
// 根据启用状态设置alpha值
holder.findViewById(android.R.id.checkbox)?.alpha =
if (isEnabled && shouldDisableView) 1f else 0.6f
}
}

View File

@@ -0,0 +1,18 @@
package com.mogo.eagle.core.function.hmi.ui.operate.preferences
import android.content.Context
import android.util.AttributeSet
import androidx.preference.PreferenceViewHolder
import androidx.preference.SwitchPreferenceCompat
import com.mogo.eagle.core.function.hmi.R
class PreferenceGrayableSwitch(context: Context, attrs: AttributeSet) :
SwitchPreferenceCompat(context, attrs) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
// 根据启用状态设置alpha值
holder.findViewById(R.id.switchWidget)?.alpha =
if (isEnabled && shouldDisableView) 1f else 0.6f
}
}

View File

@@ -78,7 +78,7 @@
android:title="纯路侧模式"
android:persistent="false"
android:widgetLayout="@layout/layout_operate_panel_preference_widget_checkbox_compat" />
<SwitchPreferenceCompat
<com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableSwitch
android:key="aip_function"
android:layout="@layout/layout_operate_panel_preference_switch_compat"
android:persistent="false"
@@ -89,19 +89,19 @@
android:layout="@layout/layout_operate_panel_preference_primary_category_title"
android:selectable="false"
android:title="驾驶模式" />
<CheckBoxPreference
<com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableCheckBox
android:key="driving_style_normal"
android:layout="@layout/layout_operate_panel_preference_checkbox_compat"
android:persistent="false"
android:title="正常模式"
android:widgetLayout="@layout/layout_operate_panel_preference_widget_checkbox_compat" />
<CheckBoxPreference
<com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableCheckBox
android:key="driving_style_safety"
android:layout="@layout/layout_operate_panel_preference_checkbox_compat"
android:persistent="false"
android:title="安全模式"
android:widgetLayout="@layout/layout_operate_panel_preference_widget_checkbox_compat" />
<CheckBoxPreference
<com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceGrayableCheckBox
android:key="driving_style_professional"
android:layout="@layout/layout_operate_panel_preference_checkbox_compat"
android:persistent="false"