From c98b64c801cea3c82a7b932ebaf9a4bbdcee195c Mon Sep 17 00:00:00 2001 From: Andrew Stadler Date: Tue, 13 Apr 2010 23:49:24 -0700 Subject: [PATCH] Final cleanup for account provisioning failures * Now that we get proper callbacks on updateMailboxListCallback(), show the error banner if there's a problem * Follow-on to 63186a5442f8310b25602235622c3669a4e5b1ec Bug: 2585159 Change-Id: I2b4f365d02b639bc3ceff9f8938333185d5ba693 --- src/com/android/email/activity/MessageList.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index 1af21d8a2..11dd951a1 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -1095,6 +1095,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On if (accountExists && mOkToRecurse) { // launch network lookup mControllerCallback.mWaitForMailboxType = mMailboxType; + mControllerCallback.mWaitForMailboxAccountId = mAccountId; mController.updateMailboxList(mAccountId, mControllerCallback); } else { // We don't want to do the network lookup, or the account doesn't exist in the @@ -1430,11 +1431,23 @@ public class MessageList extends ListActivity implements OnItemClickListener, On // These are preset for use by updateMailboxListCallback int mWaitForMailboxType = -1; + long mWaitForMailboxAccountId = -1; // TODO check accountKey and only react to relevant notifications public void updateMailboxListCallback(MessagingException result, long accountKey, int progress) { - // no updateBanner here, we are only listing a single mailbox + // Special case to show a banner here if we can't refresh the account + if (accountKey == mWaitForMailboxAccountId) { + // Display error + if (result != null) { + updateBanner(result, progress, mMailboxId); + } + // Reset the account watcher so we don't respond again + if (result != null || progress == 100) { + mWaitForMailboxAccountId = -1; + } + } + updateProgress(result, progress); if (progress == 100) { mHandler.lookupMailboxType(accountKey, mWaitForMailboxType);