diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 76abef2f0f..17128147db 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -521,7 +521,7 @@ public abstract class MenuController extends BaseMenuController implements Colla return null; } - private List getSubTransportStopRoutes(boolean nearby) { + protected List getSubTransportStopRoutes(boolean nearby) { List allRoutes = getTransportStopRoutes(); if (allRoutes != null) { List res = new ArrayList<>(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index 9c5d48894a..1123df3ac2 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -178,6 +178,24 @@ public class AmenityMenuController extends MenuController { return routes; } + @Override + protected List getSubTransportStopRoutes(boolean nearby) { + List allRoutes = getTransportStopRoutes(); + if (allRoutes != null) { + List res = new ArrayList<>(); + for (TransportStopRoute route : allRoutes) { + boolean isCurrentRouteLocal = route.refStop != null && route.refStop.getName().equals(route.stop.getName()); + if (!nearby && isCurrentRouteLocal) { + res.add(route); + } else if (nearby && route.refStop == null) { + res.add(route); + } + } + return res; + } + return null; + } + @Override public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { } @@ -261,6 +279,9 @@ public class AmenityMenuController extends MenuController { r.desc = useEnglishNames ? rs.getEnName(true) : rs.getName(); r.route = rs; r.stop = s; + if (amenity.getLocation().equals(s.getLocation()) || (isSubwayEntrance && type == TransportStopType.SUBWAY)) { + r.refStop = s; + } r.distance = dist; this.routes.add(r); }