From 6abb0f35b6d392a9e771f52580963069ce9c0388 Mon Sep 17 00:00:00 2001 From: "dkeen@dkeen-laptop" Date: Fri, 13 Apr 2012 15:37:19 -0700 Subject: [PATCH] Cleaned up warnings. Fixed out-of-control train length/arrival est. refresh rate error. --- src/com/dougkeen/bart/DepartureArrayAdapter.java | 6 +++++- src/com/dougkeen/bart/ViewDeparturesActivity.java | 9 ++++----- src/com/dougkeen/bart/model/ScheduleInformation.java | 2 -- .../bart/networktasks/ScheduleContentHandler.java | 6 ------ 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/com/dougkeen/bart/DepartureArrayAdapter.java b/src/com/dougkeen/bart/DepartureArrayAdapter.java index a152f0e..79c5a1a 100644 --- a/src/com/dougkeen/bart/DepartureArrayAdapter.java +++ b/src/com/dougkeen/bart/DepartureArrayAdapter.java @@ -22,7 +22,7 @@ import com.dougkeen.bart.model.Departure; public class DepartureArrayAdapter extends ArrayAdapter { - public static int refreshCounter = 0; + private int refreshCounter = 1; public DepartureArrayAdapter(Context context, int textViewResourceId, Departure[] objects) { @@ -52,6 +52,10 @@ public class DepartureArrayAdapter extends ArrayAdapter { public DepartureArrayAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); } + + public void incrementRefreshCounter() { + refreshCounter++; + } @Override public View getView(int position, View convertView, ViewGroup parent) { diff --git a/src/com/dougkeen/bart/ViewDeparturesActivity.java b/src/com/dougkeen/bart/ViewDeparturesActivity.java index 6ad519c..14a9bad 100644 --- a/src/com/dougkeen/bart/ViewDeparturesActivity.java +++ b/src/com/dougkeen/bart/ViewDeparturesActivity.java @@ -19,18 +19,17 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; import com.dougkeen.bart.data.RoutesColumns; import com.dougkeen.bart.model.Constants; import com.dougkeen.bart.model.Departure; +import com.dougkeen.bart.model.RealTimeDepartures; import com.dougkeen.bart.model.ScheduleInformation; import com.dougkeen.bart.model.ScheduleItem; -import com.dougkeen.bart.model.StationPair; -import com.dougkeen.bart.model.RealTimeDepartures; import com.dougkeen.bart.model.Station; +import com.dougkeen.bart.model.StationPair; import com.dougkeen.bart.networktasks.GetRealTimeDeparturesTask; import com.dougkeen.bart.networktasks.GetScheduleInformationTask; @@ -45,7 +44,7 @@ public class ViewDeparturesActivity extends ListActivity { private int mAverageTripLength; private int mAverageTripSampleCount; - private ArrayAdapter mDeparturesAdapter; + private DepartureArrayAdapter mDeparturesAdapter; private ScheduleInformation mLatestScheduleInfo; @@ -430,7 +429,7 @@ public class ViewDeparturesActivity extends ListActivity { private void runAutoUpdate() { if (mIsAutoUpdating && mDeparturesAdapter != null) { - DepartureArrayAdapter.refreshCounter++; + mDeparturesAdapter.incrementRefreshCounter(); mDeparturesAdapter.notifyDataSetChanged(); } if (hasWindowFocus()) { diff --git a/src/com/dougkeen/bart/model/ScheduleInformation.java b/src/com/dougkeen/bart/model/ScheduleInformation.java index 25e635a..6bede36 100644 --- a/src/com/dougkeen/bart/model/ScheduleInformation.java +++ b/src/com/dougkeen/bart/model/ScheduleInformation.java @@ -3,8 +3,6 @@ package com.dougkeen.bart.model; import java.util.ArrayList; import java.util.List; -import android.R.integer; - public class ScheduleInformation { public ScheduleInformation(Station origin, Station destination) { diff --git a/src/com/dougkeen/bart/networktasks/ScheduleContentHandler.java b/src/com/dougkeen/bart/networktasks/ScheduleContentHandler.java index b18b4a8..23af33d 100644 --- a/src/com/dougkeen/bart/networktasks/ScheduleContentHandler.java +++ b/src/com/dougkeen/bart/networktasks/ScheduleContentHandler.java @@ -4,11 +4,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; -import java.util.Date; import java.util.List; import java.util.TimeZone; -import org.apache.commons.lang3.StringUtils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -16,10 +14,6 @@ import org.xml.sax.helpers.DefaultHandler; import android.util.Log; import com.dougkeen.bart.model.Constants; -import com.dougkeen.bart.model.Departure; -import com.dougkeen.bart.model.Line; -import com.dougkeen.bart.model.RealTimeDepartures; -import com.dougkeen.bart.model.Route; import com.dougkeen.bart.model.ScheduleInformation; import com.dougkeen.bart.model.ScheduleItem; import com.dougkeen.bart.model.Station;