diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index b9729cad17..df34d85e24 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -1,28 +1,21 @@ package com.mogo.eagle.core.function.hmi.ui import android.animation.Animator -import android.content.Context import android.text.TextUtils import android.util.Log import android.view.Gravity import android.view.View import android.view.WindowManager import android.view.animation.OvershootInterpolator -import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentActivity -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.constants.MogoServicePaths import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.function.hmi.WaringConst import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern @@ -39,38 +32,20 @@ import kotlinx.android.synthetic.main.fragment_hmi.* * @date 2021/8/3 2:40 下午 * 预警图层 */ -@Route(path = MogoServicePaths.PATH_HMI) class MoGoHmiFragment : MvpFragment(), - IMoGoWaringProvider, MoGoWarningContract.View { private val TAG = "MoGoHmiFragment" - private var mMoGoHmiFragment: MoGoHmiFragment? = null private var mWarningFloat: WarningFloat.Builder? = null private var cameraListView: CameraListView? = null private var cameraViewFloat: WarningFloat.Builder? = null - override fun init(context: Context?) { - Logger.d(TAG, "初始化蘑菇预警模块 ……") - } - override fun vipIdentification(visible: Boolean) { flVipIdentificationView.visibility = if (visible) View.VISIBLE else View.GONE } - override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment { - Logger.d(TAG, "初始化蘑菇HMI模块 Fragment……") - if (mMoGoHmiFragment == null) { - mMoGoHmiFragment = MoGoHmiFragment() - } - return mMoGoHmiFragment as MoGoHmiFragment - } - - override val functionName: String - get() = WaringConst.MODULE_NAME - override fun initViews() { ivCameraIcon.setOnClickListener { if (cameraViewFloat == null) { @@ -185,7 +160,7 @@ class MoGoHmiFragment : MvpFragment * 关闭指定floatTag 的 VR下V2X预警弹窗 * @param tag 弹窗标识 */ - override fun disableWarningV2X(tag: String?) { + override fun disableWarningV2X(tag: String) { activity?.let { WarningFloat.dismiss(tag) } @@ -272,7 +247,7 @@ class MoGoHmiFragment : MvpFragment * 展示云公告顶部弹窗 * @param trafficStylePushData */ - override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) { + override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData) { activity.let { val noticeBannerView = this.context?.let { it1 -> NoticeBannerView(it1) } noticeBannerView?.refreshWithData(trafficStylePushData) @@ -322,7 +297,7 @@ class MoGoHmiFragment : MvpFragment var floatView: NoticeFloatView? = null - override fun showNoticeNormalData(normalData: NoticeNormalData?) { + override fun showNoticeNormalData(normalData: NoticeNormalData) { if (floatView == null) { floatView = this.context?.let { NoticeFloatView(it) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt index b9916ef0da..1b4387a64e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt @@ -15,5 +15,128 @@ interface MoGoWarningContract { interface View : IView { + /** + * 隐藏 脉速表 + * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE + */ + fun setSpeedChartViewVisibility(visibility: Int) + + /** + * 隐藏 自动驾驶触发 按钮 + * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE + */ + fun setAutopilotStatusViewVisibility(visibility: Int) + + /** + * 隐藏 切换视角 按钮 + * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE + */ + fun setPerspectiveSwitchViewVisibility(visibility: Int) + + /** + * 隐藏 检测状态 按钮 + * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE + */ + fun setCheckStatusViewVisibility(visibility: Int) + + /** + * 展示VR下V2X预警 + * + * @param v2xType V2X类型 + * @param alertContent 提醒文本 + * @param ttsContent tts语音播报消息 + * @param tag tag绑定弹窗的标志 + */ + fun showWarningV2X( + v2xType: Int, + alertContent: String?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener? + ) + + /** + * 关闭指定floatTag 的 VR下V2X预警弹窗 + * @param tag 弹窗标识 + */ + fun disableWarningV2X(tag: String) + + /** + * 展示红绿灯预警 + * + * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 + */ + fun showWarningTrafficLight(checkLightId: Int) + + /** + * 关闭红绿灯预警 + */ + fun disableWarningTrafficLight() + + /** + * 修改红灯倒计时 + */ + fun changeCountdownRed(redNum: Int) + + /** + * 修改黄灯倒计时 + */ + fun changeCountdownYellow(yellowNum: Int) + + /** + * 修改绿灯倒计时 + */ + fun changeCountdownGreen(greenNum: Int) + + /** + * @param readNum 红灯倒计时 + * @param yellowNum 黄灯倒计时 + * @param greenNum 绿灯倒计时 + */ + fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) + + /** + * 展示限速预警 + * + * @param limitingSpeed 限速速度 + */ + fun showLimitingVelocity(limitingSpeed: Int) + + /** + * 关闭限速预警 + */ + fun disableLimitingVelocity() + + /** + * 展示指定方位上的红框预警 + * @param direction + * @see WarningDirectionEnum + */ + fun showWarning(direction: WarningDirectionEnum) + + /** + * 展示指定方位上的红框预警 + * @param direction + * @see WarningDirectionEnum + * @param closeTime 倒计时 + */ + fun showWarning(direction: WarningDirectionEnum, closeTime: Long) + + /** + * 展示云公告顶部弹窗 + * @param trafficStylePushData + */ + fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData) + + /** + * 展示普通云公告 + * @param normalData + */ + fun showNoticeNormalData(normalData: NoticeNormalData) + + /** + * 展示VIP标识 + */ + fun vipIdentification(visible: Boolean) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningProvider.kt new file mode 100644 index 0000000000..3e2fb2d602 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningProvider.kt @@ -0,0 +1,128 @@ +package com.mogo.eagle.core.function.hmi.ui + +import android.content.Context +import android.util.Log +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import com.alibaba.android.arouter.facade.annotation.Route +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.data.enums.WarningDirectionEnum +import com.mogo.eagle.core.data.notice.NoticeNormalData +import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData +import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider +import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener +import com.mogo.eagle.core.function.hmi.WaringConst +import com.mogo.utils.logger.Logger + +/** + * @author xiaoyuzhou + * @date 2021/8/2 5:52 下午 + * 预警模块 + */ +@Route(path = MogoServicePaths.PATH_HMI) +class MoGoWarningProvider : IMoGoWaringProvider { + private val TAG = "MoGoWarningProvider" + private var mMoGoHmiFragment: MoGoHmiFragment? = null + private var mContext: Context? = null + override fun init(context: Context) { + Logger.d(TAG, "初始化蘑菇预警模块 ……") + mContext = context + } + + override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? { + Logger.d(TAG, "初始化蘑菇预警模块 Fragment……") + mMoGoHmiFragment = MoGoHmiFragment() + return mMoGoHmiFragment + } + + override val functionName: String + get() = WaringConst.MODULE_NAME + + override fun showWarningTrafficLight(checkLightId: Int) { + mMoGoHmiFragment?.showWarningTrafficLight(checkLightId) + } + + override fun disableWarningTrafficLight() { + mMoGoHmiFragment?.disableWarningTrafficLight() + } + + override fun showLimitingVelocity(limitingSpeed: Int) { + mMoGoHmiFragment?.showLimitingVelocity(limitingSpeed) + } + + override fun disableLimitingVelocity() { + mMoGoHmiFragment?.disableLimitingVelocity() + } + + override fun changeCountdownRed(redNum: Int) { + mMoGoHmiFragment?.changeCountdownRed(redNum) + } + + override fun changeCountdownYellow(yellowNum: Int) { + mMoGoHmiFragment?.changeCountdownYellow(yellowNum) + } + + override fun changeCountdownGreen(greenNum: Int) { + mMoGoHmiFragment?.changeCountdownGreen(greenNum) + } + + override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) { + mMoGoHmiFragment?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum) + } + + override fun setSpeedChartViewVisibility(visibility: Int) { + mMoGoHmiFragment?.setSpeedChartViewVisibility(visibility) + } + + override fun setAutopilotStatusViewVisibility(visibility: Int) { + mMoGoHmiFragment?.setAutopilotStatusViewVisibility(visibility) + } + + override fun setPerspectiveSwitchViewVisibility(visibility: Int) { + mMoGoHmiFragment?.setPerspectiveSwitchViewVisibility(visibility) + } + + override fun setCheckStatusViewVisibility(visibility: Int) { + mMoGoHmiFragment?.setCheckStatusViewVisibility(visibility) + } + + override fun showWarningV2X( + v2xType: Int, alertContent: String?, + ttsContent: String?, tag: String?, + listenerIMoGo: IMoGoWarningStatusListener? + ) { + mMoGoHmiFragment?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo) + } + + override fun disableWarningV2X(tag: String?) { + mMoGoHmiFragment?.disableWarningV2X(tag!!) + } + + override fun showWarning(direction: WarningDirectionEnum) { + mMoGoHmiFragment?.showWarning(direction) + } + + override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) { + mMoGoHmiFragment?.showWarning(direction, closeTime) + } + + override fun showNoticeForTrafficWithData(pushData: NoticeTrafficStylePushData?) { + if (pushData != null) { + mMoGoHmiFragment?.showNoticeForTrafficWithData(pushData) + }; + } + + override fun showNoticeNormalData(normalData: NoticeNormalData?) { + if (normalData != null) { + mMoGoHmiFragment?.showNoticeNormalData(normalData) + } + } + + override fun vipIdentification(visible: Boolean) { + mMoGoHmiFragment?.vipIdentification(visible) + } + + override fun onDestroy() { + Log.d(TAG, "onDestroy") + } +} \ No newline at end of file