diff options
Diffstat (limited to 'src/net/cbaines/suma/StopView.java')
-rw-r--r-- | src/net/cbaines/suma/StopView.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/net/cbaines/suma/StopView.java b/src/net/cbaines/suma/StopView.java index 27c3a4c..9a0dcd3 100644 --- a/src/net/cbaines/suma/StopView.java +++ b/src/net/cbaines/suma/StopView.java @@ -22,8 +22,8 @@ package net.cbaines.suma; import java.sql.SQLException; import java.text.DateFormat; -import android.app.Activity; import android.content.Intent; +import android.net.Uri; import android.util.Log; import android.view.Gravity; import android.view.View; @@ -87,7 +87,6 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli if (stop.bus.id != null) { if (stop.live) { - onClickMessage = "Bus " + stop.bus.toString() + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); } else { @@ -113,7 +112,6 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli public void onClick(View v) { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, onClickMessage, Toast.LENGTH_SHORT); } else { context.activityToast.setText(onClickMessage); @@ -124,7 +122,6 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli } public boolean onLongClick(View v) { - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); try { @@ -137,14 +134,14 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli 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) { - Intent i = new Intent(context, BusActivity.class); - i.putExtra("busID", stop.bus.id); - i.putExtra("busStopID", stop.busStop.id); - ((Activity) context).startActivityForResult(i, 0); + 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); } else { if (!stop.bus.route.uniLink) { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, "Bus schedules only avalible for Uni-Link buses", Toast.LENGTH_SHORT); } else { @@ -154,7 +151,6 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli context.activityToast.show(); } else { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, "Bus schedules not avalible for unidentified buses", Toast.LENGTH_SHORT); } else { |