fix empty local routes

This commit is contained in:
Chumva 2018-05-14 13:27:40 +03:00
parent 6dd770c36c
commit 1e86dab54d

View file

@ -321,6 +321,14 @@ public class MenuBuilder {
return routes.size() > 0;
}
private boolean showLocalTransportRoutes() {
return mapContextMenu.getLocalTransportStopRoutes().size() > 0;
}
private boolean showNearbyTransportRoutes() {
return mapContextMenu.getNearbyTransportStopRoutes().size() > 0;
}
void onHide() {
hidden = true;
}
@ -440,11 +448,12 @@ public class MenuBuilder {
protected void buildTopInternal(View view) {
if (showTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
if (collapsableView != null) {
if (showLocalTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
}
if (showNearbyTransportRoutes()) {
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS, app);
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
false, 0, false, null, true);
@ -850,11 +859,7 @@ public class MenuBuilder {
} else {
buildTransportRouteRows(view, nearbyTransportStopRoutes);
}
if (isNearbyRoutes && nearbyTransportStopRoutes.isEmpty()) {
return null;
} else {
return new CollapsableView(view, this, collapsed);
}
return new CollapsableView(view, this, collapsed);
}
private void buildTransportRouteRows(LinearLayout view, List<TransportStopRoute> routes) {