[Update]增加了HMI的配置,对展示控件做到配置

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-11 21:37:01 +08:00
parent 6360348ede
commit 1ea761520d
6 changed files with 79 additions and 27 deletions

2
.idea/misc.xml generated
View File

@@ -16,7 +16,7 @@
<entry key="OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml" value="0.1010068539349746" />
<entry key="OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml" value="0.19479166666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="1.0729233277594363" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="0.19466019417475727" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="0.18996305418719212" />

View File

@@ -1,7 +1,7 @@
### 鹰眼 (MOGO-Autopilot) 平台接入说明
```gradle
// 新版本架构SDK
MOGO_CORE_SDK_VERSION = 0.0.6
MOGO_CORE_SDK_VERSION = 0.0.9
// 所有UI展示层
com.mogo.eagle.core.function.impl:hmi:${MOGO_CORE_SDK_VERSION}
@@ -37,7 +37,7 @@ com.mogo.eagle.core:network:${MOGO_CORE_SDK_VERSION}
```gradle
MOGO_COMMONS_VERSION = 2.0.63
MOGO_COMMONS_VERSION = 2.0.66
tanluupload : "com.mogo.module:module-tanlu-upload:${MOGO_COMMONS_VERSION}",
// modules
moduleshare : "com.mogo.module:module-share:${MOGO_COMMONS_VERSION}",

View File

@@ -17,6 +17,7 @@ import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.Utils;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.config.HmiBuildConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.map.MapApiPath;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -102,6 +103,12 @@ public class MogoApplication extends AbsMogoApplication {
FunctionBuildConfig.gpsProvider = BuildConfig.GPS_PROVIDER;
// 配置BuglyAppID
CrashReportConstants.buglyAppID = "ac71228f85";
/* // TODO 这里是演示代码使用控制HMI展示元素
HmiBuildConfig.isShowSpeedView = false;
HmiBuildConfig.isShowAutopilotStatusView = false;
HmiBuildConfig.isShowPerspectiveSwitchView = false;
HmiBuildConfig.isShowCheckStatusView = false;*/
}
@Override

View File

@@ -14,6 +14,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticeNormalData
@@ -73,6 +74,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
get() = TAG
override fun initViews() {
initViewShowWithConfig()
ivCameraIcon.setOnClickListener {
if (cameraViewFloat == null) {
showCameraList(CallerMonitorManager.getCameraList())
@@ -80,6 +82,40 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
}
/**
* 根据配置文件初始化视图显示
*/
private fun initViewShowWithConfig() {
// 控制 速度 展示
if (HmiBuildConfig.isShowSpeedView) {
setSpeedChartViewVisibility(View.VISIBLE)
} else {
setSpeedChartViewVisibility(View.GONE)
}
// 控制 自动驾驶状态 展示
if (HmiBuildConfig.isShowAutopilotStatusView) {
setAutopilotStatusViewVisibility(View.VISIBLE)
} else {
setAutopilotStatusViewVisibility(View.GONE)
}
// 控制 切换视角 展示
if (HmiBuildConfig.isShowPerspectiveSwitchView) {
setPerspectiveSwitchViewVisibility(View.VISIBLE)
} else {
setPerspectiveSwitchViewVisibility(View.GONE)
}
// 控制 切换视角 展示
if (HmiBuildConfig.isShowCheckStatusView) {
setCheckStatusViewVisibility(View.VISIBLE)
} else {
setCheckStatusViewVisibility(View.GONE)
}
}
override fun getLayoutId(): Int {
return R.layout.fragment_hmi
}

View File

@@ -21,10 +21,8 @@ import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
import com.mogo.map.navi.IMogoCarLocationChangedListener2
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.utils.UiThreadHandler
import com.mogo.utils.logger.Logger
import java.util.*
/**
@@ -36,8 +34,7 @@ class SpeedPanelView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr),
IMogoCarLocationChangedListener2,
IMogoStatusChangedListener {
IMogoCarLocationChangedListener2 {
val TAG = "SpeedPanelView"
private var mMogoServiceApis: IMogoServiceApis =
ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
@@ -132,9 +129,6 @@ class SpeedPanelView @JvmOverloads constructor(
// 注册位置回调
mMogoServiceApis.registerCenterApi
.registerCarLocationChangedListener(TAG, this)
// 注册VR模式回调
mMogoServiceApis.statusManagerApi
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this)
// 开启定时查询速度
Timer().schedule(timerTask, Date(), 100)
@@ -145,8 +139,6 @@ class SpeedPanelView @JvmOverloads constructor(
// 解除注册
mMogoServiceApis.registerCenterApi
.unregisterMogoLocationListener(TAG)
mMogoServiceApis.statusManagerApi
.unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this)
try {
timerTask.cancel()
} catch (e: Exception) {
@@ -169,19 +161,4 @@ class SpeedPanelView @JvmOverloads constructor(
// }
}
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
UiThreadHandler.post {
if (descriptor == StatusDescriptor.VR_MODE) {
try {
visibility = if (isTrue) {
View.VISIBLE
} else {
View.GONE
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}
}

View File

@@ -0,0 +1,32 @@
package com.mogo.eagle.core.data.config
/**
* @author xiaoyuzhou
* @date 2021/8/24 8:59 下午
* 配置 HMI 展示元素
*/
object HmiBuildConfig {
/**
* 是否展示 速度
*/
@JvmField
var isShowSpeedView = true
/**
* 是否展示 自动驾驶 按钮
*/
@JvmField
var isShowAutopilotStatusView = true
/**
* 是否展示 切换视角 按钮
*/
@JvmField
var isShowPerspectiveSwitchView = true
/**
* 是否展示 检测状态 按钮
*/
@JvmField
var isShowCheckStatusView = true
}