Add the ability to rename map markers on amenities

This commit is contained in:
alex 2018-03-06 16:20:28 +02:00
parent 6292c37028
commit b3850d4ce7
3 changed files with 21 additions and 4 deletions

View file

@ -832,9 +832,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
public void buttonWaypointPressed() {
if (object != null && object instanceof MapMarker) {
MapMarker marker = getMapMarker();
if (marker != null) {
RenameMarkerBottomSheetDialogFragment
.showInstance(mapActivity.getSupportFragmentManager(), (MapMarker) object);
.showInstance(mapActivity.getSupportFragmentManager(), marker);
} else if (settings.USE_MAP_MARKERS.get()) {
if (pointDescription.isMapMarker()) {
hide();
@ -856,6 +857,18 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
close();
}
@Nullable
private MapMarker getMapMarker() {
Object correspondingObj = menuController.getCorrespondingMapObject();
if (correspondingObj != null && correspondingObj instanceof MapMarker) {
return (MapMarker) correspondingObj;
}
if (object != null && object instanceof MapMarker) {
return (MapMarker) object;
}
return null;
}
public void buttonFavoritePressed() {
if (object != null && object instanceof FavouritePoint) {

View file

@ -239,6 +239,10 @@ public abstract class MenuController extends BaseMenuController implements Colla
protected abstract Object getObject();
protected Object getCorrespondingMapObject() {
return null;
}
public boolean isActive() {
return active;
}

View file

@ -93,8 +93,8 @@ public class AmenityMenuController extends MenuController {
}
@Override
public boolean isWaypointButtonEnabled() {
return marker == null;
protected Object getCorrespondingMapObject() {
return marker;
}
@Override