From f4f587f46dbde355bebd70e57cacf2ad788d0fd9 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 19 May 2017 12:23:47 +0200 Subject: [PATCH] [android] - remove marker from selected markers when removing marker from annotation manager. (#9047) --- .../com/mapbox/mapboxsdk/maps/AnnotationManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java index e811470d649..3694668a7e6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java @@ -92,6 +92,10 @@ void removeAnnotation(@NonNull Annotation annotation) { if (annotation instanceof Marker) { Marker marker = (Marker) annotation; marker.hideInfoWindow(); + if (selectedMarkers.contains(marker)) { + selectedMarkers.remove(marker); + } + if (marker instanceof MarkerView) { markerViewManager.removeMarkerView((MarkerView) marker); } @@ -118,6 +122,10 @@ void removeAnnotations(@NonNull List annotationList) { if (annotation instanceof Marker) { Marker marker = (Marker) annotation; marker.hideInfoWindow(); + if (selectedMarkers.contains(marker)) { + selectedMarkers.remove(marker); + } + if (marker instanceof MarkerView) { markerViewManager.removeMarkerView((MarkerView) marker); } @@ -138,6 +146,7 @@ void removeAnnotations() { Annotation annotation; int count = annotations.size(); long[] ids = new long[count]; + selectedMarkers.clear(); for (int i = 0; i < count; i++) { ids[i] = annotations.keyAt(i); annotation = annotations.get(ids[i]);