Fix bug 4901592 Do not drill-in to inbox by default

If the initial mailbox has child mailboxes, we should show the drilled-in
view by default, EXCEPT if the initial mailbox is inbox, in which case
we want to show the root view.

(And we drill-in if the user taps Inbox.)

Bug 4901592

Change-Id: Idc1462030cf8d971dd4dcbba647ac3a64cab6819
This commit is contained in:
Makoto Onuki 2011-06-30 18:00:11 -07:00
parent 09e7fffb2a
commit 9630e31bac

View File

@ -391,17 +391,28 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList
* Set {@link #mParentMailboxId} and {@link #mHighlightedMailboxId} from the fragment arguments.
*/
private void setInitialParentAndHighlight() {
final long initialMailboxId = getInitialCurrentMailboxId();
if (getAccountId() == Account.ACCOUNT_ID_COMBINED_VIEW) {
// For the combined view, always show the top-level, but highlight the "current".
mParentMailboxId = Mailbox.NO_MAILBOX;
} else {
// Otherwise, try using the "current" as the "parent" (and also highlight it).
// If it has no children, we go up in onLoadFinished().
mParentMailboxId = getInitialCurrentMailboxId();
// Inbox needs special care.
// Note we can't get the mailbox type on the UI thread but this method *can* be used...
final long inboxId = Mailbox.findMailboxOfType(getActivity(), getAccountId(),
Mailbox.TYPE_INBOX);
if (initialMailboxId == inboxId) {
// If Inbox is set as the initial current, we show the top level mailboxes
// with inbox highlighted.
mParentMailboxId = Mailbox.NO_MAILBOX;
} else {
// Otherwise, try using the "current" as the "parent" (and also highlight it).
// If it has no children, we go up in onLoadFinished().
mParentMailboxId = initialMailboxId;
}
}
// Highlight the mailbox of interest
if (getEnableHighlight()) {
mHighlightedMailboxId = getInitialCurrentMailboxId();
mHighlightedMailboxId = initialMailboxId;
}
}