diff options
Diffstat (limited to 'src/net/cbaines/suma/MapActivity.java')
-rw-r--r-- | src/net/cbaines/suma/MapActivity.java | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 59c8505..8f555da 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -241,7 +241,30 @@ public class MapActivity extends OrmLiteBaseActivity<DatabaseHelper> implements GeoPoint userLocation = null; Bundle extras = getIntent().getExtras(); - if (extras != null && extras.containsKey("poiPoint")) { + if (getIntent().getDataString() != null) { + + Log.i(TAG, "getIntent().getDataString() " + getIntent().getDataString()); + + String str = getIntent().getDataString().substring(4, getIntent().getDataString().length()); + String[] strParts = str.split(","); + + int lat = Util.doubleToIntE6(Double.valueOf(strParts[0])); + int lng; + + if (strParts[1].contains("?")) { + String zoom = strParts[1].substring(strParts[1].indexOf("?") + 3, strParts[1].length()); + String strLng = strParts[1].substring(0, strParts[1].indexOf("?") - 1); + lng = Util.doubleToIntE6(Double.valueOf(strLng)); + + mapController.setZoom(Integer.valueOf(zoom)); + } else { + lng = Util.doubleToIntE6(Double.valueOf(strParts[1])); + mapController.setZoom(15); + } + + userLocation = new GeoPoint(lat, lng); + + } else if (extras != null && extras.containsKey("poiPoint")) { String poiPoint = getIntent().getExtras().getString("poiPoint"); Log.i(TAG, "poiPoint " + poiPoint); @@ -1091,17 +1114,6 @@ public class MapActivity extends OrmLiteBaseActivity<DatabaseHelper> implements } - /* - * public boolean onChildClick(ExpandableListView parent, View v, int - * groupPosition, int childPosition, long id) { - * - * mapView.post(new Runnable() { public void run() { // - * updateEnabledOverlays(); TODO Fix whatever this did? - * mapView.invalidate(); } }); - * - * return true; } - */ - protected Dialog onCreateDialog(int id) { switch (id) { case VIEW_DIALOG_ID: @@ -1190,10 +1202,12 @@ public class MapActivity extends OrmLiteBaseActivity<DatabaseHelper> implements Log.i(TAG, "Pressed " + busStop.id); - Intent i = new Intent(this, BusStopActivity.class); - i.putExtra("busStopID", busStop.id); - i.putExtra("busStopName", busStop.description); - startActivityForResult(i, 0); + Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + busStop.id); + + Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath()); + + Intent busStopIntent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(busStopIntent); return true; |