[android] #5084 - remove addMarkerViews, renamed addMarkerView to addMarker
This commit is contained in:
@@ -691,7 +691,7 @@ public class MapboxMap {
|
||||
*/
|
||||
@UiThread
|
||||
@NonNull
|
||||
public MarkerView addMarkerView(@NonNull BaseMarkerViewOptions markerOptions) {
|
||||
public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions) {
|
||||
MarkerView marker = prepareViewMarker(markerOptions);
|
||||
long id = mMapView.addMarker(marker);
|
||||
marker.setMapboxMap(this);
|
||||
@@ -749,58 +749,6 @@ public class MapboxMap {
|
||||
return markers;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Adds multiple markers to this map.
|
||||
* </p>
|
||||
* The marker's icon is rendered on the map at the location {@code Marker.position}.
|
||||
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
|
||||
*
|
||||
* @param markerOptionsList A list of marker options objects that defines how to render the markers.
|
||||
* @return A list of the {@code Marker}s that were added to the map.
|
||||
*/
|
||||
@UiThread
|
||||
@NonNull
|
||||
public List<Marker> addMarkerViews(@NonNull List<? extends BaseMarkerViewOptions> markerOptionsList) {
|
||||
int count = markerOptionsList.size();
|
||||
List<Marker> markers = new ArrayList<>(count);
|
||||
if (count > 0) {
|
||||
BaseMarkerViewOptions markerOptions;
|
||||
Marker marker;
|
||||
for (int i = 0; i < count; i++) {
|
||||
markerOptions = markerOptionsList.get(i);
|
||||
marker = markerOptions.getMarker();
|
||||
Icon icon = IconFactory.recreate("markerViewSettings", mViewMarkerBitmap);
|
||||
marker.setIcon(icon);
|
||||
markers.add(marker);
|
||||
}
|
||||
|
||||
if (markers.size() > 0) {
|
||||
long[] ids = mMapView.addMarkers(markers);
|
||||
|
||||
// if unittests or markers are correctly added to map
|
||||
if (ids == null || ids.length == markers.size()) {
|
||||
long id = 0;
|
||||
Marker m;
|
||||
for (int i = 0; i < markers.size(); i++) {
|
||||
m = markers.get(i);
|
||||
m.setMapboxMap(this);
|
||||
if (ids != null) {
|
||||
id = ids[i];
|
||||
} else {
|
||||
//unit test
|
||||
id++;
|
||||
}
|
||||
m.setId(id);
|
||||
mAnnotations.put(id, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mMarkerViewManager.invalidateViewMarkersInBounds();
|
||||
return markers;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Updates a marker on this map. Does nothing if the marker is already added.
|
||||
|
||||
Reference in New Issue
Block a user