diff options
-rw-r--r-- | src/net/cbaines/suma/BusSpecificStopView.java | 4 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusStopSpecificStopView.java | 11 | ||||
-rw-r--r-- | src/net/cbaines/suma/DataManager.java | 29 | ||||
-rw-r--r-- | src/net/cbaines/suma/MapActivity.java | 2 |
4 files changed, 13 insertions, 33 deletions
diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index a939cde..ca8cdbb 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -119,7 +119,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener } public void onClick(View v) { - if (stop.bus.id != null) { + if (stop.bus != null) { context.makeToast(onClickMessage, onClickHelpMessage, Toast.LENGTH_SHORT); } else { context.makeToast(onClickMessage, Toast.LENGTH_SHORT); @@ -127,7 +127,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener } public boolean onLongClick(View v) { // TODO - if (stop.bus.id != null) { + if (stop.bus != null) { Uri uri = Uri.parse("geo:" + Util.E6IntToDouble(stop.busStop.point.getLatitudeE6()) + "," + Util.E6IntToDouble(stop.busStop.point.getLongitudeE6()) + "?z=18"); diff --git a/src/net/cbaines/suma/BusStopSpecificStopView.java b/src/net/cbaines/suma/BusStopSpecificStopView.java index 635d2e8..2124308 100644 --- a/src/net/cbaines/suma/BusStopSpecificStopView.java +++ b/src/net/cbaines/suma/BusStopSpecificStopView.java @@ -112,7 +112,7 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList public void onClick(View v) { Log.v(TAG, "onClick"); - if (stop.bus.id != null) { + if (stop.bus != null) { Log.v(TAG, "stop.bus != null"); context.makeToast(onClickMessage, onClickHelpMessage, Toast.LENGTH_SHORT); } else { @@ -131,12 +131,13 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList Log.i("StopView", "Bus route " + stop.bus.route + " Uni-Link " + stop.bus.route.uniLink + " Bus ID " + stop.bus.id); - if (stop.bus.id != null && stop.bus.route.uniLink) { + if (stop.bus != null && stop.bus.route.uniLink) { Uri uri = Uri.parse("http://id.southampton.ac.uk/bus/" + stop.bus.id); - Intent busStopIntent = new Intent(Intent.ACTION_VIEW, uri); - busStopIntent.putExtra("busStopID", stop.busStop.id); - context.startActivity(busStopIntent); + Intent busIntent = new Intent(Intent.ACTION_VIEW, uri); + busIntent.putExtra("busStopID", stop.busStop.id); + busIntent.putExtra("busRouteID", stop.bus.route.id); + context.startActivity(busIntent); } else { context.makeToast(onClickUnidentifiedMessage, Toast.LENGTH_SHORT); } diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index 984832c..97ebb54 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -72,7 +72,6 @@ public class DataManager { private static DatabaseHelper helper; private static Dao<BusRoute, Integer> busRouteDao; - private static Dao<Bus, Integer> busDao; private static Dao<BusStop, String> busStopDao; static void createDatabase(final Context context) throws SQLException, IOException { @@ -618,32 +617,12 @@ public class DataManager { Bus bus; if (stopObj.has("vehicle")) { busID = stopObj.getString("vehicle"); + } - QueryBuilder<Bus, Integer> busQueryBuilder = busDao.queryBuilder(); - busQueryBuilder.where().eq(Bus.ID_FIELD_NAME, busID); - PreparedQuery<Bus> busPreparedQuery = busQueryBuilder.prepare(); - - bus = busDao.queryForFirst(busPreparedQuery); + bus = new Bus(busID, route, dir); - if (bus == null) { - bus = new Bus(busID, route, dir); - bus.destination = destStop; - bus.destinationString = destString; - busDao.create(bus); - } else { - bus.destination = destStop; - bus.destinationString = destString; - bus.route = route; - bus.direction = dir; - busDao.update(bus); - } - - } else { - bus = new Bus(null, route, dir); - bus.destinationString = destString; - bus.destination = destStop; - busDao.create(bus); - } + bus.destinationString = destString; + bus.destination = destStop; stop = new Stop(bus, busStop, calender.getTime(), now, live); diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 6f712e5..21008e7 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -169,7 +169,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants // Other bits // Uni-Link routes - static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U2", "U6", "U9" }; + static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U1E", "U2", "U6", "U9" }; static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, SITE_OVERLAYS, OTHER_OVERLAYS }; |