[6.7.0][状态栏改版] 优化代码逻辑
This commit is contained in:
@@ -10,6 +10,7 @@ import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceGroup
|
||||
@@ -22,11 +23,14 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN
|
||||
import com.mogo.eagle.core.function.api.setting.ISopSettingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
@@ -35,20 +39,26 @@ import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager
|
||||
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.PreferenceWithMoFang
|
||||
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithSpeedSetting
|
||||
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithUnmanInterval
|
||||
import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithWelcomeWords
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.SweeperModeChangedConfirmDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.SOPAnalyticsManager.clickEventAnalytics
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import kotlinx.android.synthetic.main.layout_operate_panel.view.iv_operate_panel_close
|
||||
import kotlinx.coroutines.launch
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class OperatePanelLayout : LinearLayout {
|
||||
|
||||
@@ -397,14 +407,35 @@ class OperatePanelLayout : LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
class DemoPreferenceFragmentCompat : OperatePanelDetailBase() {
|
||||
class DemoPreferenceFragmentCompat : OperatePanelDetailBase(), IViewControlListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DemoPreferenceFragmentCompat"
|
||||
private const val KEY_DEMO_SWITCH = "demo_switch"
|
||||
private const val KEY_RECORD_BAG_DIALOG = "record_bag_dialog"
|
||||
private const val KEY_TAKE_OVER_WAKE = "take_over_wake"
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CallerHmiViewControlListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun updateFuncMode(tag: String, checked: Boolean) {
|
||||
super.updateFuncMode(tag, checked)
|
||||
if (tag == FUNC_MODE_DEMO) {
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_DEMO_SWITCH)?.also {
|
||||
it.extras.putBoolean("is_pressed", false)
|
||||
changeValue(it, checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.operate_panel_preference_details_demo, rootKey)
|
||||
}
|
||||
@@ -427,13 +458,17 @@ class OperatePanelLayout : LinearLayout {
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||
when (preference.key) {
|
||||
KEY_DEMO_SWITCH -> {
|
||||
val isPressed = preference.extras.getBoolean("is_pressed", true)
|
||||
if (!isPressed) {
|
||||
preference.extras.remove("is_pressed")
|
||||
return true
|
||||
}
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
hmiAction("SOP 演示模式开关, ", !FunctionBuildConfig.isDemoMode)
|
||||
clickEventAnalytics("美化模式", isChecked)
|
||||
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
|
||||
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
|
||||
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_DEMO, FunctionBuildConfig.isDemoMode)
|
||||
CallerSopSettingManager.invokeDemoModeListener(isChecked)
|
||||
if (!FunctionBuildConfig.isDemoMode) { //关闭美化模式时,通知工控机
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
|
||||
}
|
||||
@@ -455,14 +490,35 @@ class OperatePanelLayout : LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
class HdMapPreferenceFragmentCompat : OperatePanelDetailBase() {
|
||||
class HdMapPreferenceFragmentCompat : OperatePanelDetailBase(), ISopSettingListener {
|
||||
companion object {
|
||||
private const val TAG = "HdMapPreferenceFragmentCompat"
|
||||
private const val KEY_DANGER_OBSTACLES_COLOR_MARK = "danger_obstacles_color_mark"
|
||||
private const val KEY_ROUTE_GUIDE_LINE_DYNAMIC_EFFECT = "route_guide_line_dynamic_effect"
|
||||
private const val KEY_POINT_CLOUD_EFFECT = "point_cloud_effect"
|
||||
private const val KEY_SELF_CAR_APERTURE = "self_car_aperture"
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CallerSopSettingManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
CallerSopSettingManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onPointCloudClickEvent(status: Boolean) {
|
||||
super.onPointCloudClickEvent(status)
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_POINT_CLOUD_EFFECT)?.also { changeValue(it, status) }
|
||||
}
|
||||
|
||||
override fun onCarApertureClickEvent(status: Boolean) {
|
||||
super.onCarApertureClickEvent(status)
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_SELF_CAR_APERTURE)?.also { changeValue(it, status) }
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.operate_panel_preference_details_hdmap, rootKey)
|
||||
}
|
||||
@@ -539,11 +595,12 @@ class OperatePanelLayout : LinearLayout {
|
||||
private const val KEY_RED_OR_GREEN_LIGHT_MERGE_MARKER = "red_or_green_light_merge_marker"
|
||||
private const val KEY_FAULT_REPORT_TIP = "fault_report_tip"
|
||||
private const val KEY_LIMIT_SPEED_MARKER = "limit_speed_marker"
|
||||
private const val KEY_SELF_ROUTING_VERIFY_MODE = "self_routing_verify_mode"
|
||||
private const val KEY_LOOK_AROUND_360 = "look_around_360"
|
||||
private const val KEY_WEATHER_EFFECT_SWITCH = "weather_effect_switch"
|
||||
private const val KEY_SYSTEM_BOOT_STATUS_SHOW = "system_boot_status_show"
|
||||
private const val KEY_SELF_ROUTING_VERIFY_MODE = "self_routing_verify_mode"
|
||||
private const val KEY_UNMANNED_DEMO_PULL_INTERVAL = "unmanned_demo_pull_interval"
|
||||
private const val KEY_SWEEPER_CLOUD_CONTROL = "sweeper_cloud_control"
|
||||
private const val KEY_LOOK_AROUND_360 = "look_around_360"
|
||||
}
|
||||
|
||||
override fun getDefaultVal(pref: Preference): Any? {
|
||||
@@ -575,6 +632,16 @@ class OperatePanelLayout : LinearLayout {
|
||||
KEY_UNMANNED_DEMO_PULL_INTERVAL -> {
|
||||
return CallerUnmannedListenerManager.getVirtualTaskPullTaskIntervalF()
|
||||
}
|
||||
KEY_SWEEPER_CLOUD_CONTROL -> {
|
||||
if (!isEnabled(pref)) {
|
||||
return false
|
||||
}
|
||||
return if (SweeperVehicleConfigUtils.isSPExistCurrentSweeperModeConfig()) {
|
||||
SweeperVehicleConfigUtils.isSPCurrentSweeperCloudMode()
|
||||
} else {
|
||||
SweeperVehicleConfigUtils.isDefaultSweeperCloudMode(FunctionBuildConfig.sweeperDefaultMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getDefaultVal(pref)
|
||||
}
|
||||
@@ -590,6 +657,9 @@ class OperatePanelLayout : LinearLayout {
|
||||
KEY_WEATHER_EFFECT_SWITCH -> {
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
KEY_SWEEPER_CLOUD_CONTROL -> {
|
||||
return AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode) && (SweeperVehicleConfigUtils.isDefaultSweeperCanSwitchMode(FunctionBuildConfig.sweeperCanSwitchMode))
|
||||
}
|
||||
else -> super.isEnabled(pref)
|
||||
}
|
||||
}
|
||||
@@ -606,7 +676,7 @@ class OperatePanelLayout : LinearLayout {
|
||||
PreferenceWithUnmanInterval.Interval.FORTY_FIVE_SECOND -> CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(45)
|
||||
PreferenceWithUnmanInterval.Interval.NEVER -> CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(-1)
|
||||
}
|
||||
clickEventAnalytics("Taxi无人化演练任务拉取时间间隔",true)
|
||||
clickEventAnalytics("Taxi无人化演练任务拉取时间间隔", true)
|
||||
}
|
||||
}
|
||||
return super.onPreferenceClick(preference)
|
||||
@@ -701,6 +771,27 @@ class OperatePanelLayout : LinearLayout {
|
||||
HmiBuildConfig.isShowConnectionProgressView = isChecked
|
||||
CallerHmiViewControlListenerManager.updateConnectionProgressView(isChecked)
|
||||
}
|
||||
KEY_SWEEPER_CLOUD_CONTROL -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
val activity = AppStateManager.currentActivity()
|
||||
if (activity != null) {
|
||||
val confirmDialog = SweeperModeChangedConfirmDialog(activity)
|
||||
confirmDialog.setClickListener(object: SweeperModeChangedConfirmDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
CallerSweeperModeListenerManager.invokeSweeperModeListeners(
|
||||
if (isChecked) SweeperVehicleConfigUtils.BUSINESS_MODE_CLOUD
|
||||
else SweeperVehicleConfigUtils.BUSINESS_MODE_OPERATE
|
||||
)
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_WEATHER_EFFECT_SWITCH)?.also { changeValue(it, !isChecked) }
|
||||
}
|
||||
})
|
||||
confirmDialog.showSweeperModeChangeConfirmDialog()
|
||||
}
|
||||
clickEventAnalytics("清扫云控业务",isChecked)
|
||||
}
|
||||
}
|
||||
return super.onPreferenceChange(preference, newValue)
|
||||
}
|
||||
@@ -788,8 +879,9 @@ class OperatePanelLayout : LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
class VehiclesPreferenceFragmentCompat : OperatePanelDetailBase() {
|
||||
class VehiclesPreferenceFragmentCompat : OperatePanelDetailBase(), IMoGoAutopilotCarConfigListener, ISopSettingListener, IViewControlListener {
|
||||
companion object {
|
||||
private const val TAG = "VehiclesPreferenceFragmentCompat"
|
||||
private const val KEY_PNC_PARK_INTERSECTION_CAR = "pnc_park_intersection_car"
|
||||
private const val KEY_PNC_PARK_OVERTAKE_CAR = "pnc_park_overtake_car"
|
||||
private const val KEY_DETOUR_RETARD_PARK = "detour_retard_park"
|
||||
@@ -807,10 +899,52 @@ class OperatePanelLayout : LinearLayout {
|
||||
private const val KEY_OVERTAKE_SPEED_THRESHOLDSS = "overtake_speed_thresholds"
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
CallerSopSettingManager.addListener(TAG, this)
|
||||
CallerHmiViewControlListenerManager.addListener(TAG, this)
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
override fun updateFuncMode(tag: String, checked: Boolean) {
|
||||
super.updateFuncMode(tag, checked)
|
||||
if (tag == FUNC_MODE_RAIN) {
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_RAIN_DAY)?.also {
|
||||
it.extras.putBoolean("is_pressed", false)
|
||||
changeValue(it, checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
|
||||
CallerSopSettingManager.removeListener(TAG)
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.operate_panel_preference_details_vehicles, rootKey)
|
||||
}
|
||||
|
||||
override fun onExamControlClickEvent(status: Boolean) {
|
||||
super.onExamControlClickEvent(status)
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_EXAM_FUNCTION_PANEL)?.also { changeValue(it, status) }
|
||||
}
|
||||
|
||||
override fun onRainModeClickEvent(status: Boolean) {
|
||||
super.onRainModeClickEvent(status)
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_RAIN_DAY)?.also { changeValue(it, status) }
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
super.onAutopilotCarConfig(carConfigResp)
|
||||
lifecycleScope.launch {
|
||||
val max = carConfigResp.speedLimit * 3.6
|
||||
preferenceScreen.findPreferenceReal<PreferenceWithSpeedSetting>(KEY_AUTO_PILOT_SPEED_THRESHOLDS)?.update(listOf("0", "$max", "$max", "5"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEnabled(pref: Preference): Boolean {
|
||||
when (pref.key) {
|
||||
KEY_AUTO_PILOT_SPEED_THRESHOLDS, KEY_OVERTAKE_SPEED_THRESHOLDSS -> {
|
||||
@@ -855,13 +989,14 @@ class OperatePanelLayout : LinearLayout {
|
||||
KEY_PURE_OBU_MODE -> {
|
||||
return FunctionBuildConfig.fusionMode == 5
|
||||
}
|
||||
KEY_AUTO_PILOT_SPEED_THRESHOLDS -> {
|
||||
return listOf("0.0", "${FunctionBuildConfig.maxSpeedLimit}", "${FunctionBuildConfig.maxSpeedLimit}", "5.0")
|
||||
}
|
||||
KEY_CHANGE_LANE_SPEED_THRESHOLDS -> {
|
||||
return setOf("3.0", "7.0", "${FunctionBuildConfig.detouringSpeed}", "0.5")
|
||||
return listOf("3.0", "7.0", "${FunctionBuildConfig.detouringSpeed}", "0.5")
|
||||
}
|
||||
KEY_OVERTAKE_SPEED_THRESHOLDSS -> {
|
||||
return setOf("3.0", "12.5", "${FunctionBuildConfig.overTakeSpeed}", "0.5")
|
||||
}
|
||||
KEY_AUTO_PILOT_SPEED_THRESHOLDS -> { //TODO renwj 自动驾驶速度阈值,旧版本没有看到
|
||||
return listOf("3.0", "12.5", "${FunctionBuildConfig.overTakeSpeed}", "0.5")
|
||||
}
|
||||
}
|
||||
return super.getDefaultVal(pref)
|
||||
@@ -871,7 +1006,20 @@ class OperatePanelLayout : LinearLayout {
|
||||
Log.d(TAG, "-- onPreferenceClick --:pref -> $preference")
|
||||
when (preference.key) {
|
||||
KEY_AUTO_PILOT_SPEED_THRESHOLDS -> {
|
||||
FunctionBuildConfig.detouringSpeed = preference.extras.getFloat(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.detouringSpeed.toFloat()).toInt()
|
||||
FunctionBuildConfig.maxSpeedLimit = preference.extras.getDouble(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.maxSpeedLimit)
|
||||
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(FunctionBuildConfig.maxSpeedLimit.toInt())
|
||||
when {
|
||||
isSuccess -> {
|
||||
ToastUtils.showShort("车速设置成功,立即生效")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
KEY_CHANGE_LANE_SPEED_THRESHOLDS -> {
|
||||
FunctionBuildConfig.detouringSpeed = preference.extras.getDouble(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.detouringSpeed.toDouble()).toInt()
|
||||
hmiAction("SOP 变道绕障的目标障碍物速度阈值", FunctionBuildConfig.detouringSpeed)
|
||||
val isSuccess = CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
|
||||
if (isSuccess == true) {
|
||||
@@ -882,9 +1030,10 @@ class OperatePanelLayout : LinearLayout {
|
||||
hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "失败")
|
||||
}
|
||||
clickEventAnalytics("变道速度阈值", true)
|
||||
return true
|
||||
}
|
||||
KEY_OVERTAKE_SPEED_THRESHOLDSS -> {
|
||||
FunctionBuildConfig.overTakeSpeed = preference.extras.getFloat(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.overTakeSpeed)
|
||||
FunctionBuildConfig.overTakeSpeed = preference.extras.getDouble(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.overTakeSpeed.toDouble()).toFloat()
|
||||
val isSuccess = CallerAutoPilotControlManager.sendOvertakeMaxSpeed(FunctionBuildConfig.overTakeSpeed.toDouble())
|
||||
if (isSuccess == true) {
|
||||
ToastUtils.showShort("SOP 超车目标障碍物速度阈值设置成功")
|
||||
@@ -894,6 +1043,7 @@ class OperatePanelLayout : LinearLayout {
|
||||
hmiAction("SOP 超车目标障碍物速度阈值设置", "失败")
|
||||
}
|
||||
clickEventAnalytics("超车速度阈值", true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return super.onPreferenceClick(preference)
|
||||
@@ -906,12 +1056,14 @@ class OperatePanelLayout : LinearLayout {
|
||||
hmiAction("SOP PNC-park-会车, ", isChecked)
|
||||
CallerAutoPilotControlManager.sendParkVehCross(isChecked)
|
||||
FunctionBuildConfig.isOpenParkVehCross = isChecked
|
||||
return true
|
||||
}
|
||||
KEY_PNC_PARK_OVERTAKE_CAR -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
hmiAction("SOP PNC-park-超车, ", isChecked)
|
||||
CallerAutoPilotControlManager.sendParkVehOvertake(isChecked)
|
||||
FunctionBuildConfig.isOpenOvertake = isChecked
|
||||
return true
|
||||
}
|
||||
KEY_DETOUR_RETARD_PARK -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
@@ -919,8 +1071,14 @@ class OperatePanelLayout : LinearLayout {
|
||||
CallerAutoPilotControlManager.sendDetouring(isChecked)
|
||||
FunctionBuildConfig.isDetouring = isChecked
|
||||
clickEventAnalytics("绕障类功能", isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_RAIN_DAY -> {
|
||||
val isPressed = preference.extras.getBoolean("is_pressed", true)
|
||||
if (!isPressed) {
|
||||
preference.extras.remove("is_pressed")
|
||||
return true
|
||||
}
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
hmiAction("SOP 雨天模式开关, ", isChecked)
|
||||
clickEventAnalytics("雨天模式", isChecked)
|
||||
@@ -928,6 +1086,7 @@ class OperatePanelLayout : LinearLayout {
|
||||
CallerAutoPilotControlManager.setRainMode(isChecked)
|
||||
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_RAIN, isChecked)
|
||||
CallerSopSettingManager.invokeRainModeListener(isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_WEAK_NET_DECELERATION_PARK -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
@@ -935,6 +1094,7 @@ class OperatePanelLayout : LinearLayout {
|
||||
CallerAutoPilotControlManager.sendWeakNetSlowDown(isChecked)
|
||||
hmiAction("SOP 弱网减速停车, ", isChecked)
|
||||
clickEventAnalytics("弱网减速停车", isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_FAULT_DECELERATION_PARK -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
@@ -942,6 +1102,7 @@ class OperatePanelLayout : LinearLayout {
|
||||
CallerAutoPilotControlManager.sendBreakdownSlowDown(isChecked)
|
||||
hmiAction("SOP 故障减速停车, ", isChecked)
|
||||
clickEventAnalytics("故障减速停车", isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_EXAM_FUNCTION_PANEL -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
@@ -949,36 +1110,42 @@ class OperatePanelLayout : LinearLayout {
|
||||
CallerDevaToolsManager.showExamControlWindow(isChecked)
|
||||
hmiAction("SOP 考试功能面板, ", isChecked)
|
||||
clickEventAnalytics("考试功能面板", isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_ALL_MERGE_MODE -> {
|
||||
FunctionBuildConfig.fusionMode = 1
|
||||
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
|
||||
clickEventAnalytics("融合模式", true)
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
return true
|
||||
}
|
||||
KEY_BLIND_AREA_MODE -> {
|
||||
FunctionBuildConfig.fusionMode = 2
|
||||
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
|
||||
clickEventAnalytics("融合模式", true)
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
return true
|
||||
}
|
||||
KEY_BEYOND_VISUAL_RANGE_MODE -> {
|
||||
FunctionBuildConfig.fusionMode = 3
|
||||
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
|
||||
clickEventAnalytics("融合模式", true)
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
return true
|
||||
}
|
||||
KEY_TRANSPARENT_TRANSFER_MODE -> {
|
||||
FunctionBuildConfig.fusionMode = 4
|
||||
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
|
||||
clickEventAnalytics("融合模式", true)
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
return true
|
||||
}
|
||||
KEY_PURE_OBU_MODE -> {
|
||||
FunctionBuildConfig.fusionMode = 5
|
||||
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
|
||||
clickEventAnalytics("融合模式", true)
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return super.onPreferenceChange(preference, newValue)
|
||||
|
||||
@@ -21,24 +21,34 @@ class PreferenceWithSpeedSetting : Preference {
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
private var mDefaultValueSet: Any? = null
|
||||
private var mSpeedData: Any? = null
|
||||
private var mFlag = true
|
||||
|
||||
override fun setDefaultValue(defaultValue: Any?) {
|
||||
super.setDefaultValue(defaultValue)
|
||||
mDefaultValueSet = defaultValue
|
||||
mSpeedData = defaultValue
|
||||
notifyChanged()
|
||||
}
|
||||
|
||||
fun update(data: List<String>) {
|
||||
mSpeedData = data
|
||||
notifyChanged()
|
||||
}
|
||||
|
||||
override fun onSetInitialValue(defaultValue: Any?) {
|
||||
super.onSetInitialValue(defaultValue)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
val defaultSet = mDefaultValueSet ?: return
|
||||
if (defaultSet !is Set<*> || defaultSet.size != 4) {
|
||||
val speedData = mSpeedData ?: return
|
||||
if (speedData !is List<*> || speedData.size != 4) {
|
||||
throw AssertionError()
|
||||
}
|
||||
val min = (defaultSet.elementAt(0) as String).toFloat()
|
||||
val max = (defaultSet.elementAt(1) as String).toFloat()
|
||||
var cur = (defaultSet.elementAt(2) as String).toFloat()
|
||||
val step = (defaultSet.elementAt(3) as String).toFloat()
|
||||
val min = (speedData.elementAt(0) as String).toDouble()
|
||||
val max = (speedData.elementAt(1) as String).toDouble()
|
||||
var cur = (speedData.elementAt(2) as String).toDouble()
|
||||
val step = (speedData.elementAt(3) as String).toDouble()
|
||||
if (min > max) {
|
||||
throw AssertionError()
|
||||
}
|
||||
@@ -52,7 +62,7 @@ class PreferenceWithSpeedSetting : Preference {
|
||||
val btnOk = holder.findViewById(R.id.bt_ok)
|
||||
val speedLimit = holder.findViewById(R.id.tv_speed_limit) as? TextView
|
||||
if (speedLimit?.tag != null && speedLimit.tag is Float) {
|
||||
cur = max(cur, speedLimit.tag as Float)
|
||||
cur = max(cur, speedLimit.tag as Double)
|
||||
}
|
||||
speedLimit?.text = cur.toString()
|
||||
val minus = holder.findViewById(R.id.iv_speed_minus)
|
||||
@@ -83,11 +93,14 @@ class PreferenceWithSpeedSetting : Preference {
|
||||
speedLimit?.tag = addAfter
|
||||
speedLimit?.text = addAfter.toString()
|
||||
}
|
||||
btnOk.isEnabled = false
|
||||
if (mFlag) {
|
||||
mFlag = false
|
||||
btnOk.isEnabled = false
|
||||
}
|
||||
btnOk.setOnClickListener(null)
|
||||
btnOk.onClick {
|
||||
onPreferenceClickListener?.also {
|
||||
extras.putFloat(KEY_BUNDLE_CURRENT_VALUE, cur)
|
||||
extras.putDouble(KEY_BUNDLE_CURRENT_VALUE, cur)
|
||||
it.onPreferenceClick(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_86"
|
||||
android:layout_marginStart="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_112"
|
||||
android:layout_marginTop="@dimen/dp_56"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/recycler_view"
|
||||
android:paddingTop="0dip"
|
||||
app:pressed_enabled="false"
|
||||
android:paddingBottom="@dimen/dp_20" />
|
||||
@@ -2,6 +2,7 @@
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -11,6 +12,7 @@
|
||||
android:paddingBottom="@dimen/dp_25"
|
||||
android:paddingStart="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
app:pressed_enabled="false"
|
||||
android:background="@drawable/bg_operate_panel_preference_header"
|
||||
tools:text="地图效果"
|
||||
android:gravity="start"
|
||||
|
||||
@@ -27,18 +27,6 @@
|
||||
android:title="限速标识"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="self_routing_verify_mode"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="自主算路验证模式"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="look_around_360"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="360环视"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="weather_effect_switch"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
@@ -57,5 +45,23 @@
|
||||
android:title="无人化演练任务拉取时间间隔"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_radio_group_custom" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="self_routing_verify_mode"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="自主算路验证模式"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="sweeper_cloud_control"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="清扫车云控业务"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="look_around_360"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="360环视"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
</PreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
||||
@@ -441,4 +441,11 @@ object FunctionBuildConfig {
|
||||
@Volatile
|
||||
@JvmField
|
||||
var welcomeWords: String? = null
|
||||
|
||||
/**
|
||||
* 最大限速值
|
||||
*/
|
||||
@Volatile
|
||||
@JvmField
|
||||
var maxSpeedLimit: Double = 0.0
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import mogo.telematics.pad.MessagePad
|
||||
@@ -28,6 +29,7 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
|
||||
@Synchronized
|
||||
fun invokeAutopilotCarConfigData(carConfigResp: MessagePad.CarConfigResp) {
|
||||
mCarConfigResp = carConfigResp
|
||||
FunctionBuildConfig.maxSpeedLimit = carConfigResp.maxSpeedLimit
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user