diff --git a/.idea/misc.xml b/.idea/misc.xml index a8f4a9ee57..9d33ffd4e5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,6 +18,7 @@ + @@ -63,6 +64,7 @@ + diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index c13ea62bf3..84bbc7e6a2 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -49,6 +49,7 @@ dependencies { implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid implementation rootProject.ext.dependencies.androidxrecyclerview + implementation rootProject.ext.dependencies.flexbox kapt rootProject.ext.dependencies.aroutercompiler 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 249a07380e..2da3ff4c61 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 @@ -19,7 +19,6 @@ import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern 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.widget.V2XNotificationView -import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer import com.mogo.module.common.enums.EventTypeEnum import com.mogo.utils.logger.Logger import kotlinx.android.synthetic.main.fragment_hmi.* @@ -30,7 +29,7 @@ import kotlinx.android.synthetic.main.fragment_hmi.* * 预警图层 */ class MoGoHmiFragment : MvpFragment(), - MoGoWarningContract.View { + MoGoWarningContract.View { var mWarningFloat: WarningFloat.Builder? = null @@ -46,6 +45,23 @@ class MoGoHmiFragment : MvpFragment return WaringPresenter(this) } + override fun setSpeedChartViewVisibility(visibility: Int) { + viewSpeedChart.visibility = visibility + } + + override fun setAutopilotStatusViewVisibility(visibility: Int) { + viewAutopilotStatus.visibility = visibility + } + + override fun setPerspectiveSwitchViewVisibility(visibility: Int) { + viewPerspectiveSwitch.visibility = visibility + } + + override fun setCheckStatusViewVisibility(visibility: Int) { + viewCheckStatus.visibility = visibility + } + + /** * 展示VR下V2X预警 * @@ -56,11 +72,11 @@ class MoGoHmiFragment : MvpFragment */ @Synchronized override fun showWarningV2X( - v2xType: Int, - alertContent: String?, - ttsContent: String?, - tag: String?, - listenerIMoGo: IMoGoWarningStatusListener? + v2xType: Int, + alertContent: String?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener? ) { activity?.let { @@ -69,9 +85,9 @@ class MoGoHmiFragment : MvpFragment notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString())) notificationView.setWarningContent( - alertContent ?: EventTypeEnum.getWarningContent( - v2xType.toString() - ) + alertContent ?: EventTypeEnum.getWarningContent( + v2xType.toString() + ) ) if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) { @@ -79,47 +95,47 @@ class MoGoHmiFragment : MvpFragment } mWarningFloat = WarningFloat.with(it) - .setTag(tag) - .setLayout(notificationView) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(5000) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(listenerIMoGo) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 - Logger.d( - "MoGoWarningFragment", - "mWarningFloat = $mWarningFloat---ttsContent = $ttsContent" - ) - if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent)) { - Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent") - AIAssist.getInstance(activity) - .speakTTSVoice(ttsContent) - } + .setTag(tag) + .setLayout(notificationView) + .setSidePattern(SidePattern.RESULT_RIGHT) + .setCountDownTime(5000) + .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) + .setImmersionStatusBar(true) + .addWarningStatusListener(listenerIMoGo) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onShow() { + // 创建弹窗成功才进行TTS播报 + Logger.d( + "MoGoWarningFragment", + "mWarningFloat = $mWarningFloat---ttsContent = $ttsContent" + ) + if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent)) { + Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent") + AIAssist.getInstance(activity) + .speakTTSVoice(ttsContent) + } + } + }) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern)?.apply { + interpolator = OvershootInterpolator() } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern)?.apply { - interpolator = OvershootInterpolator() - } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200) + }) + .show() } } @@ -224,40 +240,41 @@ class MoGoHmiFragment : MvpFragment mWarningFloat = it?.let { it1 -> noticeBannerView?.let { it2 -> WarningFloat.with(it1) - .setTag(tag) - .setLayout(it2) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(5000) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(null) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 + .setTag(tag) + .setLayout(it2) + .setSidePattern(SidePattern.TOP) + .setCountDownTime(5000) + .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) + .setImmersionStatusBar(true) + .addWarningStatusListener(null) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onShow() { + // 创建弹窗成功才进行TTS播报 // AIAssist.getInstance(activity) // .speakTTSVoice("") + } + }) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern)?.apply { + interpolator = OvershootInterpolator() } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern)?.apply { - interpolator = OvershootInterpolator() - } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .show() } } } 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 ddfb1a48ca..c1692dae3f 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 @@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.hmi.ui import com.mogo.commons.mvp.IView import com.mogo.eagle.core.data.enums.WarningDirectionEnum -import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData 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.IMoGoWarningStatusListener @@ -15,6 +15,30 @@ 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预警 * @@ -24,11 +48,11 @@ interface MoGoWarningContract { * @param tag tag绑定弹窗的标志 */ fun showWarningV2X( - v2xType: Int, - alertContent: String?, - ttsContent: String?, - tag: String?, - listenerIMoGo: IMoGoWarningStatusListener? + v2xType: Int, + alertContent: String?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener? ) /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 7a9a29c71a..632ef0b305 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.setting import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.commons.AbsMogoApplication @@ -20,6 +21,7 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.obu.CallerOBUManager import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager import com.mogo.eagle.core.function.hmi.R @@ -36,7 +38,7 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.* /** * @author xiaoyuzhou * @date 2021/9/30 8:46 下午 - * 调试使用的设置页面,这里制作为调试使用 + * 调试使用的设置页面,这里只作为调试使用 * 展示 本机、网络、工控机、OBU等状态信息,支持设置IP,等参数进行调试 */ class DebugSettingView @JvmOverloads constructor( @@ -68,6 +70,46 @@ class DebugSettingView @JvmOverloads constructor( } private fun initView() { + btnOpenDebugSettingViewControl.setOnCheckedChangeListener { buttonView, isChecked -> + if (isChecked) { + flViewControl.visibility = View.VISIBLE + } else { + flViewControl.visibility = View.GONE + } + } + + tbSpeedView.setOnCheckedChangeListener { buttonView, isChecked -> + if (!isChecked) { + CallerHmiManager.setSpeedChartViewVisibility(View.VISIBLE) + } else { + CallerHmiManager.setSpeedChartViewVisibility(View.GONE) + } + } + + tbAutopilotStatusView.setOnCheckedChangeListener { buttonView, isChecked -> + if (!isChecked) { + CallerHmiManager.setAutopilotStatusViewVisibility(View.VISIBLE) + } else { + CallerHmiManager.setAutopilotStatusViewVisibility(View.GONE) + } + } + + tbPerspectiveSwitchView.setOnCheckedChangeListener { buttonView, isChecked -> + if (!isChecked) { + CallerHmiManager.setPerspectiveSwitchViewVisibility(View.VISIBLE) + } else { + CallerHmiManager.setPerspectiveSwitchViewVisibility(View.GONE) + } + } + + tbCheckStatusView.setOnCheckedChangeListener { buttonView, isChecked -> + if (!isChecked) { + CallerHmiManager.setCheckStatusViewVisibility(View.VISIBLE) + } else { + CallerHmiManager.setCheckStatusViewVisibility(View.GONE) + } + } + tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString() tvAutopilotInfo.text = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt index 5972766252..e3d944c691 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt @@ -50,6 +50,22 @@ class SpeedPanelView @JvmOverloads constructor( var mLatLng: Location? = null init { + initEvent(context) + + setBackgroundResource(R.drawable.yi_biao_pan_bg_nor) + mContext = context + mSpeedChartView = SpeedChartView(context) + + val layoutParams = LayoutParams( + resources.getDimension(R.dimen.module_ext_arcView_width).toInt(), + resources.getDimension(R.dimen.module_ext_arcView_height).toInt() + ) + layoutParams.gravity = Gravity.CENTER + mSpeedChartView.layoutParams = layoutParams + addView(mSpeedChartView) + } + + private fun initEvent(context: Context) { setOnLongClickListener { Log.d(TAG, "长按显示状态工具栏") context.let { @@ -93,18 +109,6 @@ class SpeedPanelView @JvmOverloads constructor( } true } - - setBackgroundResource(R.drawable.yi_biao_pan_bg_nor) - mContext = context - mSpeedChartView = SpeedChartView(context) - - val layoutParams = LayoutParams( - resources.getDimension(R.dimen.module_ext_arcView_width).toInt(), - resources.getDimension(R.dimen.module_ext_arcView_height).toInt() - ) - layoutParams.gravity = Gravity.CENTER - mSpeedChartView.layoutParams = layoutParams - addView(mSpeedChartView) } private val timerTask = object : TimerTask() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt index a2bf43faec..dade99b8a9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt @@ -1,18 +1,18 @@ package com.mogo.eagle.core.function.hmi.warning import android.content.Context -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider -import com.mogo.eagle.core.function.hmi.ui.MoGoHmiFragment import android.os.Bundle import android.util.Log import androidx.fragment.app.Fragment import com.alibaba.android.arouter.facade.annotation.Route -import com.mogo.eagle.core.function.hmi.WaringConst -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.data.enums.WarningDirectionEnum 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 /** @@ -71,6 +71,22 @@ class MoGoWarningProvider : IMoGoWaringProvider { 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?, diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index 232ea0f425..cd9c84cbd3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -15,7 +15,7 @@ app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toLeftOf="@+id/viewSpeedChart" + app:layout_constraintTop_toBottomOf="@+id/viewSpeedChart" /> @@ -12,6 +14,75 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> + + + + + + + + + + + + + + +