[2.13.0-arch-opt] turn light view opt and fix noop fragment bug

This commit is contained in:
zhongchao
2023-02-14 20:27:25 +08:00
parent 32991f784d
commit 7a44fc53b4
9 changed files with 63 additions and 80 deletions

View File

@@ -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
}

View File

@@ -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<OchNoopContract.View?, OchNoopPresenter?>(),
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)
// }
// }
}

View File

@@ -14,6 +14,19 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--V2X预警红色边框-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
android:layout_width="match_parent"
@@ -38,13 +51,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"

View File

@@ -58,7 +58,6 @@ dependencies {
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-data')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -354,8 +354,6 @@ class MogoPrivateObuNewManager private constructor() {
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
// 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)

View File

@@ -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)
}
}

View File

@@ -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()
}
})

View File

@@ -69,9 +69,9 @@
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<declare-styleable name="SteeringBrakeView">
<declare-styleable name="TurnLightView">
<attr name="day_light_mode" format="boolean"/>
<attr name="brakeView" format="boolean"/>
<attr name="visible" format="boolean"/>
</declare-styleable>
<declare-styleable name="PncActionsView">

View File

@@ -93,7 +93,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// 使用中台长链接
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
clientConfig.isShowNetDebugLog = true
// clientConfig.passportUrl //todo yakun
// clientConfig.socketBaseUrl
// clientConfig.socketTechUrl