[2.13.0-arch-opt] merge

This commit is contained in:
zhongchao
2023-02-02 20:37:41 +08:00
parent d032e77f6e
commit 40e9fdb708
44 changed files with 455 additions and 740 deletions

View File

@@ -157,14 +157,6 @@
</intent-filter>
</receiver>
<!--转向灯和刹车-->
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.TurnLightBroadcastReceiver">
<intent-filter>
<action android:name="com.hmi.turnlight" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!--绑定车辆-->
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.BindingcarBroadcastReceiver">
<intent-filter>

View File

@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingcarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingcarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
/**
* 绑定车辆
@@ -31,9 +31,9 @@ class BindingcarBroadcastReceiver : BroadcastReceiver() {
type: Int
) {
if (type == 1) {
showBindingcarDialog()
showBindingCarDialog()
} else if (type == 2) {
showModifyBindingcarDialog()
showModifyBindingCarDialog()
}
}
}

View File

@@ -1,41 +0,0 @@
package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight
/**
* 转向灯,刹车
*
* @author lixiaopeng
*/
class TurnLightBroadcastReceiver : BroadcastReceiver() {
companion object {
private const val TAG = "TurnLightBroadcastReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
try {
val type = intent.getIntExtra("type", 0)
val lightInt = intent.getIntExtra("light", 0)
showTurnLight(type, lightInt)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun showTurnLight( //type 1,转向灯2刹车
type: Int,
lightInt: Int
) {
if (type == 1) {
showTurnLight(lightInt) //设置转向灯
} else if (type == 2) {
showBrakeLight(lightInt) //设置刹车信息
}
}
}

View File

@@ -47,7 +47,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
)
if (v2xIsShow) {
// 分发场景
dispatchShowWaring(v2xType, alertContent, ttsContent, tag)
dispatchShowWaring(v2xType, alertContent, ttsContent)
} else {
dispatchCloseWaring(tag)
}
@@ -75,7 +75,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?
) {
if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(1,DataSourceType.MAP)
@@ -90,7 +89,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
)
)
//预留调试入口
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent,
tag, null, true, 5000L)
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent)
}
}

View File

