Fixed problem where estimated arrival wasn't updating for departures other than the first one.

This commit is contained in:
Doug Keen 2012-09-26 10:50:15 -07:00
parent 37ca713d39
commit 62bd905f26
2 changed files with 25 additions and 15 deletions

View File

@ -124,6 +124,11 @@ public class FavoritesArrayAdapter extends ArrayAdapter<StationPair> {
}
for (int i = 0; i < getCount(); i++) {
StationPair adapterItem = getItem(i);
if (cursor.isAfterLast()) {
while (i < getCount()) {
remove(getItem(i));
}
} else {
StationPair cursorItem = StationPair.createFromCursor(cursor);
while (!cursorItem.equals(adapterItem)) {
remove(adapterItem);
@ -136,11 +141,13 @@ public class FavoritesArrayAdapter extends ArrayAdapter<StationPair> {
if (cursorItem.equals(adapterItem)
&& !cursorItem.fareEquals(adapterItem)) {
adapterItem.setFare(cursorItem.getFare());
adapterItem.setFareLastUpdated(cursorItem.getFareLastUpdated());
adapterItem.setFareLastUpdated(cursorItem
.getFareLastUpdated());
notifyDataSetChanged();
}
cursor.moveToNext();
}
}
while (!cursor.isAfterLast()) {
add(StationPair.createFromCursor(cursor));
cursor.moveToNext();

View File

@ -157,8 +157,9 @@ public class EtdService extends Service {
protected void registerListener(EtdServiceListener listener,
boolean limitToFirstNonDeparted) {
mListeners.put(listener, true);
if (!limitToFirstNonDeparted)
if (!limitToFirstNonDeparted) {
mLimitToFirstNonDeparted = false;
}
if (!mPendingEtdRequest) {
mStarted = true;
fetchLatestDepartures();
@ -578,6 +579,8 @@ public class EtdService extends Service {
.getMeanEstimate()) {
fetchLatestSchedule();
return;
} else if (!lastDeparture.hasAnyArrivalEstimate()) {
applyScheduleInformation(mLatestScheduleInfo);
}
}