aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/cbaines/suma/BusRoute.java10
-rw-r--r--src/net/cbaines/suma/BusStopActivity.java13
2 files changed, 10 insertions, 13 deletions
diff --git a/src/net/cbaines/suma/BusRoute.java b/src/net/cbaines/suma/BusRoute.java
index ed6deeb..e1bf65b 100644
--- a/src/net/cbaines/suma/BusRoute.java
+++ b/src/net/cbaines/suma/BusRoute.java
@@ -122,10 +122,6 @@ public class BusRoute {
*/
Set<BusStop> moveInRoute(final Context context, final BusStop busStop, final int moveAmount) {
- if (!code.startsWith("U") || code.equals("U9")) {
- throw new RuntimeException("Route Movement not supported for " + code);
- }
-
Set<BusStop> busStops = new HashSet<BusStop>();
if (moveAmount == 0) {
@@ -185,6 +181,8 @@ public class BusRoute {
busStops.add(routeStopsFound.get(stopWanted).stop);
}
}
+
+ return busStops;
} catch (SQLException e) {
e.printStackTrace();
}
@@ -202,10 +200,6 @@ public class BusRoute {
*/
BusStop moveInRoute(final Context context, final BusStop busStop, String direction, final int moveAmount) {
- if (!code.startsWith("U") || code.equals("U9")) {
- throw new RuntimeException("Route Movement not supported for " + code);
- }
-
if (moveAmount == 0) {
return busStop;
}
diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java
index 5928033..9910ad3 100644
--- a/src/net/cbaines/suma/BusStopActivity.java
+++ b/src/net/cbaines/suma/BusStopActivity.java
@@ -24,6 +24,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;
@@ -351,14 +352,16 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme
for (BusRoute route : routes) {
try {
- BusStop tmpStop;
+ Set<BusStop> tmpStops;
if (item.getItemId() == R.id.menu_next_stop) {
- tmpStop = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, 1);
+ tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), 1);
} else {
- tmpStop = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, -1);
+ tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), -1);
}
- if (!busStops.contains(tmpStop)) {
- busStops.add(tmpStop);
+ for (BusStop busStop : tmpStops) {
+ if (!busStops.contains(busStop)) {
+ busStops.add(busStop);
+ }
}
} catch (SQLException e) {
e.printStackTrace();