Fixed problem where estimated arrival wasn't updating for departures other than the first one.
This commit is contained in:
parent
37ca713d39
commit
62bd905f26
@ -124,22 +124,29 @@ public class FavoritesArrayAdapter extends ArrayAdapter<StationPair> {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < getCount(); i++) {
|
for (int i = 0; i < getCount(); i++) {
|
||||||
StationPair adapterItem = getItem(i);
|
StationPair adapterItem = getItem(i);
|
||||||
StationPair cursorItem = StationPair.createFromCursor(cursor);
|
if (cursor.isAfterLast()) {
|
||||||
while (!cursorItem.equals(adapterItem)) {
|
while (i < getCount()) {
|
||||||
remove(adapterItem);
|
remove(getItem(i));
|
||||||
if (i < getCount()) {
|
|
||||||
adapterItem = getItem(i);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
StationPair cursorItem = StationPair.createFromCursor(cursor);
|
||||||
|
while (!cursorItem.equals(adapterItem)) {
|
||||||
|
remove(adapterItem);
|
||||||
|
if (i < getCount()) {
|
||||||
|
adapterItem = getItem(i);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cursorItem.equals(adapterItem)
|
||||||
|
&& !cursorItem.fareEquals(adapterItem)) {
|
||||||
|
adapterItem.setFare(cursorItem.getFare());
|
||||||
|
adapterItem.setFareLastUpdated(cursorItem
|
||||||
|
.getFareLastUpdated());
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
cursor.moveToNext();
|
||||||
}
|
}
|
||||||
if (cursorItem.equals(adapterItem)
|
|
||||||
&& !cursorItem.fareEquals(adapterItem)) {
|
|
||||||
adapterItem.setFare(cursorItem.getFare());
|
|
||||||
adapterItem.setFareLastUpdated(cursorItem.getFareLastUpdated());
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
cursor.moveToNext();
|
|
||||||
}
|
}
|
||||||
while (!cursor.isAfterLast()) {
|
while (!cursor.isAfterLast()) {
|
||||||
add(StationPair.createFromCursor(cursor));
|
add(StationPair.createFromCursor(cursor));
|
||||||
|
@ -157,8 +157,9 @@ public class EtdService extends Service {
|
|||||||
protected void registerListener(EtdServiceListener listener,
|
protected void registerListener(EtdServiceListener listener,
|
||||||
boolean limitToFirstNonDeparted) {
|
boolean limitToFirstNonDeparted) {
|
||||||
mListeners.put(listener, true);
|
mListeners.put(listener, true);
|
||||||
if (!limitToFirstNonDeparted)
|
if (!limitToFirstNonDeparted) {
|
||||||
mLimitToFirstNonDeparted = false;
|
mLimitToFirstNonDeparted = false;
|
||||||
|
}
|
||||||
if (!mPendingEtdRequest) {
|
if (!mPendingEtdRequest) {
|
||||||
mStarted = true;
|
mStarted = true;
|
||||||
fetchLatestDepartures();
|
fetchLatestDepartures();
|
||||||
@ -578,6 +579,8 @@ public class EtdService extends Service {
|
|||||||
.getMeanEstimate()) {
|
.getMeanEstimate()) {
|
||||||
fetchLatestSchedule();
|
fetchLatestSchedule();
|
||||||
return;
|
return;
|
||||||
|
} else if (!lastDeparture.hasAnyArrivalEstimate()) {
|
||||||
|
applyScheduleInformation(mLatestScheduleInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user