Skip to content

Commit e184646

Browse files
authored
porting external PR #836 (#839)
1 parent fcd34bf commit e184646

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ public HttpUrl url() {
103103

104104
List<String> annotations = new ArrayList<>();
105105
if (staticMarkerAnnotations() != null) {
106-
String[] markerStringArray = new String[staticMarkerAnnotations().size()];
106+
List<String> markerStrings = new ArrayList<>(staticMarkerAnnotations().size());
107107
for (StaticMarkerAnnotation marker : staticMarkerAnnotations()) {
108-
markerStringArray[staticMarkerAnnotations().indexOf(marker)] = marker.url();
108+
markerStrings.add(marker.url());
109109
}
110-
annotations.addAll(Arrays.asList(markerStringArray));
110+
annotations.addAll(markerStrings);
111111
}
112112

113113
if (staticPolylineAnnotations() != null) {

services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public String url() {
5050
Locale.US, "url-%s(%f,%f)", iconUrl(), lnglat().longitude(), lnglat().latitude());
5151
}
5252

53-
if (color() != null && label() != null && !TextUtils.isEmpty(label())) {
53+
if (color() != null && !TextUtils.isEmpty(label())) {
5454
url = String.format(Locale.US, "%s-%s+%s", name(), label(), color());
55-
} else if (label() != null && !TextUtils.isEmpty(label())) {
55+
} else if (!TextUtils.isEmpty(label())) {
5656
url = String.format(Locale.US, "%s-%s", name(), label());
5757
} else if (color() != null) {
58-
url = String.format(Locale.US, "%s-%s", name(), color());
58+
url = String.format(Locale.US, "%s+%s", name(), color());
5959
} else {
6060
url = name();
6161
}

services-staticmap/src/test/java/com/mapbox/api/staticmap/v1/models/StaticMarkerAnnotationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void url_withColorOnlyFormattedCorrectly() throws Exception {
6363
Color.BLUE.getGreen(),
6464
Color.BLUE.getBlue())
6565
.build();
66-
assertTrue(staticMarkerAnnotation.url().contains("pin-m-0000FF(1.000000,2.000000)"));
66+
assertTrue(staticMarkerAnnotation.url().contains("pin-m+0000FF(1.000000,2.000000)"));
6767
}
6868

6969
@Test

0 commit comments

Comments
 (0)