From fb91d546218d590bd8c23f7a8a3f85088f9251ae Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Wed, 30 Dec 2020 10:35:17 +0800 Subject: [PATCH] =?UTF-8?q?vr=E5=88=87=E6=8D=A2=E5=88=B02d=E6=97=B6?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=9C=B0=E5=9B=BE=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/map/impl/custom/AMapViewWrapper.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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模式" ); } }