summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
20c03b7)
the lastUpdate observer was triggered once before the value is set
so move the decision whether to fetch out of the observer
mainModel.clearUpdateError();
});
}
mainModel.clearUpdateError();
});
}
- private void scheduleDataRetrievalIfStale(Date lastUpdate) {
+ private void scheduleDataRetrievalIfStale(long lastUpdate) {
long now = new Date().getTime();
long now = new Date().getTime();
- if ((lastUpdate == null) || (now > (lastUpdate.getTime() + (24 * 3600 * 1000)))) {
- if (lastUpdate == null)
+ if ((lastUpdate == 0) || (now > (lastUpdate + (24 * 3600 * 1000)))) {
+ if (lastUpdate == 0)
Logger.debug("db::", "WEB data never fetched. scheduling a fetch");
else
Logger.debug("db", String.format(Locale.ENGLISH,
"WEB data last fetched at %1.3f and now is %1.3f. re-fetching",
Logger.debug("db::", "WEB data never fetched. scheduling a fetch");
else
Logger.debug("db", String.format(Locale.ENGLISH,
"WEB data last fetched at %1.3f and now is %1.3f. re-fetching",
- lastUpdate.getTime() / 1000f, now / 1000f));
+ lastUpdate / 1000f, now / 1000f));
mainModel.scheduleTransactionListRetrieval();
}
mainModel.scheduleTransactionListRetrieval();
}
l.setVisibility(View.VISIBLE);
Logger.debug("main", String.format("Date formatted: %s", text));
}
l.setVisibility(View.VISIBLE);
Logger.debug("main", String.format("Date formatted: %s", text));
}
-
- scheduleDataRetrievalIfStale(newValue);
}
private void profileThemeChanged() {
storeThemeIdInPrefs(profile.getThemeHue());
}
private void profileThemeChanged() {
storeThemeIdInPrefs(profile.getThemeHue());
else {
mainModel.lastUpdateDate.postValue(new Date(last_update));
}
else {
mainModel.lastUpdateDate.postValue(new Date(last_update));
}
+ scheduleDataRetrievalIfStale(last_update);
+
}
public void onStopTransactionRefreshClick(View view) {
Logger.debug("interactive", "Cancelling transactions refresh");
}
public void onStopTransactionRefreshClick(View view) {
Logger.debug("interactive", "Cancelling transactions refresh");