Don't show only special mailboxes on mailbox list

When a new account has just been set up and the app is still loading
mailboxes, keep the mailbox list empty and let ListFragment show
the progress icon, rather than showing "Combined Inbox" "All Starred" etc
without acutal inboxes, which looks like it's broken.

Change-Id: Ia3de4377b701f0033c5dc92f8b6b14651d4d8e1e
This commit is contained in:
Makoto Onuki 2010-09-22 14:03:06 -07:00
parent 250ca15b88
commit b4dacf2acf
2 changed files with 12 additions and 0 deletions

View File

@ -265,6 +265,8 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList
}
if (cursor.getCount() == 0) {
// If there's no row, don't set it to the ListView.
// Instead use setListShown(false) to make ListFragment show progress icon.
mListAdapter.changeCursor(null);
setListShown(false);
} else {

View File

@ -189,6 +189,16 @@ import android.widget.TextView;
if (mMode == MODE_MOVE_TO_TARGET) {
return mailboxes;
}
if (mailboxes.getCount() == 0) {
// If there's no mailboxes, don't merge special mailboxes. Just return 0 row
// cursor.
// If there's no row, this means the account has just been set up or recovered and
// we're fetching mailboxes. In this case, the mailbox list shouldn't just show
// special mailboxes. It should show something to indicate it's still loading the
// list, which MailboxListFragment will do if it returns an empty cursor.
return mailboxes;
}
final int numAccounts = EmailContent.count(mContext, Account.CONTENT_URI);
return new MergeCursor(
new Cursor[] {getSpecialMailboxesCursor(mContext, numAccounts > 1), mailboxes});