diff options
Diffstat (limited to 'src/net/cbaines/suma/BusSpecificStopView.java')
-rw-r--r-- | src/net/cbaines/suma/BusSpecificStopView.java | 67 |
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); |