aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-02-08 16:55:28 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-02-08 16:55:28 +0000
commit1e18e360f0a34811cedfa3bfc8c0c9c278c09831 (patch)
tree026bf497a1244440099417bfa6f5be3ed5749624
parent167ec37cd6d58e6565531603df946ca4e441ec36 (diff)
downloadsouthamptonuniversitymap-1e18e360f0a34811cedfa3bfc8c0c9c278c09831.tar
southamptonuniversitymap-1e18e360f0a34811cedfa3bfc8c0c9c278c09831.tar.gz
Bus stop movement is now working, needs more testing though.
-rw-r--r--src/net/cbaines/suma/BusStopActivity.java33
-rw-r--r--src/net/cbaines/suma/POIDialog.java4
2 files changed, 29 insertions, 8 deletions
diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java
index b50e340..b2eff62 100644
--- a/src/net/cbaines/suma/BusStopActivity.java
+++ b/src/net/cbaines/suma/BusStopActivity.java
@@ -350,10 +350,14 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme
for (BusRoute route : routes) {
try {
+ BusStop tmpStop;
if (item.getItemId() == R.id.menu_next_stop) {
- busStops.add(route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, 1));
+ tmpStop = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, 1);
} else {
- busStops.add(route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, -1));
+ tmpStop = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), null, -1);
+ }
+ if (!busStops.contains(tmpStop)) {
+ busStops.add(tmpStop);
}
} catch (SQLException e) {
e.printStackTrace();
@@ -474,8 +478,29 @@ public class BusStopActivity extends OrmLiteBaseActivity<DatabaseHelper> impleme
}
@Override
- public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- // TODO Auto-generated method stub
+ 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);
+
+ Log.i(TAG, "POI " + poiId + " selected");
+
+ Intent i = new Intent(this, BusStopActivity.class);
+ try {
+ busStop = busStopDao.queryForId(poiId);
+
+ 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();
+ }
}
}
diff --git a/src/net/cbaines/suma/POIDialog.java b/src/net/cbaines/suma/POIDialog.java
index 8107d06..67be966 100644
--- a/src/net/cbaines/suma/POIDialog.java
+++ b/src/net/cbaines/suma/POIDialog.java
@@ -80,10 +80,6 @@ public class POIDialog extends Dialog {
});
}
- void setTitle(String title) {
- setTitle(title);
- }
-
void setOnItemClickListener(OnItemClickListener item) {
listItems.setOnItemClickListener(item);