diff options
author | James Lemieux <jplemieux@google.com> | 2014-09-29 17:51:28 -0700 |
---|---|---|
committer | James Lemieux <jplemieux@google.com> | 2014-09-29 17:51:28 -0700 |
commit | 678f86b26f37348a1f9eb256d093590ee1608e9b (patch) | |
tree | 32e4648c0555d60c271ea34492dd05f065291298 /src | |
parent | 457cb325f7435493825145d0b622f23055e19607 (diff) | |
download | android_packages_apps_Exchange-678f86b26f37348a1f9eb256d093590ee1608e9b.tar.gz android_packages_apps_Exchange-678f86b26f37348a1f9eb256d093590ee1608e9b.tar.bz2 android_packages_apps_Exchange-678f86b26f37348a1f9eb256d093590ee1608e9b.zip |
Display sync errors using snackbar and not as a TL footer
b/16463253
The FAB compose button overlaps the action button found in the TL footer
when network errors occur during sync. To avoid this overlap, the snackbar
is used to display these errors and they no longer appear as a TL footer.
In order to signal the sync error to AAC for display in the snackbar, the
Folder.lastSyncResult needed to be encoded in the manner that AAC reads.
This was not happening for POP/IMAP/Exchange accounts, so a large portion
of this change is encoding that value properly every place it is written.
To ensure the value is read/written properly everywhere, common methods were
introduced in UIProvider that do this work. UIProviderTest was also added
to ensure the read/write methods agree with each other.
Finally, the display of the "Load More" TL footer was updated to match the
latest spec.
Change-Id: Ib8692a2b9e164d25f982a2d7a54b07d2d3950358
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/exchange/eas/EasFullSyncOperation.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/com/android/exchange/eas/EasFullSyncOperation.java b/src/com/android/exchange/eas/EasFullSyncOperation.java index 87148346..99c65b37 100644 --- a/src/com/android/exchange/eas/EasFullSyncOperation.java +++ b/src/com/android/exchange/eas/EasFullSyncOperation.java @@ -5,7 +5,6 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.os.Bundle; -import android.os.RemoteException; import android.provider.CalendarContract; import android.provider.ContactsContract; @@ -240,31 +239,34 @@ public class EasFullSyncOperation extends EasOperation { return EmailServiceStatus.SUCCESS; } - int result = 0; + int syncResult = 0; // Non-mailbox syncs are whole account syncs initiated by the AccountManager and are // treated as background syncs. if (mailbox.mType == Mailbox.TYPE_OUTBOX || mailbox.isSyncable()) { final ContentValues cv = new ContentValues(2); - updateMailbox(mailbox, cv, isUserSync ? - EmailContent.SYNC_STATUS_USER : EmailContent.SYNC_STATUS_BACKGROUND); + final int syncStatus = isUserSync ? + EmailContent.SYNC_STATUS_USER : EmailContent.SYNC_STATUS_BACKGROUND; + updateMailbox(mailbox, cv, syncStatus); try { if (mailbox.mType == Mailbox.TYPE_OUTBOX) { return syncOutbox(mailbox.mId); } if (hasCallbackMethod) { - EmailServiceStatus.syncMailboxStatus(mContext.getContentResolver(), mSyncExtras, - mailbox.mId, EmailServiceStatus.IN_PROGRESS, 0, + final int lastSyncResult = UIProvider.createSyncValue(syncStatus, UIProvider.LastSyncResult.SUCCESS); + EmailServiceStatus.syncMailboxStatus(mContext.getContentResolver(), mSyncExtras, + mailbox.mId, EmailServiceStatus.IN_PROGRESS, 0, lastSyncResult); } final EasSyncBase operation = new EasSyncBase(mContext, mAccount, mailbox); LogUtils.d(TAG, "IEmailService.syncMailbox account %d", mAccount.mId); - result = operation.performOperation(); + syncResult = operation.performOperation(); } finally { updateMailbox(mailbox, cv, EmailContent.SYNC_STATUS_NONE); if (hasCallbackMethod) { + final int uiSyncResult = translateSyncResultToUiResult(syncResult); + final int lastSyncResult = UIProvider.createSyncValue(syncStatus, uiSyncResult); EmailServiceStatus.syncMailboxStatus(mContext.getContentResolver(), mSyncExtras, - mailbox.mId, EmailServiceStatus.SUCCESS, 0, - EasOperation.translateSyncResultToUiResult(result)); + mailbox.mId, EmailServiceStatus.SUCCESS, 0, lastSyncResult); } } } else { @@ -272,7 +274,7 @@ public class EasFullSyncOperation extends EasOperation { LogUtils.d(TAG, "Skipping sync of non syncable folder"); } - return result; + return syncResult; } private int syncOutbox(final long mailboxId) { |