diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-02-29 16:31:18 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-02-29 16:31:18 +0000 |
commit | f58d7d1fc227ed7de50ef5d48a49ff6709f3197b (patch) | |
tree | 55375a1f49970e8f965fa6b5673898e9aa7f1547 /src | |
parent | cde3c08d7e9e486d7d1a795832ea1b767d96a4f3 (diff) | |
download | southamptonuniversitymap-f58d7d1fc227ed7de50ef5d48a49ff6709f3197b.tar southamptonuniversitymap-f58d7d1fc227ed7de50ef5d48a49ff6709f3197b.tar.gz |
Fix the bus stop movement, havent fully tested this yet as the live bus data is not working...
Diffstat (limited to 'src')
-rw-r--r-- | src/net/cbaines/suma/BusStopActivity.java | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index bfcc13a..d1f725e 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -93,7 +93,7 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme private CheckBox U9RouteRadioButton; private static final int POI_DIALOG_ID = 0; - private POIDialog busDialog; + private POIDialog busStopDialog; private HashSet<BusRoute> routes = new HashSet<BusRoute>(); @@ -397,15 +397,9 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme if (busStops.size() == 1) { - BusStop stop = (BusStop) busStops.iterator().next(); - if (stop == null) { - Log.e(TAG, "stop == null"); - } - if (stop.id == null) { - Log.e(TAG, "stop.id == null"); - } + BusStop nextBusStop = (BusStop) busStops.iterator().next(); - Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + busStop.id); + Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + nextBusStop.id); Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath()); @@ -414,14 +408,14 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme } else { showDialog(POI_DIALOG_ID); - if (busDialog == null) { + if (busStopDialog == null) { Log.e(TAG, "Very wierd, just tried to launch the favourite's dialog, but its null?"); return false; } - busDialog.setMessage(""); - busDialog.setItems(busStops); - busDialog.setTitle("Choose Bus Stop"); + busStopDialog.setMessage(""); + busStopDialog.setItems(busStops); + busStopDialog.setTitle("Choose Bus Stop"); Log.i(TAG, "Showing dialog"); } @@ -504,9 +498,9 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme protected Dialog onCreateDialog(int id) { switch (id) { case POI_DIALOG_ID: - busDialog = new POIDialog(instance); - busDialog.setOnItemClickListener(this); - return busDialog; + busStopDialog = new POIDialog(instance); + busStopDialog.setOnItemClickListener(this); + return busStopDialog; } return null; } @@ -514,16 +508,15 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.i(TAG, "OnItemClick pos " + position + " id " + id); - String busId = busDialog.adapter.getItemStringId(position); + String busStopID = busStopDialog.adapter.getItemStringId(position); - Log.i(TAG, "Bus " + busId + " selected"); + Log.i(TAG, "Bus " + busStopID + " selected"); - Uri uri = Uri.parse("http://id.southampton.ac.uk/bus/" + busId); + Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + busStopID); Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath()); Intent busStopIntent = new Intent(Intent.ACTION_VIEW, uri); - busStopIntent.putExtra("busStopID", busStop.id); startActivity(busStopIntent); } |