Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ public void onAnnotationDragStarted(Circle annotation) {
}

@Override
public void onAnnotationDrag(Circle annotation) {
public boolean onAnnotationDrag(Circle annotation) {
draggableInfoTv.setText(String.format(
Locale.US,
"ID: %s\nLatLng:%f, %f",
annotation.getId(),
annotation.getLatLng().getLatitude(), annotation.getLatLng().getLongitude()));
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,13 @@ public void onAnnotationDragStarted(Symbol annotation) {
}

@Override
public void onAnnotationDrag(Symbol annotation) {
public boolean onAnnotationDrag(Symbol annotation) {
draggableInfoTv.setText(String.format(
Locale.US,
"ID: %s\nLatLng:%f, %f",
annotation.getId(),
annotation.getLatLng().getLatitude(), annotation.getLatLng().getLongitude()));
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,18 @@ boolean onMove(MoveGestureDetector detector) {
);

if (shiftedGeometry != null) {
Geometry oldGeometry = draggedAnnotation.geometry;
draggedAnnotation.setGeometry(
shiftedGeometry
);
annotationManager.internalUpdateSource();
if (!annotationManager.getDragListeners().isEmpty()) {
for (D d : annotationManager.getDragListeners()) {
d.onAnnotationDrag(draggedAnnotation);
if (!d.onAnnotationDrag(draggedAnnotation)) {
draggedAnnotation.setGeometry(oldGeometry);
stopDragging(draggedAnnotation);
return true;
}
}
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public interface OnAnnotationDragListener<T extends Annotation> {
* Called when an annotation dragging is in progress.
*
* @param annotation the annotation
* @return False if this drag should be canceled, true otherwise.
*/
void onAnnotationDrag(T annotation);
boolean onAnnotationDrag(T annotation);

/**
* Called when an annotation dragging has finished.
Expand Down