diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index aec9e0f31a..8798ede32d 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -85,6 +85,7 @@ public class AMapViewWrapper implements IMogoMapView, private Location mLastDriveLocationShadow = null; private EnumMapUI mCurrentUI; + private boolean mIsLightStyle = false; public AMapViewWrapper( MapAutoView mMapView ) { startTime = System.currentTimeMillis(); @@ -326,10 +327,12 @@ public class AMapViewWrapper implements IMogoMapView, case Type_Light: mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false ); mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY ); + mIsLightStyle = true; break; case Type_Night: mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false ); mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT ); + mIsLightStyle = false; break; case Type_AUTO_LIGHT_Night: mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true ); @@ -775,6 +778,9 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onChangeMapStyle( int i ) { + + EnumMapUI last = mCurrentUI; + if ( i == MapAutoApi.MAP_STYLE_DAY || i == MapAutoApi.MAP_STYLE_DAY_NAV ) { mCurrentUI = EnumMapUI.Type_Light; @@ -788,6 +794,14 @@ public class AMapViewWrapper implements IMogoMapView, } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) { mCurrentUI = EnumMapUI.CarUp_3D; } + + // vr 模式切换到普通模式下,保持之前的白天模式 wtf. + if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) { + if ( mIsLightStyle ) { + changeMapMode( EnumMapUI.Type_Light ); + return; + } + } if ( mCurrentUI != null ) { UiThreadHandler.post( () -> { try { @@ -816,7 +830,11 @@ public class AMapViewWrapper implements IMogoMapView, } else { if ( mCurrentUI == EnumMapUI.Type_VR ) { changeZoom( 16 ); - changeMapMode( EnumMapUI.Type_Night ); + if ( mIsLightStyle ) { + changeMapMode( EnumMapUI.Type_Light ); + } else { + changeMapMode( EnumMapUI.Type_Night ); + } Logger.d( TAG, "自动切换为2D模式" ); } }