Make isInboxList check robust to combined views.
rookie mistake :( Bug: 5141774 Change-Id: Iafc4907a4717143ccf8251a1fb452e1ff00aa5ff
This commit is contained in:
parent
e91ff527ed
commit
2c4a6855ba
@ -309,11 +309,21 @@ public class MessageListFragment extends ListFragment
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this message list is showing a user's inbox. If no data is loaded,
|
||||
* false is returned.
|
||||
* @return Whether or not this message list is showing a user's inbox.
|
||||
* Note that combined inbox view is treated as an inbox view.
|
||||
*/
|
||||
public boolean isInboxList() {
|
||||
return hasDataLoaded() && (mMailbox.mType == Mailbox.TYPE_INBOX);
|
||||
long accountId = mListContext.mAccountId;
|
||||
if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) {
|
||||
return mListContext.getMailboxId() == Mailbox.QUERY_ALL_INBOXES;
|
||||
}
|
||||
|
||||
if (!hasDataLoaded()) {
|
||||
// If the data hasn't finished loading, we don't have the full mailbox - infer from ID.
|
||||
long inboxId = Mailbox.findMailboxOfType(mActivity, accountId, Mailbox.TYPE_INBOX);
|
||||
return mListContext.getMailboxId() == inboxId;
|
||||
}
|
||||
return (mMailbox != null) && (mMailbox.mType == Mailbox.TYPE_INBOX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,9 +159,7 @@ class UIControllerOnePane extends UIControllerBase {
|
||||
if (!isMessageListInstalled()) {
|
||||
return false;
|
||||
}
|
||||
long inboxId = Mailbox.findMailboxOfType(
|
||||
mActivity, mListContext.mAccountId, Mailbox.TYPE_INBOX);
|
||||
return mListContext.getMailboxId() == inboxId;
|
||||
return getMessageListFragment().isInboxList();
|
||||
}
|
||||
|
||||
// This is all temporary as we'll have a different action bar controller for 1-pane.
|
||||
|
Loading…
Reference in New Issue
Block a user