From fef0d728ec6caa7df7f62d2a572e1317d127d0ae Mon Sep 17 00:00:00 2001 From: Cameron Mace Date: Wed, 2 May 2018 11:20:08 -0400 Subject: [PATCH 1/2] Only adds location source once the first location update occurs --- .../mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java index 8359791b5..aac2e8a9d 100644 --- a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java +++ b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java @@ -99,7 +99,6 @@ final class LocationLayer implements LocationLayerAnimator.OnLayerAnimationsValu void initializeComponents(LocationLayerOptions options) { prepareLocationSource(); - addLocationSource(); addLayers(); applyStyle(options); } From be22ff722969d0725b826da747462ac068e50688 Mon Sep 17 00:00:00 2001 From: Cameron Mace Date: Thu, 17 May 2018 09:31:24 -0700 Subject: [PATCH 2/2] change initial point value to inifinity to prevent null insland issue --- .../mapboxsdk/plugins/locationlayer/LocationLayer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java index aac2e8a9d..a4c9f3565 100644 --- a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java +++ b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.plugins.locationlayer; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.PointF; import android.graphics.drawable.Drawable; @@ -86,7 +87,10 @@ final class LocationLayer implements LocationLayerAnimator.OnLayerAnimationsValu private Context context; private final Map layerMap = new HashMap<>(); - private Feature locationFeature = Feature.fromGeometry(Point.fromLngLat(0, 0)); + @SuppressLint("Range") + private Feature locationFeature = Feature.fromGeometry( + Point.fromLngLat(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) + ); private GeoJsonSource locationSource; private boolean isSourceInitialized; @@ -99,6 +103,7 @@ final class LocationLayer implements LocationLayerAnimator.OnLayerAnimationsValu void initializeComponents(LocationLayerOptions options) { prepareLocationSource(); + addLocationSource(); addLayers(); applyStyle(options); }