diff options
Diffstat (limited to 'src/net/cbaines/suma/DataManager.java')
-rw-r--r-- | src/net/cbaines/suma/DataManager.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index f065b07..4959865 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -433,6 +433,9 @@ public class DataManager { helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); if (busRouteDao == null) busRouteDao = helper.getBusRouteDao(); + Dao<RouteStops, Integer> routeStopsDao = null; + if (routeStopsDao == null) + routeStopsDao = helper.getRouteStopsDao(); if (busDao == null) busDao = helper.getBusDao(); if (busStopDao == null) @@ -513,13 +516,11 @@ public class DataManager { BusStop destStop = null; if (destString.equals("Central Station")) { - destStop = busStopDao.queryForId("SNA19709"); + destStop = busStopDao.queryForId("SN120520"); } else if (destString.equals("Civic Centre")) { destStop = busStopDao.queryForId("SN120527"); } else if (destString.equals("City DG4")) { destStop = busStopDao.queryForId("HAA13579"); - } else if (destString.equals("Central Station")) { - destStop = busStopDao.queryForId("SN120520"); } else if (destString.equals("Airport")) { destStop = busStopDao.queryForId("HA030184"); } else if (destString.equals("City, Town Quay")) { @@ -540,6 +541,13 @@ public class DataManager { Log.e(TAG, "Unknown end dest " + destString + " for route " + route.code); } + QueryBuilder<RouteStops, Integer> routeStopsQueryBuilder = routeStopsDao.queryBuilder(); + routeStopsQueryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and().eq(RouteStops.STOP_ID_FIELD_NAME, destStop.id); + PreparedQuery<RouteStops> routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); + + List<RouteStops> routeStops = routeStopsDao.query(routeStopsPreparedQuery); + Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); + Date now = new Date(System.currentTimeMillis()); String busID = null; |