@@ -2,12 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
@@ -34,33 +29,26 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ToBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.bindingcar.UpgradeAppDialog
import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog
import com.mogo.eagle.core.function.hmi.ui.dispatch.DispatchDialogManager
import com.mogo.eagle.core.function.hmi.ui.notice.DispatchDialogManager
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.main.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.service_biz.BizConfig
import kotlinx.android.synthetic.main.fragment_hmi.*
import kotlinx.coroutines.*
@@ -83,39 +71,9 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
private val lastSpeakJob by lazy { AtomicReference<Job>() }
private var lastShowV2XJob: Job? = null
private var showingV2XTip: IReminder? = null
override fun initViews() {
}
/**
* ok
* 工控机重启返回结果
* @param code
* @param msg
*/
override fun showDockerRebootResult(code: Int, msg: String) {
ThreadUtils.runOnUiThread {
if (code >= -1) {
//重启成功
ToastUtils.showShort("重启成功")
} else {
//重启失败
msg.let {
ToastUtils.showShort(it)
}
}
}
}
/**
* ok
* 展示工控机监控上报数据
* @param errorReportList 错误级别上报数据列表
* @param warningReportList 提醒级别上报数据列表
* @param reportLevel 1:error级别 2:warning级别
*/
override fun showIPCReportWindow(
errorReportList: ArrayList<ReportEntity>,
warningReportList: ArrayList<ReportEntity>,
@@ -193,7 +151,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
v2xType: String,
alertContent: CharSequence?,
ttsContent: String?,
tag: String?,
listener: IMoGoWarningStatusListener?,
playTts: Boolean,
expireTime: Long
@@ -204,20 +161,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
val warningContent = alertContent
?: EventTypeEnumNew.getWarningContent(v2xType)
//占道施工预警
if (v2xType == "10006" || v2xType == "100061") {
val currentTime = System.currentTimeMillis() / 1000
val oldTime =
context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) }
if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒
context?.let { it ->
SharedPrefsMgr.getInstance(it)
.putLong("roadwork", System.currentTimeMillis() / 1000)
}
CallerAutoPilotControlManager.sendTripInfo(5, "", "", "", false)
}
}
if (warningContent.isEmpty()) {
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
return
@@ -232,22 +175,18 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
delay(expireTime)
}.also { itx ->
lastShowV2XJob = itx
}.invokeOnCompletion { _ ->
}.invokeOnCompletion {
listener?.onDismiss()
showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
}
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
val last = lastSpeakJob.get()
Log.d("CODE", "---- 0 ------: last: $last")
if (last != null && !last.isCompleted) {
Log.d("CODE", "---- 1 ------")
return
}
lifecycleScope.launch(Dispatchers.Default) {
Log.d("CODE", "---- 2 ------")
speak(it, ttsContent)
Log.d("CODE", "---- 3 ------")
}.also { itx ->
lastSpeakJob.set(itx)
}
@@ -274,150 +213,73 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
AIAssist.getInstance(ctx).speakTTSVoiceWithLevel(text, AIAssist.LEVEL2, voiceCallback)
} catch (t: Throwable) {
it.resumeWith(Result.success(Unit))
CallerLogger.d("$M_HMI$TAG", t.message)
CallerLogger.w("$M_HMI$TAG", t.message)
}
}
/**
* 关闭指定floatTag 的 VR下V2X预警弹窗
* @param tag 弹窗标识
*/
override fun disableWarningV2X(tag: String?) {
activity?.let {
WarningFloat.dismiss(tag)
}
CallerLogger.d("$M_HMI$TAG", "--- disableWarningV2X ---")
lifecycleScope.launch {
showingV2XTip?.takeIf { it.isShowing() }?.also { it.hide() }
}
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
*/
override fun showWarning(direction: WarningDirectionEnum) {
CallerLogger.d(TAG, "showWarning====")
flV2XWarningView?.showWarning(direction)
if (flV2XWarningView != null) {
flicker(flV2XWarningView)
}
}
/**
* 闪动动画
*/
fun flicker(view: View) {
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
view.startAnimation(alphaAnimation)
}
fun clearAnimation(view: View) {
view.clearAnimation()
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
* @param closeTime 倒计时
*/
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
flV2XWarningView?.showWarning(direction, closeTime)
flicker(flV2XWarningView)
}
override fun dismissWarning(direction: WarningDirectionEnum) {
flV2XWarningView?.dismissWarning(direction)
clearAnimation(flV2XWarningView)
}
/** todo----------------------------------------------- **/
/**
* ok
*/
override fun showDispatchDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
context?.let {
DispatchDialogManager.getInstance(it).showDialog(msgData)
}
}
/**
* ok
*/
override fun dismissDispatchDialog() {
context?.let {
DispatchDialogManager.getInstance(it).releaseDialog()
}
}
/**
* ok
* 展示云公告交警详情
* @param trafficStylePushData
*/
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) {
if (trafficStylePushData == null) {
return
}
ThreadUtils.runOnUiThread {
context?.let {
NoticeTrafficDialog.show(it, trafficStylePushData)
trafficStylePushData?.let {
ThreadUtils.runOnUiThread {
context?.let { it ->
NoticeTrafficDialog.show(it, trafficStylePushData)
}
}
}
}
/**
* ok
* 展示云公告详情
*/
override fun showNoticeNormalData(normalData: NoticeNormalData?) {
if (normalData == null) {
return
}
ThreadUtils.runOnUiThread {
context?.let {
NoticeCheckDialog.show(it, normalData)
normalData?.let {
ThreadUtils.runOnUiThread {
context?.let { it ->
NoticeCheckDialog.show(it, normalData)
}
}
}
}
/**
* ok
*/
override fun startRoadCameraLive(flvUrl: String) {
cameraLiveView.startRoadCameraLive(flvUrl)
}
/**
* ok
*/
override fun showNoSignView() {
cameraLiveView.showNoSignView()
}
/**
* ok
*/
override fun showToolsView() {
toolsView.showToolsFloat(context)
}
/**
* ok
*/
override fun hideToolsView() {
toolsView.dismiss()
}
/**
* ok
*/
@BizConfig(V2I, "", BIZ_RTS)
override fun showVideoDialog(infList: List<Infrastructure>) {
ThreadUtils.runOnUiThread {
@@ -427,125 +289,18 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
/** todo----------------------------------------------- **/
private var isLeftLight: Boolean = false
private var isRightLight: Boolean = false
private var isDisappare: Boolean = false
@Volatile
private var isVisualAngleChanged = false
/**
* 显示转向灯效果 if (HmiBuildConfig.isShowBadCaseView) {
*/
override fun showTurnLight(light: Int) {
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight"
)
ThreadUtils.runOnUiThread {
if (light == 1 || light == 2) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
CallerVisualAngleManager.changeVisualAngle(Turning(true))
}
} else {
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
}
if (light == 1) { //左转灯
if (!isLeftLight) {
isLeftLight = true
isRightLight = false
isDisappare = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light = 1"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
}
} else if (light == 2) { //右转灯
if (!isRightLight) {
isRightLight = true
isLeftLight = false
isDisappare = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light = 2"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
} else {
if (!isDisappare) { //默认 不亮灯
isDisappare = true
isLeftLight = false
isRightLight = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light other"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
}
}
private var isBrake: Boolean = false
/**
* 显示刹车效果
*/
override fun showBrakeLight(light: Int) {
ThreadUtils.runOnUiThread {
if (light == 1) { //刹车灯亮
if (!isBrake) {
isBrake = true
CallerLogger.d(
"${SceneConstant.M_DEVA}${"BrakeLight"}",
" showBrakeLight light = 1 "
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(0, 500)
}
} else {
if (isBrake) {//默认 不亮灯
isBrake = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"BrakeLight"}",
" showBrakeLight light != 1 "
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
//brakeView.setBrakeLight(light)
}
}
/** todo----------------------------------------------- **/
/**
* ok
*/
override fun showToBindingcarDialog() {
if (ContextHolderUtil.getContext() != null) {
ToBindingCarDialog.show(ContextHolderUtil.getContext())
}
}
/**
* ok
*/
override fun showModifyBindingcarDialog() {
if (ContextHolderUtil.getContext() != null) {
ModifyBindingCarDialog.show(ContextHolderUtil.getContext())
}
}
/**
* ok
* 升级app弹框
*/
override fun showUpgradeDialog(
name: String,
url: String,
@@ -556,22 +311,11 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
if (ContextHolderUtil.getContext() != null) {
UpgradeAppDialog.show(
ContextHolderUtil.getContext(),
name,
url,
title,
content,
installType
name, url, title, content, installType
)
}
}
/**
* ok
* 工控机镜像升级确认窗
* @param images 镜像列表
* @param padSn SN
* @param releaseId 任务ID
*/
override fun showAdUpgradeDialog(images: List<String>, padSn: String, releaseId: String) {
ThreadUtils.runOnUiThread {
if (ContextHolderUtil.getContext() != null) {
@@ -580,9 +324,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
/**
* ok
*/
override fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
ThreadUtils.runOnUiThread {
toolsView.showAdUpgradeStatus(ipcUpgradeStateInfo)
@@ -632,8 +373,4 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
?.commitAllowingStateLoss()
}
override fun onDestroy() {
super.onDestroy()
CallerLogger.d("$M_HMI$TAG", "onDestroy")
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.content.Context;
import android.text.TextUtils;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.app.Dialog;
import android.content.Context;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.content.Context;
import android.os.Handler;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import static com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU;
import static com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.view.View

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.turnlight
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
@@ -11,6 +11,7 @@ import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import kotlinx.android.synthetic.main.view_brake_light_status.view.*
@@ -47,6 +48,7 @@ class BrakeViewStatus @JvmOverloads constructor(
if (brakeLight == 1) { //刹车灯亮
if (!isBrake) {
isBrake = true
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(0, 500)
GlobalScope.launch(Dispatchers.Main) {
var appearAnimation = AlphaAnimation(0f, 1f)
appearAnimation.duration = 300
@@ -61,6 +63,7 @@ class BrakeViewStatus @JvmOverloads constructor(
} else { //不踩刹车,就消失
if (isBrake) {
isBrake = false
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
GlobalScope.launch(Dispatchers.Main) {
// scaleImageAndTv()
var disappearAnimation = AlphaAnimation(1f, 0f)

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.pnc
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet

View File

@@ -0,0 +1,99 @@
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.android.synthetic.main.view_steering_brake.view.*
import mogo.telematics.pad.MessagePad
/**
* 现阶段模型支持刹车与转向同时触发,现有逻辑中还存在两者优先级状态。后续通过各自实现,将去除优先级
* 刹车调用模型的逻辑暂时放入view。 转向不受影响
*/
class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs),
IMoGoChassisLamplightListener, IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "SteeringBrakeView"
}
private var isShowTurnLight = false
private var brakeLight = -1
init {
LayoutInflater.from(context).inflate(R.layout.view_steering_brake, this, true)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SteeringBrakeView)
val dayLight = typedArray.getBoolean(R.styleable.SteeringBrakeView_day_light_mode, false)
turnLightView.dayLightMode(dayLight)
typedArray.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerChassisLamplightListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车
brakeLight =
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f
)
) {
1
} else {
0
}
CallerLogger.d(
"$M_HMI$TAG",
"---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight
)
if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(brakeLight)
} else {
brakeView.visibility = View.GONE
}
}
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
CallerLogger.d("$M_HMI$TAG", "---lightSwitch.getNumber() = " + lightSwitch.number)
if (lightSwitch.number == 1 || lightSwitch.number == 2) {
isShowTurnLight = true
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(0)
} else {
brakeView.visibility = View.GONE
isShowTurnLight = false
}
turnLightView.visibility = View.VISIBLE
turnLightView.setTurnLight(lightSwitch)
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLamplightListenerManager.removeListener(TAG)
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.takeover
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
@@ -59,7 +59,6 @@ class TakeOverView @JvmOverloads constructor(
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts,
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
@@ -70,9 +69,7 @@ class TakeOverView @JvmOverloads constructor(
takeOver = false
visibility = View.GONE
}
},
true,
6000L
}
)
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.turnlight
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
@@ -10,12 +10,10 @@ import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import chassis.Chassis
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -28,82 +26,52 @@ import kotlinx.coroutines.launch
* @since 2022/1/10
*/
class TurnLightViewStatus @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status_daytime, this, true)
private var init: Boolean = false
fun dayLightMode(dayLight: Boolean) {
if (dayLight) {
LayoutInflater.from(context)
.inflate(R.layout.view_turn_light_status_daytime, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
}
invalidate()
init = true
}
private var isShowNormalBg :Boolean = false
private var isLeftLight :Boolean = false
private var isRightLight :Boolean = false
private var isDisappare :Boolean = false
@Volatile
private var isVisualAngleChanged = false
/**
* 转向灯动画
*/
fun setTurnLight(directionLight: Int) {
if (!isShowNormalBg && (directionLight == 1 || directionLight == 2)) {
isShowNormalBg = true
GlobalScope.launch(Dispatchers.Main) {
showNormalAnimation()
fun setTurnLight(directionLight: Chassis.LightSwitch) {
GlobalScope.launch(Dispatchers.Main) {
if (!init) {
return@launch
}
}
if (directionLight == 1 || directionLight == 2) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
CallerVisualAngleManager.changeVisualAngle(Turning(true))
}
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
if (directionLight == 1) { //左转向
if (!isLeftLight) {
isLeftLight = true
isRightLight = false
isDisappare = false
GlobalScope.launch(Dispatchers.Main) {
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
right_select_image.clearAnimation()
setAnimation(left_select_image)
}
}
} else if (directionLight == 2) { //右转向
if (!isRightLight) {
isRightLight = true
isLeftLight = false
isDisappare = false
GlobalScope.launch(Dispatchers.Main) {
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
left_select_image.clearAnimation()
setAnimation(right_select_image)
}
}
} else { //消失
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
if (!isDisappare) {
isDisappare = true
isShowNormalBg = false
isLeftLight = false
isRightLight = false
GlobalScope.launch(Dispatchers.Main) {
else -> { //消失
CallerVisualAngleManager.changeVisualAngle(Turning(false))
animationDisappear()
}
}
@@ -168,7 +136,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
override fun onAnimationEnd(p0: Animation?) {
turn_light_layout.visibility = View.GONE
// stopAnimate()
stopAnimate()
}
})
}
@@ -176,18 +144,14 @@ class TurnLightViewStatus @JvmOverloads constructor(
//实现图片闪烁效果
private fun setAnimation(imageView: ImageView) {
val animationSet = AnimatorSet()
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha",0f, 1.0f)
val valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha",1.0f, 0f)
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1.0f)
val valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha", 1.0f, 0f)
valueAnimator.duration = 1000
valueAnimatorDisappare.duration = 800
valueAnimator.repeatCount = -1
valueAnimatorDisappare.repeatCount = -1
animationSet.playTogether(valueAnimatorDisappare, valueAnimator)
animationSet.start()
}
private fun stopAnimate() {

View File

@@ -4,6 +4,9 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.widget.RelativeLayout
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
@@ -36,22 +39,13 @@ class V2XWarningView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.module_hmi_warning_v2x, this, true)
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
*/
fun showWarning(direction: WarningDirectionEnum) {
showWarning(direction, ALL_CLOSE_TIMER)
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
fun showWarning(direction: WarningDirectionEnum, closeTime: Long = ALL_CLOSE_TIMER) {
UiThreadHandler.post {
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
if (direction != ALERT_WARNING_NON) {
@@ -59,16 +53,8 @@ class V2XWarningView @JvmOverloads constructor(
postDelayed(closeWarningTask, closeTime)
}
when (direction) {
ALERT_WARNING_NON -> {
removeCallbacks(closeWarningTask)
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
ALERT_WARNING_NON ->{
// nothing
}
ALERT_WARNING_TOP -> {
hmiWarningTopImg.visibility = View.VISIBLE
@@ -150,7 +136,7 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
ALERT_WARNING_ALL -> { //todo problem
hmiWarningTopImg.visibility = View.VISIBLE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
@@ -161,6 +147,12 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningRightBottomImg.visibility = View.GONE
}
}
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
startAnimation(alphaAnimation)
}
}
@@ -171,11 +163,7 @@ class V2XWarningView @JvmOverloads constructor(
removeCallbacks(closeWarningTask)
when (direction) {
ALERT_WARNING_TOP -> {
// hmiWarningTopImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
// hmiWarningLeftTopImg.visibility = View.GONE
// hmiWarningLeftBottomImg.visibility = View.GONE
// hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_RIGHT -> {
hmiWarningRightImg.visibility = View.GONE
@@ -199,6 +187,10 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningLeftTopImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
@@ -208,5 +200,6 @@ class V2XWarningView @JvmOverloads constructor(
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
}
}
clearAnimation()
}
}

View File

@@ -16,31 +16,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--左右转向灯-->
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
android:id="@+id/turnLightView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车ui-->
<com.mogo.eagle.core.function.hmi.ui.turnlight.BrakeViewStatus
android:id="@+id/brakeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -74,7 +74,6 @@
android:layout_height="match_parent"
android:background="@drawable/main_splash_bg">
<ImageView
android:layout_width="@dimen/dp_157"
android:layout_height="@dimen/dp_255"
@@ -91,8 +90,6 @@
android:id="@+id/rvConnectInfo"
android:layout_width="1200dp"
android:layout_height="680dp"
android:layout_gravity="bottom"
/>
android:layout_gravity="bottom" />
</FrameLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--左右转向灯-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
android:id="@+id/turnLightView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车ui-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.BrakeViewStatus
android:id="@+id/brakeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -69,4 +69,8 @@
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<declare-styleable name="SteeringBrakeView">
<attr name="day_light_mode" format="boolean"/>
</declare-styleable>
</resources>

View File

@@ -7,7 +7,6 @@
<item name="android:windowBackground">@drawable/module_push_message_background</item>
</style>
<style name="TitleBig">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>