From afa066af1ea7aa345d40ee2794cfc46d86a4c7aa Mon Sep 17 00:00:00 2001 From: Tobrun Van Nuland Date: Fri, 24 Mar 2017 14:35:09 +0100 Subject: [PATCH] [android] - correct anchoring when Icon is updated --- .../com/mapbox/mapboxsdk/annotations/MarkerView.java | 9 +++++++++ .../mapbox/mapboxsdk/annotations/MarkerViewManager.java | 1 + 2 files changed, 10 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java index 220d3322cbf..30336d4ebd8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java @@ -389,6 +389,15 @@ public void setMapboxMap(MapboxMap mapboxMap) { } } + /** + * Invalidates the MarkerView resulting in remeasuring the View. + */ + void invalidate() { + width = height = 0; + offsetX = offsetY = MapboxConstants.UNMEASURED; + markerViewManager.invalidateViewMarkersInVisibleRegion(); + } + /** * Get the String representation of a MarkerView. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java index 0f1298eeaf8..3b77bc8a1d8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java @@ -233,6 +233,7 @@ public void updateIcon(@NonNull MarkerView markerView) { View convertView = markerViewMap.get(markerView); if (convertView != null && convertView instanceof ImageView) { ((ImageView) convertView).setImageBitmap(markerView.getIcon().getBitmap()); + markerView.invalidate(); } }