diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index f11faa9c65..01e72d1d4f 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -157,8 +157,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, AMapMessageManager.getInstance().registerAMapMessageListener( this ); - - } private Context getContext() { @@ -423,14 +421,19 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void showMyLocation( boolean visible ) { if ( checkAMapView() ) { - mMapView.getMap().setMyLocationEnabled( true ); - MyLocationStyle style = mMapView.getMap().getMyLocationStyle(); + mMapView.getMap().setMyLocationEnabled( visible ); + MyLocationStyle style = null; + if ( visible ) { + style = mMapView.getMap().getMyLocationStyle(); + } else { + style = new MyLocationStyle(); + } style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER ); - style.interval(1000); + style.interval( 1000 ); style.showMyLocation( visible ); style.strokeColor( Color.TRANSPARENT ); style.strokeWidth( 0 ); - style.showMyLocation(visible); + style.showMyLocation( visible ); style.radiusFillColor( Color.TRANSPARENT ); style.myLocationIcon( BitmapDescriptorFactory.fromResource( R.drawable.map_api_ic_current_location ) ); mMapView.getMap().setMyLocationStyle( style ); @@ -547,10 +550,10 @@ public class AMapNaviViewWrapper implements IMogoMapView, } @Override - public MogoLatLng getLocationMogoLatLngInScreen(Point point) { + public MogoLatLng getLocationMogoLatLngInScreen( Point point ) { if ( checkAMapView() ) { try { - return ObjectUtils.fromAMap(mMapView.getMap().getProjection().fromScreenLocation( point )); + return ObjectUtils.fromAMap( mMapView.getMap().getProjection().fromScreenLocation( point ) ); } catch ( Exception e ) { return null; }