diff --git a/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/MoGoOCHNoopProvider.kt b/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/MoGoOCHNoopProvider.kt index 1abf670a2e..9ea1d1dfd3 100644 --- a/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/MoGoOCHNoopProvider.kt +++ b/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/MoGoOCHNoopProvider.kt @@ -4,18 +4,8 @@ import android.content.Context import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import com.alibaba.android.arouter.facade.annotation.Route -import com.mogo.commons.module.status.IMogoStatusChangedListener -import com.mogo.commons.module.status.MogoStatusManager -import com.mogo.commons.module.status.StatusDescriptor import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d -/** - * @author congtaowang - * @since 2021/1/15 - * - * - * 描述 - */ @Route(path = OCHConstants.PATH) class MoGoOCHNoopProvider : IMogoOCH { @@ -31,23 +21,8 @@ class MoGoOCHNoopProvider : IMogoOCH { private var activity: FragmentActivity? = null override fun init(context: Context) { - MogoStatusManager.getInstance().registerStatusChangedListener( - TAG, StatusDescriptor.VR_MODE, statusChangedListener - ) } - private val statusChangedListener = - IMogoStatusChangedListener { descriptor: StatusDescriptor, isTrue: Boolean -> - if (descriptor == StatusDescriptor.VR_MODE) { - // 进入vr模式默认显示网约车小巴fragment - if (isTrue) { - showFragment() - } else { - hideFragment() - } - } - } - private fun showFragment() { activity?.let { if (fragment == null) { @@ -72,17 +47,10 @@ class MoGoOCHNoopProvider : IMogoOCH { } } - private fun hideFragment() { - if (fragment != null) { - d(TAG, "准备hide fragment") - activity?.supportFragmentManager?.beginTransaction()?.hide(fragment!!) - ?.commitAllowingStateLoss() - } - } - override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? { this.containerId = containerId!! this.activity = activity + showFragment() return null } diff --git a/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/OchNoopFragment.kt b/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/OchNoopFragment.kt index 241a04a3a0..a716c3ba70 100644 --- a/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/OchNoopFragment.kt +++ b/OCH/mogo-och-noop/src/main/java/com/mogo/och/noop/OchNoopFragment.kt @@ -1,6 +1,5 @@ package com.mogo.och.noop -import android.view.View import com.mogo.commons.mvp.MvpFragment import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView import kotlinx.android.synthetic.main.och_noop_fragment_hmi.* @@ -29,21 +28,6 @@ class OchNoopFragment : MvpFragment(), ToggleDebugView.toggleDebugView.toggle(requireContext()) true } - -// cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked -> -// if (isChecked) { -// viewDriverMsgBoxList.visibility = View.VISIBLE -// viewDriverMsgBoxList.notifyData() -// viewDriverMsgBoxBubble.visibility = View.GONE -// viewDriverMsgBoxBubble.isShowData(false) -// MsgBoxTipView.visibility = View.GONE -// } else { -// viewDriverMsgBoxList.visibility = View.GONE -// viewDriverMsgBoxBubble.visibility = View.VISIBLE -// viewDriverMsgBoxBubble.isShowData(true) -// } -// } - } diff --git a/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml b/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml index fb8338a2b9..183611a077 100644 --- a/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml +++ b/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml @@ -14,6 +14,19 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> + + + + + - - { // 添加 - //显示警告红边 -// CallerHmiManager.showWarning(direction) //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 if (alertContent.isEmpty() || ttsContent.isEmpty()) { return @@ -583,7 +581,7 @@ class MogoPrivateObuNewManager private constructor() { var ttsContent: String = "" var changeVisualAngle = false when (appId) { - //交叉路口碰撞预警 + //前向碰撞预警 MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> { alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt index 0bad58b6b0..00021183f3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt @@ -35,10 +35,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo 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() { @@ -85,8 +81,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo brakeView.visibility = View.GONE isShowTurnLight = false } - turnLightView.visibility = View.VISIBLE - turnLightView.setTurnLight(lightSwitch) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt index e38d41ccbd..44650a105d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt @@ -11,9 +11,12 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import chassis.Chassis -import com.mogo.eagle.core.function.api.map.angle.* +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +import com.mogo.eagle.core.function.api.map.angle.Turning +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_steering_brake.view.* import kotlinx.android.synthetic.main.view_turn_light_status.view.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -29,29 +32,58 @@ class TurnLightViewStatus @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr) { +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener { - private var init: Boolean = false + companion object { + private const val TAG = "TurnLightViewStatus" + } - fun dayLightMode(dayLight: Boolean) { + private val visible: Boolean + + init { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TurnLightView) + val dayLight = typedArray.getBoolean(R.styleable.TurnLightView_day_light_mode, false) 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 + visible = typedArray.getBoolean(R.styleable.TurnLightView_visible, true) + if (visible) { + turn_light_layout.visibility = View.VISIBLE + } else { + turn_light_layout.visibility = View.GONE + } + typedArray.recycle() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerChassisLamplightListenerManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerChassisLamplightListenerManager.removeListener(TAG) + } + + override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { + super.onAutopilotLightSwitchData(lightSwitch) + lightSwitch?.let { + turnLightView.visibility = View.VISIBLE + setTurnLight(it) + } } /** * 转向灯动画 */ - fun setTurnLight(directionLight: Chassis.LightSwitch) { + private fun setTurnLight(directionLight: Chassis.LightSwitch) { + if (!isAttachedToWindow) { + return + } GlobalScope.launch(Dispatchers.Main) { - if (!init) { - return@launch - } //根据左右进行显示和隐藏,实际要判断每个来的时间和频度 when (directionLight) { Chassis.LightSwitch.LIGHT_LEFT -> { //左转向 @@ -135,7 +167,9 @@ class TurnLightViewStatus @JvmOverloads constructor( } override fun onAnimationEnd(p0: Animation?) { - turn_light_layout.visibility = View.GONE + if (visible) { + turn_light_layout.visibility = View.GONE + } stopAnimate() } }) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml index 4f2048218d..4e1a2e3835 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml @@ -69,9 +69,9 @@ @android:color/transparent - + - + diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt index 3164260e4d..72048fa8c4 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt @@ -93,7 +93,7 @@ class HttpDnsStartUp : AndroidStartup() { // 使用中台长链接 clientConfig.isUseOriginSocket = true // 设置是否输出网络日志 - clientConfig.isShowNetDebugLog = false + clientConfig.isShowNetDebugLog = true // clientConfig.passportUrl //todo yakun // clientConfig.socketBaseUrl // clientConfig.socketTechUrl