Skip to content

Commit

Permalink
Added the case in sync preferences for a successful sync that had err…
Browse files Browse the repository at this point in the history
…ors, displayed in yellow
  • Loading branch information
Tim Su committed Apr 25, 2011
1 parent 5097d3f commit 200e8fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion api/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@
<string name="sync_status_ongoing">Sync Ongoing...</string>
<!-- Sync Status: success status (%s -> last sync date). Keep it short!-->
<string name="sync_status_success">Last Sync: %s</string>
<!-- Sync Status: error status (%s -> last attempted sync date) -->
<!-- Sync Status: failure status (%s -> last attempted sync date) -->
<string name="sync_status_failed">Failed On: %s</string>
<!-- Sync Status: error status (%s -> last sync date) -->
<string name="sync_status_errors">Sync w/ Errors: %s</string>
<!-- Sync Status: error subtitle (%s -> last successful sync date) -->
<string name="sync_status_failed_subtitle">Last Successful Sync: %s</string>
<!-- Sync Status: never sync'd -->
Expand Down
26 changes: 18 additions & 8 deletions api/src/com/todoroo/astrid/sync/SyncProviderPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,26 @@ else if(getUtilities().isOngoing()) {
status = r.getString(R.string.sync_status_ongoing);
statusColor = Color.rgb(0, 0, 100);
}
// last sync was error
else if(getUtilities().getLastAttemptedSyncDate() != 0) {
status = r.getString(R.string.sync_status_failed,
// last sync had errors
else if(getUtilities().getLastError() != null || getUtilities().getLastAttemptedSyncDate() != 0) {
// last sync was failure
if(getUtilities().getLastAttemptedSyncDate() != 0) {
status = r.getString(R.string.sync_status_failed,
DateUtilities.getDateStringWithTime(SyncProviderPreferences.this,
new Date(getUtilities().getLastAttemptedSyncDate())));
if(getUtilities().getLastSyncDate() > 0) {
subtitle = r.getString(R.string.sync_status_failed_subtitle,
statusColor = Color.rgb(100, 0, 0);

if(getUtilities().getLastSyncDate() > 0) {
subtitle = r.getString(R.string.sync_status_failed_subtitle,
DateUtilities.getDateStringWithTime(SyncProviderPreferences.this,
new Date(getUtilities().getLastSyncDate())));
}
} else {
status = r.getString(R.string.sync_status_errors,
DateUtilities.getDateStringWithTime(SyncProviderPreferences.this,
new Date(getUtilities().getLastSyncDate())));
new Date(getUtilities().getLastSyncDate())));
statusColor = Color.rgb(100, 100, 0);
}
statusColor = Color.rgb(100, 0, 0);
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference p) {
String error = getUtilities().getLastError();
Expand All @@ -138,7 +147,8 @@ public boolean onPreferenceClick(Preference p) {
return true;
}
});
} else if(getUtilities().getLastSyncDate() > 0) {
}
else if(getUtilities().getLastSyncDate() > 0) {
status = r.getString(R.string.sync_status_success,
DateUtilities.getDateStringWithTime(SyncProviderPreferences.this,
new Date(getUtilities().getLastSyncDate())));
Expand Down

0 comments on commit 200e8fb

Please sign in to comment.