diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 6d0f350cd6..ccbeca625e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -688,6 +688,19 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo return filteredRoutes; } + private List filterNearbyTransportRoutes(List routes, List filterFromRoutes) { + if (filterFromRoutes == null) { + return routes; + } + List filteredRoutes = new ArrayList<>(); + for (TransportStopRoute route : routes) { + if (!containsRef(filterFromRoutes, route.route)) { + filteredRoutes.add(route); + } + } + return filteredRoutes; + } + private boolean containsRef(List routes, TransportRoute transportRoute) { for (TransportStopRoute route : routes) { if (route.route.getRef().equals(transportRoute.getRef())) { @@ -1297,7 +1310,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo updateLocalRoutesBadges(localFilteredTransportStopRoutes, localColumnsPerRow); } if (nearbyTransportStopRoutes != null) { - updateNearbyRoutesBadges(maxLocalRows, filterTransportRoutes(nearbyTransportStopRoutes)); + updateNearbyRoutesBadges(maxLocalRows, filterNearbyTransportRoutes(nearbyTransportStopRoutes, localTransportStopRoutes)); } transportBadgesCreated = true; }