From 78ca976d63e1d70d61239fee7a2ca8bad6d9ccc6 Mon Sep 17 00:00:00 2001 From: Rafal Naniewicz Date: Sat, 9 Jun 2018 00:44:03 +0200 Subject: [PATCH 1/2] Fix wrong format, remove useless null check --- .../api/staticmap/v1/models/StaticMarkerAnnotation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotation.java b/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotation.java index 0fa2f0077..17ae11207 100644 --- a/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotation.java +++ b/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotation.java @@ -50,12 +50,12 @@ public String url() { Locale.US, "url-%s(%f,%f)", iconUrl(), lnglat().longitude(), lnglat().latitude()); } - if (color() != null && label() != null && !TextUtils.isEmpty(label())) { + if (color() != null && !TextUtils.isEmpty(label())) { url = String.format(Locale.US, "%s-%s+%s", name(), label(), color()); - } else if (label() != null && !TextUtils.isEmpty(label())) { + } else if (!TextUtils.isEmpty(label())) { url = String.format(Locale.US, "%s-%s", name(), label()); } else if (color() != null) { - url = String.format(Locale.US, "%s-%s", name(), color()); + url = String.format(Locale.US, "%s+%s", name(), color()); } else { url = name(); } From c83e53c3e9fedf9ab897e900cfbc9af1cdc29f6d Mon Sep 17 00:00:00 2001 From: Rafal Naniewicz Date: Sat, 9 Jun 2018 01:00:43 +0200 Subject: [PATCH 2/2] Improve static marker iteration so that index of is not invoked, fix duplicated marker bug --- .../java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java b/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java index bdfcf8bec..5beccaa4b 100644 --- a/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java +++ b/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java @@ -103,11 +103,11 @@ public HttpUrl url() { List annotations = new ArrayList<>(); if (staticMarkerAnnotations() != null) { - String[] markerStringArray = new String[staticMarkerAnnotations().size()]; + List markerStrings = new ArrayList<>(staticMarkerAnnotations().size()); for (StaticMarkerAnnotation marker : staticMarkerAnnotations()) { - markerStringArray[staticMarkerAnnotations().indexOf(marker)] = marker.url(); + markerStrings.add(marker.url()); } - annotations.addAll(Arrays.asList(markerStringArray)); + annotations.addAll(markerStrings); } if (staticPolylineAnnotations() != null) {