Add filter for nearby routes badges
This commit is contained in:
parent
2b3ab31b10
commit
fdd52c087c
1 changed files with 11 additions and 1 deletions
|
@ -688,6 +688,16 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
return filteredRoutes;
|
||||
}
|
||||
|
||||
private List<TransportStopRoute> filterNearbyTransportRoutes(List<TransportStopRoute> routes, List<TransportStopRoute> filterFromRoutes) {
|
||||
List<TransportStopRoute> filteredRoutes = new ArrayList<>();
|
||||
for (TransportStopRoute route : routes) {
|
||||
if (!containsRef(filterFromRoutes, route.route)) {
|
||||
filteredRoutes.add(route);
|
||||
}
|
||||
}
|
||||
return filteredRoutes;
|
||||
}
|
||||
|
||||
private boolean containsRef(List<TransportStopRoute> routes, TransportRoute transportRoute) {
|
||||
for (TransportStopRoute route : routes) {
|
||||
if (route.route.getRef().equals(transportRoute.getRef())) {
|
||||
|
@ -1297,7 +1307,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue