vr切换到2d时保存地图的样式状态

This commit is contained in:
wangcongtao
2020-12-30 10:35:17 +08:00
parent 4148a2e158
commit fb91d54621

View File

@@ -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模式" );
}
}