From 68c31052833660a8c0d25f6cc55830f20c2c7658 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Wed, 19 Feb 2020 15:12:50 +0800 Subject: [PATCH] opt --- .../map/impl/amap/AMapNaviViewWrapper.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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; }