diff --git a/enabler/src/de/schildbach/pte/VrsProvider.java b/enabler/src/de/schildbach/pte/VrsProvider.java index 00ab46a9..8bed8c3f 100644 --- a/enabler/src/de/schildbach/pte/VrsProvider.java +++ b/enabler/src/de/schildbach/pte/VrsProvider.java @@ -79,6 +79,8 @@ public class VrsProvider extends AbstractNetworkProvider @SuppressWarnings("serial") private static class Context implements QueryTripsContext { + private boolean canQueryLater = true; + private boolean canQueryEarlier = true; private Date lastDeparture = null; private Date firstArrival = null; public Location from; @@ -92,12 +94,12 @@ public class VrsProvider extends AbstractNetworkProvider public boolean canQueryLater() { - return true; + return this.canQueryLater; } public boolean canQueryEarlier() { - return true; + return this.canQueryEarlier; } public void departure(Date departure) @@ -125,6 +127,16 @@ public class VrsProvider extends AbstractNetworkProvider { return this.firstArrival; } + + public void disableEarlier() + { + this.canQueryEarlier = false; + } + + public void disableLater() + { + this.canQueryLater = false; + } } private static class LocationWithPosition @@ -948,6 +960,13 @@ public class VrsProvider extends AbstractNetworkProvider context.to = to; context.via = via; context.products = products; + if (trips.size() == 1) + { + if (dep) + context.disableLater(); + else + context.disableEarlier(); + } return new QueryTripsResult(header, uri.toString(), from, via, to, context, trips); } catch (final JSONException x)