aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusStopActivity.java
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-02-28 15:29:26 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-02-28 15:29:26 +0000
commited7638698d439d75ada5120121a137f8e6f09bf8 (patch)
tree623e1211bb6b61200cb693ab0f9c61ec00716f68 /src/net/cbaines/suma/BusStopActivity.java
parentb5d0db004eaf72e9eeff0dfd7f612591d670b139 (diff)
downloadsouthamptonuniversitymap-ed7638698d439d75ada5120121a137f8e6f09bf8.tar
southamptonuniversitymap-ed7638698d439d75ada5120121a137f8e6f09bf8.tar.gz
Improved URI stuff, and formating.
Diffstat (limited to 'src/net/cbaines/suma/BusStopActivity.java')
-rw-r--r--src/net/cbaines/suma/BusStopActivity.java30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java
index 62a0f54..55a0bd6 100644
--- a/src/net/cbaines/suma/BusStopActivity.java
+++ b/src/net/cbaines/suma/BusStopActivity.java
@@ -77,8 +77,6 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme
protected Timetable timetable;
private Timetable visibleTimetable;
- private Dao<BusStop, String> busStopDao;
-
private BusStop busStop;
private GetTimetableTask timetableTask;
@@ -205,10 +203,6 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme
}
}
- busStopDao = helper.getBusStopDao();
-
- busStop = busStopDao.queryForId(busStopID);
-
busFavourite = (CheckBox) findViewById(R.id.favouriteCheckBox);
busFavourite.setChecked(favouritesPreferences.getBoolean(busStop.id, false));
busFavourite.setOnCheckedChangeListener(this);
@@ -516,27 +510,17 @@ 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 poiId = busDialog.adapter.getItemStringId(position);
+ String busId = busDialog.adapter.getItemStringId(position);
- Log.i(TAG, "POI " + poiId + " selected");
+ Log.i(TAG, "Bus " + busId + " selected");
- Intent i = new Intent(this, BusStopActivity.class);
- try {
- busStop = busStopDao.queryForId(poiId);
+ Uri uri = Uri.parse("http://id.southampton.ac.uk/bus/" + busId);
- if (busStop == null) {
- Log.e(TAG, "stop == null");
- }
- if (busStop.id == null) {
- Log.e(TAG, "stop.id == null");
- }
- i.putExtra("busStopID", busStop.id);
- i.putExtra("busStopName", busStop.description);
- startActivity(i);
- } catch (SQLException e) {
- e.printStackTrace();
- }
+ 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);
}
public boolean onLongClick(View v) {