删除了MoGoWarningProvider.kt, 由MoGoHmiFragment接管处理。

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-08 20:32:04 +08:00
parent 8a693b5d94
commit 2089e2578e
10 changed files with 75 additions and 610 deletions

View File

@@ -1,26 +1,34 @@
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.Camera
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
import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeFloatView
import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.utils.logger.Logger
@@ -31,13 +39,38 @@ import kotlinx.android.synthetic.main.fragment_hmi.*
* @date 2021/8/3 2:40 下午
* 预警图层
*/
@Route(path = MogoServicePaths.PATH_V2X_WARNING)
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
IMoGoWaringProvider,
MoGoWarningContract.View {
private val TAG = "MoGoHmiFragment"
var mWarningFloat: WarningFloat.Builder? = null
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) {
@@ -152,7 +185,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* 关闭指定floatTag 的 VR下V2X预警弹窗
* @param tag 弹窗标识
*/
override fun disableWarningV2X(tag: String) {
override fun disableWarningV2X(tag: String?) {
activity?.let {
WarningFloat.dismiss(tag)
}
@@ -239,12 +272,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* 展示云公告顶部弹窗
* @param trafficStylePushData
*/
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData) {
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) {
activity.let {
val noticeBannerView = this.getContext()?.let { it1 -> NoticeBannerView(it1) }
if (noticeBannerView != null) {
noticeBannerView.refreshWithData(trafficStylePushData)
}
val noticeBannerView = this.context?.let { it1 -> NoticeBannerView(it1) }
noticeBannerView?.refreshWithData(trafficStylePushData)
mWarningFloat = it?.let { it1 ->
noticeBannerView?.let { it2 ->
WarningFloat.with(it1)
@@ -291,11 +322,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
var floatView: NoticeFloatView? = null
/**
* 展示普通公告
* @param normalData
*/
override fun showNoticeNormal(normalData: NoticeNormalData) {
override fun showNoticeNormalData(normalData: NoticeNormalData?) {
if (floatView == null) {
floatView = this.context?.let { NoticeFloatView(it) }
}
@@ -372,9 +399,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun onDestroy() {
super.onDestroy()
}
override fun vipIdentification(visible: Boolean) {
flVipIdentificationView.visibility = if (visible) View.VISIBLE else View.GONE
Log.d(TAG, "onDestroy")
}
}

View File

@@ -15,128 +15,5 @@ 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 showNoticeNormal(normalData: NoticeNormalData)
/**
* 展示VIP标识
*/
fun vipIdentification(visible: Boolean)
}
}

View File

@@ -1,130 +0,0 @@
package com.mogo.eagle.core.function.hmi.warning
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.camera.Camera
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.eagle.core.function.hmi.ui.MoGoHmiFragment
import com.mogo.utils.logger.Logger
/**
* @author xiaoyuzhou
* @date 2021/8/2 5:52 下午
* 预警模块
*/
@Route(path = MogoServicePaths.PATH_V2X_WARNING)
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?.showNoticeNormal(normalData)
}
}
override fun vipIdentification(visible: Boolean) {
mMoGoHmiFragment?.vipIdentification(visible)
}
override fun onDestroy() {
Log.d(TAG, "onDestroy")
}
}