From 132307281dd22802c774234d4f6a9d8902a659b7 Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Tue, 7 Jun 2011 13:28:01 -0700 Subject: [PATCH] Always add "recent" header for one pane view The one pane view will always have something in the recent list (either the default recent list or the "all folders" item). Change-Id: Ic264b59dc25504a8ce75bea6efae53a0d5dede87 --- .../android/email/activity/AccountSelectorAdapter.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/activity/AccountSelectorAdapter.java b/src/com/android/email/activity/AccountSelectorAdapter.java index 1889462eb..1457941f5 100644 --- a/src/com/android/email/activity/AccountSelectorAdapter.java +++ b/src/com/android/email/activity/AccountSelectorAdapter.java @@ -326,6 +326,8 @@ public class AccountSelectorAdapter extends CursorAdapter { boolean useTwoPane = mContext.getResources().getBoolean(R.bool.use_two_pane); // Filter system mailboxes if we're using a two-pane view RecentMailboxManager mailboxManager = RecentMailboxManager.getInstance(mContext); + // TODO Verify proper behaviour with Rich. The default recent list may be added to the + // database, which would mean this special code goes away. ArrayList recentMailboxes = mailboxManager.getMostRecent(mAccountId, useTwoPane); if (!useTwoPane && recentMailboxes.size() == 0) { for (int type : DEFAULT_RECENT_TYPES) { @@ -336,10 +338,13 @@ public class AccountSelectorAdapter extends CursorAdapter { } } matrixCursor.mRecentCount = recentMailboxes.size(); - if (recentMailboxes.size() > 0) { + if (!useTwoPane || recentMailboxes.size() > 0) { + // Always have a header for one pane; optional on two pane String mailboxHeader = mContext.getString( - R.string.mailbox_list_account_selector_mailbox_header_fmt, emailAddress); + R.string.mailbox_list_account_selector_mailbox_header_fmt, emailAddress); addRow(matrixCursor, ROW_TYPE_HEADER, 0L, mailboxHeader, null, 0, UNKNOWN_POSITION); + } + if (recentMailboxes.size() > 0) { for (long mailboxId : recentMailboxes) { final int unread = Utility.getFirstRowInt(mContext, ContentUris.withAppendedId(Mailbox.CONTENT_URI, mailboxId),