From 6d82aea49a3d74bc44bd8432984d5afc6508cbf6 Mon Sep 17 00:00:00 2001 From: wangyanjun Date: Wed, 24 Jun 2020 19:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=B0=E5=9B=BE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/map/impl/custom/AMapViewWrapper.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index bc91cb2e9d..f53ad06e9d 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -6,6 +6,7 @@ import android.graphics.Rect; import android.location.Location; import android.os.Bundle; import android.os.SystemClock; +import android.os.Trace; import android.util.Log; import android.view.MotionEvent; import android.view.View; @@ -679,8 +680,15 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca if (!isLoaded) { isLoaded = true; MogoMapListenerHandler.getInstance().onMapLoaded(); - MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper(); - MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(mapAutoViewHelper.getCenter()), mapAutoViewHelper.getZoom(), 0, 0); + CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition(); + if ( cameraPosition != null ) { + Trace.beginSection( "timer.onCameraChangeFinish" ); + MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap( cameraPosition.getTarget() ), + cameraPosition.getZoom(), + cameraPosition.getTilt(), + cameraPosition.getBearing() ); + Trace.endSection(); + } } } @@ -704,5 +712,14 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca @Override public void onMapStatusChanged(int type, int value) { Log.i(TAG, "onMapStatusChanged: "+type+","+value); + CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition(); + if ( cameraPosition != null ) { + Trace.beginSection( "timer.onCameraChangeFinish" ); + MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap( cameraPosition.getTarget() ), + cameraPosition.getZoom(), + cameraPosition.getTilt(), + cameraPosition.getBearing() ); + Trace.endSection(); + } } }