This commit is contained in:
wangcongtao
2020-09-14 14:10:14 +08:00
15 changed files with 78 additions and 37 deletions

View File

@@ -522,7 +522,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
if ( checkAMapView() ) {
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
MyLocationStyle style = getMyLocationStyle();
if ( style == null ) {
style = new MyLocationStyle();
}
@@ -544,7 +544,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
if ( checkAMapView() ) {
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
MyLocationStyle style = getMyLocationStyle();
if ( style == null ) {
style = new MyLocationStyle();
}
@@ -557,7 +557,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
public void initMyLocation() {
if ( checkAMapView() ) {
mMapView.getMap().setMyLocationEnabled( true );
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
MyLocationStyle style = getMyLocationStyle();
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
style.interval( 1000 );
style.anchor( 0.5F, 0.5F );
@@ -864,7 +864,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
if ( mMapView.getMap() == null ) {
return;
}
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
MyLocationStyle style = getMyLocationStyle();
if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
} else {
@@ -877,6 +877,20 @@ public class AMapNaviViewWrapper implements IMogoMapView,
mMapView.getMap().setMyLocationStyle( style );
}
private MyLocationStyle getMyLocationStyle() {
MyLocationStyle style = null;
try {
style = mMapView.getMap().getMyLocationStyle();
} catch ( Exception e ) {
style = new MyLocationStyle();
} finally {
if ( style == null ) {
style = new MyLocationStyle();
}
return style;
}
}
@Override
public MapCameraPosition getMapCameraPosition() {
if ( checkAMapView() ) {

View File

@@ -465,10 +465,16 @@ public class AMapViewWrapper implements IMogoMapView,
}
private MyLocationStyle getMyLocationStyle() {
MyLocationStyle style = null;
try {
return mMapView.getMap().getMyLocationStyle();
style = mMapView.getMap().getMyLocationStyle();
} catch ( Exception e ) {
return new MyLocationStyle();
style = new MyLocationStyle();
} finally {
if ( style == null ) {
style = new MyLocationStyle();
}
return style;
}
}
@@ -790,7 +796,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( mMapView.getMap() == null ) {
return;
}
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
MyLocationStyle style = getMyLocationStyle();
if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
} else {

View File

@@ -82,8 +82,8 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMogoMarkerOptions = null;
}
if ( mMarker != null ) {
mMarker.remove();
mMarker.setObject( null );
mMarker.remove();
mMarker = null;
}
if ( mMovingPointOverlay != null ) {