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:
parent
09e7fffb2a
commit
9630e31bac
@ -391,17 +391,28 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList
|
|||||||
* Set {@link #mParentMailboxId} and {@link #mHighlightedMailboxId} from the fragment arguments.
|
* Set {@link #mParentMailboxId} and {@link #mHighlightedMailboxId} from the fragment arguments.
|
||||||
*/
|
*/
|
||||||
private void setInitialParentAndHighlight() {
|
private void setInitialParentAndHighlight() {
|
||||||
|
final long initialMailboxId = getInitialCurrentMailboxId();
|
||||||
if (getAccountId() == Account.ACCOUNT_ID_COMBINED_VIEW) {
|
if (getAccountId() == Account.ACCOUNT_ID_COMBINED_VIEW) {
|
||||||
// For the combined view, always show the top-level, but highlight the "current".
|
// For the combined view, always show the top-level, but highlight the "current".
|
||||||
mParentMailboxId = Mailbox.NO_MAILBOX;
|
mParentMailboxId = Mailbox.NO_MAILBOX;
|
||||||
|
} else {
|
||||||
|
// 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 {
|
} else {
|
||||||
// Otherwise, try using the "current" as the "parent" (and also highlight it).
|
// Otherwise, try using the "current" as the "parent" (and also highlight it).
|
||||||
// If it has no children, we go up in onLoadFinished().
|
// If it has no children, we go up in onLoadFinished().
|
||||||
mParentMailboxId = getInitialCurrentMailboxId();
|
mParentMailboxId = initialMailboxId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Highlight the mailbox of interest
|
// Highlight the mailbox of interest
|
||||||
if (getEnableHighlight()) {
|
if (getEnableHighlight()) {
|
||||||
mHighlightedMailboxId = getInitialCurrentMailboxId();
|
mHighlightedMailboxId = initialMailboxId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user