[Fix bug]修复instance.setArguments多次调用造成 fragment already add,问题

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-12 22:49:48 +08:00
parent a5b19d314b
commit c98edba935
5 changed files with 29 additions and 44 deletions

View File

@@ -16,15 +16,15 @@ import com.mogo.eagle.core.function.call.base.CallerBase
* HMI 调用者管理这里对外及其他模块提供功能的调用用啥写啥不要过度设计不允许直接将Provider暴露出去
*/
object CallerHmiManager : CallerBase() {
private val waringProviderApi: IMoGoWaringProvider
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation() as IMoGoWaringProvider;
private val waringProviderApi: IMoGoWaringProvider?
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation() as IMoGoWaringProvider
/**
* 隐藏 脉速表
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setSpeedChartViewVisibility(visibility: Int) {
waringProviderApi.setSpeedChartViewVisibility(visibility)
waringProviderApi?.setSpeedChartViewVisibility(visibility)
}
/**
@@ -32,7 +32,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setAutopilotStatusViewVisibility(visibility: Int) {
waringProviderApi.setAutopilotStatusViewVisibility(visibility)
waringProviderApi?.setAutopilotStatusViewVisibility(visibility)
}
/**
@@ -40,7 +40,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setPerspectiveSwitchViewVisibility(visibility: Int) {
waringProviderApi.setPerspectiveSwitchViewVisibility(visibility)
waringProviderApi?.setPerspectiveSwitchViewVisibility(visibility)
}
/**
@@ -48,7 +48,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setCheckStatusViewVisibility(visibility: Int) {
waringProviderApi.setCheckStatusViewVisibility(visibility)
waringProviderApi?.setCheckStatusViewVisibility(visibility)
}
/**
@@ -66,7 +66,7 @@ object CallerHmiManager : CallerBase() {
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
) {
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
waringProviderApi?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
}
/**
@@ -74,7 +74,7 @@ object CallerHmiManager : CallerBase() {
* @param tag 弹窗标识
*/
fun disableWarningV2X(tag: String?) {
waringProviderApi.disableWarningV2X(tag)
waringProviderApi?.disableWarningV2X(tag)
}
/**
@@ -83,35 +83,35 @@ 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 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)
}
/**
@@ -120,7 +120,7 @@ object CallerHmiManager : CallerBase() {
* @param greenNum 绿灯倒计时
*/
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
waringProviderApi.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
@@ -129,14 +129,14 @@ object CallerHmiManager : CallerBase() {
* @param limitingSpeed 限速速度
*/
fun showLimitingVelocity(limitingSpeed: Int) {
waringProviderApi.showLimitingVelocity(limitingSpeed)
waringProviderApi?.showLimitingVelocity(limitingSpeed)
}
/**
* 关闭限速预警
*/
fun disableLimitingVelocity() {
waringProviderApi.disableLimitingVelocity()
waringProviderApi?.disableLimitingVelocity()
}
/**
@@ -145,7 +145,7 @@ object CallerHmiManager : CallerBase() {
* @see WarningDirectionEnum
*/
fun showWarning(direction: WarningDirectionEnum) {
waringProviderApi.showWarning(direction)
waringProviderApi?.showWarning(direction)
}
/**
@@ -155,7 +155,7 @@ object CallerHmiManager : CallerBase() {
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
waringProviderApi.showWarning(direction, closeTime)
waringProviderApi?.showWarning(direction, closeTime)
}
/**
@@ -164,7 +164,7 @@ object CallerHmiManager : CallerBase() {
* @param trafficStylePushData
*/
fun showTrafficBanner(trafficStylePushData: NoticeTrafficStylePushData?) {
waringProviderApi.showNoticeForTrafficWithData(trafficStylePushData)
waringProviderApi?.showNoticeForTrafficWithData(trafficStylePushData)
}
/**
@@ -172,21 +172,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)
}
fun showNoSignalView() {
waringProviderApi.showNoSignView()
waringProviderApi?.showNoSignView()
}
}