From a45dd30e4400e3a4d7e1b98cd22da30cf8010f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 17 Jul 2018 10:36:47 +0200 Subject: [android] harden map events creation --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 6cb09f2195..fc4b13a293 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -22,6 +22,7 @@ import com.mapbox.android.gestures.StandardScaleGestureDetector; import com.mapbox.android.telemetry.Event; import com.mapbox.android.telemetry.MapEventFactory; import com.mapbox.android.telemetry.MapState; +import com.mapbox.android.telemetry.MapboxTelemetry; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; @@ -886,11 +887,12 @@ final class MapGestureDetector { if (cameraPosition != null) { double zoom = cameraPosition.zoom; if (isZoomValid(zoom)) { + MapboxTelemetry telemetry = Telemetry.obtainTelemetry(); MapEventFactory mapEventFactory = new MapEventFactory(); LatLng latLng = projection.fromScreenLocation(focalPoint); MapState state = new MapState(latLng.getLatitude(), latLng.getLongitude(), zoom); state.setGesture(eventType); - Telemetry.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state)); + telemetry.push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state)); } } } -- cgit v1.2.1