Cleaned up warnings.

Fixed out-of-control train length/arrival est. refresh rate error.
This commit is contained in:
dkeen@dkeen-laptop 2012-04-13 15:37:19 -07:00
parent 57ef900ee6
commit 6abb0f35b6
4 changed files with 9 additions and 14 deletions

View File

@ -22,7 +22,7 @@ import com.dougkeen.bart.model.Departure;
public class DepartureArrayAdapter extends ArrayAdapter<Departure> { public class DepartureArrayAdapter extends ArrayAdapter<Departure> {
public static int refreshCounter = 0; private int refreshCounter = 1;
public DepartureArrayAdapter(Context context, int textViewResourceId, public DepartureArrayAdapter(Context context, int textViewResourceId,
Departure[] objects) { Departure[] objects) {
@ -53,6 +53,10 @@ public class DepartureArrayAdapter extends ArrayAdapter<Departure> {
super(context, textViewResourceId); super(context, textViewResourceId);
} }
public void incrementRefreshCounter() {
refreshCounter++;
}
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view; View view;

View File

@ -19,18 +19,17 @@ import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.dougkeen.bart.data.RoutesColumns; import com.dougkeen.bart.data.RoutesColumns;
import com.dougkeen.bart.model.Constants; import com.dougkeen.bart.model.Constants;
import com.dougkeen.bart.model.Departure; import com.dougkeen.bart.model.Departure;
import com.dougkeen.bart.model.RealTimeDepartures;
import com.dougkeen.bart.model.ScheduleInformation; import com.dougkeen.bart.model.ScheduleInformation;
import com.dougkeen.bart.model.ScheduleItem; 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.Station;
import com.dougkeen.bart.model.StationPair;
import com.dougkeen.bart.networktasks.GetRealTimeDeparturesTask; import com.dougkeen.bart.networktasks.GetRealTimeDeparturesTask;
import com.dougkeen.bart.networktasks.GetScheduleInformationTask; import com.dougkeen.bart.networktasks.GetScheduleInformationTask;
@ -45,7 +44,7 @@ public class ViewDeparturesActivity extends ListActivity {
private int mAverageTripLength; private int mAverageTripLength;
private int mAverageTripSampleCount; private int mAverageTripSampleCount;
private ArrayAdapter<Departure> mDeparturesAdapter; private DepartureArrayAdapter mDeparturesAdapter;
private ScheduleInformation mLatestScheduleInfo; private ScheduleInformation mLatestScheduleInfo;
@ -430,7 +429,7 @@ public class ViewDeparturesActivity extends ListActivity {
private void runAutoUpdate() { private void runAutoUpdate() {
if (mIsAutoUpdating && mDeparturesAdapter != null) { if (mIsAutoUpdating && mDeparturesAdapter != null) {
DepartureArrayAdapter.refreshCounter++; mDeparturesAdapter.incrementRefreshCounter();
mDeparturesAdapter.notifyDataSetChanged(); mDeparturesAdapter.notifyDataSetChanged();
} }
if (hasWindowFocus()) { if (hasWindowFocus()) {

View File

@ -3,8 +3,6 @@ package com.dougkeen.bart.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import android.R.integer;
public class ScheduleInformation { public class ScheduleInformation {
public ScheduleInformation(Station origin, Station destination) { public ScheduleInformation(Station origin, Station destination) {

View File

@ -4,11 +4,9 @@ import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
@ -16,10 +14,6 @@ import org.xml.sax.helpers.DefaultHandler;
import android.util.Log; import android.util.Log;
import com.dougkeen.bart.model.Constants; 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.ScheduleInformation;
import com.dougkeen.bart.model.ScheduleItem; import com.dougkeen.bart.model.ScheduleItem;
import com.dougkeen.bart.model.Station; import com.dougkeen.bart.model.Station;