[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

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