aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusSpecificStopView.java
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-02-16 10:41:27 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-02-16 10:41:27 +0000
commite20303f3de0782c31a0a794d1be4a06e3b4a0c76 (patch)
treec8259328e0eb3e9bae3e7c57490d35fb41c5b059 /src/net/cbaines/suma/BusSpecificStopView.java
parentfcac217897640f23d0a528c02f861e1e2d15a212 (diff)
downloadsouthamptonuniversitymap-e20303f3de0782c31a0a794d1be4a06e3b4a0c76.tar
southamptonuniversitymap-e20303f3de0782c31a0a794d1be4a06e3b4a0c76.tar.gz
More changes to the BusActivity.
Diffstat (limited to 'src/net/cbaines/suma/BusSpecificStopView.java')
-rw-r--r--src/net/cbaines/suma/BusSpecificStopView.java67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java
index b13a6de..69b2aee 100644
--- a/src/net/cbaines/suma/BusSpecificStopView.java
+++ b/src/net/cbaines/suma/BusSpecificStopView.java
@@ -82,76 +82,9 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(time, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
- refreshData = new Runnable() {
- @Override
- public void run() {
- if (stop.timeOfFetch == null || (stop.timeOfFetch.getTime() - System.currentTimeMillis()) > 20000) {
- if (task == null) {
- task = new GetTimetableStopTask();
- BusStop[] str = { stop.busStop };
- task.execute(str);
- handler.postDelayed(refreshData, 20000);
- }
- }
-
- }
- };
-
handler.post(refreshData);
}
- private class GetTimetableStopTask extends AsyncTask<BusStop, Integer, Stop> {
- private String errorMessage;
-
- private BusStop busStop;
-
- private int position;
-
- protected void onPreExecute() {
- // progBar.setVisibility(View.VISIBLE);
- }
-
- protected Stop doInBackground(BusStop... busStopArray) {
- busStop = busStopArray[0];
- Stop stop = null;
-
- try {
- Log.i(TAG, "Fetching stop for busStop " + position);
- stop = DataManager.getStop(context, stop.bus, busStop);
- if (stop == null) {
- stop = new Stop(stop.bus, busStop, null, null, false);
- }
- Log.i(TAG, "Finished fetching stop for busStop " + position);
- } catch (SQLException e) {
- errorMessage = "Error message regarding SQL?";
- e.printStackTrace();
- } catch (ClientProtocolException e) {
- errorMessage = "ClientProtocolException!?!";
- e.printStackTrace();
- } catch (IOException e) {
- errorMessage = "Error fetching bus times from server, are you connected to the internet?";
- e.printStackTrace();
- } catch (JSONException e) {
- errorMessage = "Error parsing bus times";
- e.printStackTrace();
- }
- return stop;
- }
-
- protected void onPostExecute(Stop stop) {
- // Log.i(TAG, "Got timetable");
- if (stop == null) {
-
- // progBar.setVisibility(View.GONE);
- // busContentMessage.setText(errorMessage);
- // busContentMessage.setVisibility(View.VISIBLE);
- } else {
- // progBar.setVisibility(View.GONE);
-
- }
- }
- }
-
public void setStop(Stop stop) {
// Log.i(TAG, "Time of arival " + stop.arivalTime);