[dev_arch_opt_3.0]优化顶视角切换逻辑
This commit is contained in:
@@ -18,6 +18,7 @@ import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -92,10 +93,13 @@ public class SweeperTrafficDataView extends ConstraintLayout
|
||||
if (lightSwitch != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
|
||||
if (lightSwitch.getNumber()==1){
|
||||
CallerVisualAngleManager.INSTANCE.showTurning(true);
|
||||
sweeperTurnSignal.showLeftSignal();
|
||||
}else if(lightSwitch.getNumber()==2){
|
||||
CallerVisualAngleManager.INSTANCE.showTurning(true);
|
||||
sweeperTurnSignal.showRightSignal();
|
||||
}else{
|
||||
CallerVisualAngleManager.INSTANCE.showTurning(false);
|
||||
sweeperTurnSignal.showDirection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.call.map.*
|
||||
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
|
||||
@@ -77,9 +78,11 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (lightSwitch.number == 1 || lightSwitch.number == 2) {
|
||||
isShowTurnLight = true
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
brakeView.visibility = View.VISIBLE
|
||||
brakeView.setBrakeLight(0)
|
||||
} else {
|
||||
CallerVisualAngleManager.showTurning(false)
|
||||
brakeView.visibility = View.GONE
|
||||
isShowTurnLight = false
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
|
||||
private val visible: Boolean
|
||||
|
||||
@Volatile
|
||||
private var isVisualAngleChanged: Boolean = false
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TurnLightView)
|
||||
val dayLight = typedArray.getBoolean(R.styleable.TurnLightView_day_light_mode, false)
|
||||
@@ -93,10 +90,7 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
|
||||
when (directionLight) {
|
||||
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
|
||||
if (!isVisualAngleChanged) {
|
||||
isVisualAngleChanged = true
|
||||
CallerVisualAngleManager.changeAngle(Turning(true))
|
||||
}
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
showNormalAnimation()
|
||||
left_select_image.visibility = View.VISIBLE
|
||||
right_select_image.visibility = View.GONE
|
||||
@@ -104,10 +98,7 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
setAnimation(left_select_image)
|
||||
}
|
||||
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
|
||||
if (!isVisualAngleChanged) {
|
||||
isVisualAngleChanged = true
|
||||
CallerVisualAngleManager.changeAngle(Turning(true))
|
||||
}
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
showNormalAnimation()
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.VISIBLE
|
||||
@@ -115,10 +106,7 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
setAnimation(right_select_image)
|
||||
}
|
||||
else -> { //消失
|
||||
if (isVisualAngleChanged) {
|
||||
isVisualAngleChanged = false
|
||||
CallerVisualAngleManager.changeAngle(Turning(false))
|
||||
}
|
||||
CallerVisualAngleManager.showTurning(false)
|
||||
animationDisappear()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Liste
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.map.MogoMapView
|
||||
|
||||
@@ -89,12 +89,15 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
lightSwitch?.let {
|
||||
when (it.number) {
|
||||
1 -> { //左转灯
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
|
||||
}
|
||||
2 -> { //右转灯
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
|
||||
}
|
||||
else -> {
|
||||
CallerVisualAngleManager.showTurning(false)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ object CallerVisualAngleManager {
|
||||
.navigation() as? IMoGoVisualAngleChangeProvider
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isVisualAngleChanged = false
|
||||
|
||||
fun changeAngle(scene: Scene) {
|
||||
provider?.changeAngle(scene)
|
||||
}
|
||||
@@ -21,4 +24,18 @@ object CallerVisualAngleManager {
|
||||
fun updateLongSightLevel(level: Boolean) {
|
||||
provider?.updateLongSightLevel(level)
|
||||
}
|
||||
|
||||
fun showTurning(open: Boolean) {
|
||||
if (open) {
|
||||
if (!isVisualAngleChanged) {
|
||||
isVisualAngleChanged
|
||||
changeAngle(Turning(true))
|
||||
}
|
||||
} else {
|
||||
if (isVisualAngleChanged) {
|
||||
isVisualAngleChanged = false
|
||||
changeAngle(Turning(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user