Merge pull request #6191 from osmandapp/TransportBadgesImprovements
Transport badges improvements
This commit is contained in:
commit
b8a4acc4cb
1 changed files with 14 additions and 1 deletions
|
@ -688,6 +688,19 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
return filteredRoutes;
|
return filteredRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<TransportStopRoute> filterNearbyTransportRoutes(List<TransportStopRoute> routes, List<TransportStopRoute> filterFromRoutes) {
|
||||||
|
if (filterFromRoutes == null) {
|
||||||
|
return routes;
|
||||||
|
}
|
||||||
|
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) {
|
private boolean containsRef(List<TransportStopRoute> routes, TransportRoute transportRoute) {
|
||||||
for (TransportStopRoute route : routes) {
|
for (TransportStopRoute route : routes) {
|
||||||
if (route.route.getRef().equals(transportRoute.getRef())) {
|
if (route.route.getRef().equals(transportRoute.getRef())) {
|
||||||
|
@ -1297,7 +1310,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
updateLocalRoutesBadges(localFilteredTransportStopRoutes, localColumnsPerRow);
|
updateLocalRoutesBadges(localFilteredTransportStopRoutes, localColumnsPerRow);
|
||||||
}
|
}
|
||||||
if (nearbyTransportStopRoutes != null) {
|
if (nearbyTransportStopRoutes != null) {
|
||||||
updateNearbyRoutesBadges(maxLocalRows, filterTransportRoutes(nearbyTransportStopRoutes));
|
updateNearbyRoutesBadges(maxLocalRows, filterNearbyTransportRoutes(nearbyTransportStopRoutes, localTransportStopRoutes));
|
||||||
}
|
}
|
||||||
transportBadgesCreated = true;
|
transportBadgesCreated = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue