[BadCase]解决BadCase入口与OCH模块之间的显示问题

[BadCase]解决BadCase入口与OCH模块之间的显示问题

[BadCase]解决BadCase入口与OCH模块之间的显示问题

[BadCase]解决BadCase入口与OCH模块之间的显示问题
This commit is contained in:
renwj
2022-02-15 20:22:51 +08:00
parent 183edda70e
commit 107d5f7d90
9 changed files with 164 additions and 85 deletions

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.call.hmi
import android.view.View
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
@@ -16,16 +17,16 @@ import com.mogo.eagle.core.function.call.base.CallerBase
* HMI 调用者管理这里对外及其他模块提供功能的调用用啥写啥不要过度设计不允许直接将Provider暴露出去
*/
object CallerHmiManager : CallerBase() {
private val waringProviderApi: IMoGoWaringProvider
private val waringProviderApi
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI)
.navigation() as IMoGoWaringProvider;
.navigation() as? IMoGoWaringProvider;
/**
* 隐藏 脉速表
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setSpeedChartViewVisibility(visibility: Int) {
waringProviderApi.setSpeedChartViewVisibility(visibility)
waringProviderApi?.setSpeedChartViewVisibility(visibility)
}
/**
@@ -33,7 +34,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setAutopilotStatusViewVisibility(visibility: Int) {
waringProviderApi.setAutopilotStatusViewVisibility(visibility)
waringProviderApi?.setAutopilotStatusViewVisibility(visibility)
}
/**
@@ -41,7 +42,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setPerspectiveSwitchViewVisibility(visibility: Int) {
waringProviderApi.setPerspectiveSwitchViewVisibility(visibility)
waringProviderApi?.setPerspectiveSwitchViewVisibility(visibility)
}
/**
@@ -49,21 +50,21 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setToolsViewVisibility(visibility: Int) {
waringProviderApi.setToolsViewVisibility(visibility)
waringProviderApi?.setToolsViewVisibility(visibility)
}
/**
* 控制转向灯和刹车功能
*/
fun setTurnLightFunction(isOpen: Boolean) {
waringProviderApi.setTurnLightFunction(isOpen)
waringProviderApi?.setTurnLightFunction(isOpen)
}
/**
* 开关DebugView
*/
fun toggleDebugView(){
waringProviderApi.toggleDebugView()
waringProviderApi?.toggleDebugView()
}
/**
@@ -75,7 +76,7 @@ object CallerHmiManager : CallerBase() {
* @param tag tag绑定弹窗的标志
*/
fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) {
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
waringProviderApi?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
}
/**
@@ -83,7 +84,7 @@ object CallerHmiManager : CallerBase() {
* @param tag 弹窗标识
*/
fun disableWarningV2X(tag: String?) {
waringProviderApi.disableWarningV2X(tag)
waringProviderApi?.disableWarningV2X(tag)
}
/**
@@ -92,42 +93,42 @@ object CallerHmiManager : CallerBase() {
* @param checkLightId 0-都是默认1-红2-黄3-绿
*/
fun showWarningTrafficLight(checkLightId: Int) {
waringProviderApi.showWarningTrafficLight(checkLightId)
waringProviderApi?.showWarningTrafficLight(checkLightId)
}
/**
* 关闭红绿灯预警
*/
fun disableWarningTrafficLight() {
waringProviderApi.disableWarningTrafficLight()
waringProviderApi?.disableWarningTrafficLight()
}
/**
* 红绿灯是否展示
*/
fun isWarningTrafficLightShow(): Boolean {
return waringProviderApi.isWarningTrafficLightShow()
return waringProviderApi?.isWarningTrafficLightShow() ?: false
}
/**
* 修改红灯倒计时
*/
fun changeCountdownRed(redNum: Int) {
waringProviderApi.changeCountdownRed(redNum)
waringProviderApi?.changeCountdownRed(redNum)
}
/**
* 修改黄灯倒计时
*/
fun changeCountdownYellow(yellowNum: Int) {
waringProviderApi.changeCountdownYellow(yellowNum)
waringProviderApi?.changeCountdownYellow(yellowNum)
}
/**
* 修改绿灯倒计时
*/
fun changeCountdownGreen(greenNum: Int) {
waringProviderApi.changeCountdownGreen(greenNum)
waringProviderApi?.changeCountdownGreen(greenNum)
}
/**
@@ -136,7 +137,7 @@ object CallerHmiManager : CallerBase() {
* @param greenNum 绿灯倒计时
*/
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
waringProviderApi.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
@@ -145,14 +146,14 @@ object CallerHmiManager : CallerBase() {
* @param limitingSpeed 限速速度
*/
fun showLimitingVelocity(limitingSpeed: Int) {
waringProviderApi.showLimitingVelocity(limitingSpeed)
waringProviderApi?.showLimitingVelocity(limitingSpeed)
}
/**
* 关闭限速预警
*/
fun disableLimitingVelocity() {
waringProviderApi.disableLimitingVelocity()
waringProviderApi?.disableLimitingVelocity()
}
/**
@@ -161,7 +162,7 @@ object CallerHmiManager : CallerBase() {
* @see WarningDirectionEnum
*/
fun showWarning(direction: WarningDirectionEnum) {
waringProviderApi.showWarning(direction)
waringProviderApi?.showWarning(direction)
}
/**
@@ -171,14 +172,14 @@ object CallerHmiManager : CallerBase() {
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
waringProviderApi.showWarning(direction, closeTime)
waringProviderApi?.showWarning(direction, closeTime)
}
/**
* 主动消失边框预警
*/
fun dismissWarning(direction: WarningDirectionEnum) {
waringProviderApi.dismissWarning(direction)
waringProviderApi?.dismissWarning(direction)
}
/**
@@ -187,7 +188,7 @@ object CallerHmiManager : CallerBase() {
* @param trafficStylePushData
*/
fun showTrafficBanner(trafficStylePushData: NoticeTrafficStylePushData?) {
waringProviderApi.showNoticeForTrafficWithData(trafficStylePushData)
waringProviderApi?.showNoticeForTrafficWithData(trafficStylePushData)
}
/**
@@ -195,21 +196,21 @@ object CallerHmiManager : CallerBase() {
*
*/
fun showNoticeNormalData(noticeNormal: NoticeNormalData) {
waringProviderApi.showNoticeNormalData(noticeNormal)
waringProviderApi?.showNoticeNormalData(noticeNormal)
}
/**
* 展示VIP标识
*/
fun vipIdentification(visible: Boolean) {
waringProviderApi.vipIdentification(visible)
waringProviderApi?.vipIdentification(visible)
}
/**
* 开启道路视频直播
*/
fun startRoadCameraLive(flvUrl: String) {
waringProviderApi.startRoadCameraLive(flvUrl)
waringProviderApi?.startRoadCameraLive(flvUrl)
}
/**
@@ -218,7 +219,7 @@ object CallerHmiManager : CallerBase() {
* @param light
*/
fun showTurnLight(light: Int) {
waringProviderApi.showTurnLight(light)
waringProviderApi?.showTurnLight(light)
}
/**
@@ -227,19 +228,19 @@ object CallerHmiManager : CallerBase() {
* @param brakeLight
*/
fun showBrakeLight(brakeLight: Int) {
waringProviderApi.showBrakeLight(brakeLight)
waringProviderApi?.showBrakeLight(brakeLight)
}
fun showNoSignalView() {
waringProviderApi.showNoSignView()
waringProviderApi?.showNoSignView()
}
fun showToolsView() {
waringProviderApi.showToolsView()
waringProviderApi?.showToolsView()
}
fun hideToolsView() {
waringProviderApi.hideToolsView()
waringProviderApi?.hideToolsView()
}
/**
@@ -253,8 +254,23 @@ object CallerHmiManager : CallerBase() {
*/
fun showAdUpgradeStatus(upgradeMode : Int, downloadStatus : Int,currentProgress : Int,totalProgress : Int
,downloadVersion : String,upgradeStatus : Int){
waringProviderApi.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
waringProviderApi?.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
}
/**
* 显示BadCase入口
*/
fun showBadCaseEntrance(entrance: View) {
waringProviderApi?.showBadCaseEntrance(entrance)
}
/**
* 注册badcase入口展示和隐藏的回调
* 当[onShow]被调用时,调用[showBadCaseEntrance]
* [onHide]回调不用关心,可以不注册
*/
fun registerBadCaseCallback(onShow:() -> Unit, onHide: (() -> Unit)?) {
waringProviderApi?.registerBadCaseCallback(onShow, onHide)
}
}