added check for amenity in mapMultiSelectionMenu

This commit is contained in:
Chumva 2018-03-09 19:03:00 +02:00
parent b6cc4e4c14
commit 92500c00fa

View file

@ -2,7 +2,7 @@ package net.osmand.plus.mapcontextmenu.other;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.activities.MapActivity;
@ -12,7 +12,6 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
import net.osmand.plus.mapcontextmenu.MenuTitleController;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import net.osmand.plus.views.OsmandMapTileView;
import java.util.Collections;
import java.util.Comparator;
@ -118,12 +117,16 @@ public class MapMultiSelectionMenu extends BaseMenuController {
pointDescription = contextObject.getObjectName(selectedObj);
}
if (ll == null) {
ll = latLon;
if (selectedObj instanceof Amenity) {
Amenity a = ((Amenity) selectedObj);
ll = a.getLocation();
} else {
ll = latLon;
}
}
if (pointDescription == null) {
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude());
}
MenuObject menuObject = new MenuObject(ll, pointDescription, selectedObj, getMapActivity());
objects.add(menuObject);