[Update]增加了HMI的配置,对展示控件做到配置
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user