优化地图加载时机

This commit is contained in:
wangcongtao
2020-12-31 10:59:19 +08:00
parent a588c7f22b
commit 90c95f6324

View File

@@ -86,6 +86,7 @@ public class AMapViewWrapper implements IMogoMapView,
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -344,7 +345,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, true );
}
private void setUIMode( EnumMapUI ui ) {
@@ -697,7 +698,7 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
if ( checkAMapView() ) {
if ( checkAMapView() && mMapLoaded ) {
// 避免设置之后被其他初始化给重置为其他模式
UiThreadHandler.postDelayed( () -> {
MapStyleController.getInstance().onLocationChanged( location, this );
@@ -717,6 +718,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onMapLoaded() {
Logger.i( TAG, "autoop--onMapLoaded: " );
MogoMapListenerHandler.getInstance().onMapLoaded();
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
@@ -726,9 +728,6 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getBearing() );
Trace.endSection();
}
getMap().getUIController().setAnchorRate( 0.01f );
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
}
@Override