优化mapview初始化

This commit is contained in:
wangcongtao
2020-09-10 14:23:25 +08:00
parent f6ce6e4048
commit e66bbf304a
4 changed files with 11 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package com.mogo.map.impl.amap;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
@@ -32,6 +33,11 @@ public class AMapBaseMapView extends MogoBaseMapView {
@Override
protected IMogoMapView createMapView( Context context ) {
IMogoMapView mapView = AMapViewHandler.getMapView();
if ( mapView.getMapView().getParent() != null ) {
ViewGroup group = ( ViewGroup ) mapView.getMapView().getParent();
group.removeView( mapView.getMapView() );
}
return AMapViewHandler.getMapView();
}
}

View File

@@ -2,13 +2,12 @@ package com.mogo.map.impl.amap;
import android.content.Context;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.MapView;
import com.amap.api.navi.AMapNaviView;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.IMogoMapView;
public
/**
* @author congtaowang
* @since 2020/9/10
@@ -21,7 +20,7 @@ class AMapViewHandler {
public static void createMapView( Context context ) {
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
sMapView = new AMapViewWrapper( new TextureMapView( context ) );
sMapView = new AMapViewWrapper( new MapView( context ) );
} else {
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
}

View File

@@ -73,7 +73,7 @@ public class AMapViewWrapper implements IMogoMapView,
private static final String TAG = "AMapViewWrapper";
private final TextureMapView mMapView;
private final MapView mMapView;
private IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
@@ -88,7 +88,7 @@ public class AMapViewWrapper implements IMogoMapView,
.build();
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
public AMapViewWrapper( TextureMapView mapView ) {
public AMapViewWrapper( MapView mapView ) {
this.mMapView = mapView;
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
try {

View File

@@ -272,7 +272,7 @@ public class MogoServices implements IMogoMapListener,
/**
* 当前限速
*/
private int mCurrentLimit = 0;
private int mCurrentLimit = -1;
private boolean mIsMainPageFirstResume = true;
@@ -821,7 +821,6 @@ public class MogoServices implements IMogoMapListener,
return;
}
if ( mCurrentLimit == traffic.getSpeedLimit() ) {
return;
}