Add constant for max number of routes badges

This commit is contained in:
Chumva 2018-09-13 17:19:17 +03:00
parent 7db2c569a8
commit 2005ea4d0c

View file

@ -79,6 +79,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
public static final int ZOOM_IN_STANDARD = 17;
public static final int CURRENT_Y_UNDEFINED = Integer.MAX_VALUE;
private static final int MAX_TRANSPORT_ROUTES_BADGES = 6;
private View view;
private InterceptorLinearLayout mainView;
@ -669,9 +671,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private List<TransportStopRoute> filterTransportRoutes(List<TransportStopRoute> routes) {
List<TransportStopRoute> filteredRoutes = new ArrayList<>();
for (TransportStopRoute route : routes) {
if (filteredRoutes.size() < 6 && !containsRef(filteredRoutes, route.route)) {
if (!containsRef(filteredRoutes, route.route)) {
filteredRoutes.add(route);
}
if (filteredRoutes.size() >= MAX_TRANSPORT_ROUTES_BADGES) {
break;
}
}
return filteredRoutes;
}