Skip to content

Commit

Permalink
mapbox#894 - Initial port of selectAnnotation and removing auto displ…
Browse files Browse the repository at this point in the history
…ay of InfoWindow on long press marker addition in TestApp
  • Loading branch information
bleege authored and incanus committed Sep 7, 2015
1 parent 99f9d3b commit c5d3a1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ public Marker addMarker(MarkerOptions markerOptions) {
marker.setId(id); // the annotation needs to know its id
marker.setMapView(this); // the annotation needs to know which map view it is in
mAnnotations.add(marker);
selectAnnotation(marker);
return marker;
}

Expand Down Expand Up @@ -1968,8 +1967,21 @@ private void updateMap(MapChange change) {

private void selectAnnotation(Annotation annotation) {

// Need to deselect any currently selected annotation first
if (annotation == null) {
return;
}

if (annotation == mSelectedAnnotation) {
return;
}

if (annotation instanceof Marker) {
// Need to deselect any currently selected annotation first
deselectAnnotation();

((Marker)annotation).showInfoWindow();
mSelectedAnnotation = annotation;
}
}

private void deselectAnnotation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void onLongPress(final MotionEvent e) {
.position(position)
.title("Dropped Pin")
.snippet("Some snippet text.")
.sprite("default_marker")).showInfoWindow();
.sprite("default_marker"));
}
});

Expand Down

0 comments on commit c5d3a1c

Please sign in to comment.