From fff905416f2f786f0483dc627af04524d81a76ab Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Wed, 15 May 2013 11:58:53 -0700 Subject: [PATCH] Show "no messages" when list is empty. Fixes b/8547230. Change-Id: I7d9d00c9448f1222d38a1a6406709818b2523ceb --- .../android/email/provider/EmailProvider.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index b7abc9a17..2e9e854f0 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -3098,13 +3098,21 @@ public class EmailProvider extends ContentProvider { mMailboxId = mailboxId; mContext = context; Mailbox mailbox = Mailbox.restoreMailboxWithId(context, mailboxId); + + // We assume that all message lists are complete + // since we don't do any live lists in email. + mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_STATUS, + UIProvider.CursorStatus.COMPLETE); if (mailbox != null) { - mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_STATUS, mailbox.mUiSyncStatus); - if (mailbox.mUiLastSyncResult != UIProvider.LastSyncResult.SUCCESS) { - mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_ERROR, - mailbox.mUiLastSyncResult); - } + mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_ERROR, + mailbox.mUiLastSyncResult); mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_TOTAL_COUNT, mailbox.mTotalCount); + } else { + // TODO for virtual mailboxes, we may want to do something besides just fake it + mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_ERROR, + UIProvider.LastSyncResult.SUCCESS); + mExtras.putInt(UIProvider.CursorExtraKeys.EXTRA_TOTAL_COUNT, + cursor != null ? cursor.getCount() : 0); } }