[2.13.0-arch-opt]fix bug
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.view
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -11,15 +12,17 @@ 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.*
|
||||
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.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.map.MogoMapView
|
||||
|
||||
|
||||
class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs), IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener , LifecycleObserver {
|
||||
|
||||
companion object{
|
||||
class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener, LifecycleObserver {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MapBizView"
|
||||
}
|
||||
|
||||
@@ -34,7 +37,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
|
||||
}
|
||||
|
||||
private fun initMapView(){
|
||||
private fun initMapView() {
|
||||
map?.uiSettings?.let {
|
||||
//设置所有手势是否可用
|
||||
it.setAllGesturesEnabled(true)
|
||||
@@ -84,26 +87,47 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
setExtraGPSData(gnssInfo)
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isVisualAngleChanged = false
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
super.onAutopilotLightSwitchData(lightSwitch)
|
||||
lightSwitch?.let {
|
||||
when (it.number) {
|
||||
1 -> { //左转灯
|
||||
Chassis.LightSwitch.LIGHT_LEFT_VALUE -> { //左转灯
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
|
||||
showTurn(1)
|
||||
}
|
||||
2 -> { //右转灯
|
||||
CallerVisualAngleManager.showTurning(true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
|
||||
}
|
||||
else -> {
|
||||
Chassis.LightSwitch.LIGHT_RIGHT_VALUE -> { //右转灯
|
||||
CallerVisualAngleManager.showTurning(false)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
showTurn(2)
|
||||
|
||||
}
|
||||
Chassis.LightSwitch.LIGHT_NONE_VALUE -> {
|
||||
CallerVisualAngleManager.showTurning(false)
|
||||
hideTurn()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showTurn(lightNum: Int) {
|
||||
if (!isVisualAngleChanged) {
|
||||
isVisualAngleChanged = true
|
||||
when (lightNum) {
|
||||
1 -> CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
|
||||
2 -> CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideTurn() {
|
||||
if (isVisualAngleChanged) {
|
||||
isVisualAngleChanged = false
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
|
||||
Reference in New Issue
Block a user