diff options
author | Tobrun Van Nuland <tobrun.van.nuland@gmail.com> | 2016-07-22 16:16:59 +0200 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2016-07-24 09:43:49 +0200 |
commit | 82478e2ea74765f23bc2983cde515228b0badb0d (patch) | |
tree | b65917d215ed3510c4afad833f82335b3b4506ec /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations | |
parent | ea2ee649fab5852cfb630a944224d15b8eb677b6 (diff) | |
download | qtlocation-mapboxgl-82478e2ea74765f23bc2983cde515228b0badb0d.tar.gz |
[android] #5745 - allow selectMarker on MapboxMap to be called with a MarkerView
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java | 32 |
1 files changed, 30 insertions, 2 deletions
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 44de157e6b..c9ced6546b 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 @@ -191,10 +191,20 @@ public class MarkerViewManager { * @param marker the MarkerView object to select */ public void select(@NonNull MarkerView marker) { + select(marker, true); + } + + /** + * Animate a MarkerView to a selected state. + * + * @param marker the MarkerView object to select + * @param callbackToMap indicates if select marker must be called on MapboxMap + */ + public void select(@NonNull MarkerView marker, boolean callbackToMap) { final View convertView = markerViewMap.get(marker); for (MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) { if (adapter.getMarkerClass().equals(marker.getClass())) { - select(marker, convertView, adapter); + select(marker, convertView, adapter, callbackToMap); } } } @@ -210,9 +220,27 @@ public class MarkerViewManager { * @param adapter the adapter used to adapt the marker to the convertView */ public void select(@NonNull MarkerView marker, View convertView, MapboxMap.MarkerViewAdapter adapter) { + select(marker, convertView, adapter, true); + } + + + /** + * Animate a MarkerView to a selected state. + * <p> + * The {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter#onSelect(MarkerView, View, boolean)} will be called to execute an animation. + * </p> + * + * @param marker the MarkerView object to select + * @param convertView the View presentation of the MarkerView + * @param adapter the adapter used to adapt the marker to the convertView + * @param callbackToMap indicates if select marker must be called on MapboxMap + */ + public void select(@NonNull MarkerView marker, View convertView, MapboxMap.MarkerViewAdapter adapter, boolean callbackToMap) { if (convertView != null) { if (adapter.onSelect(marker, convertView, false)) { - mapboxMap.selectMarker(marker); + if (callbackToMap) { + mapboxMap.selectMarker(marker); + } } marker.setSelected(true); convertView.bringToFront(); |