Don't show color chips when there's only one account
Bug 3225322 Change-Id: Idb299f54dc6f746e7d451a7a04fb971a432a869a
This commit is contained in:
parent
5b81690de1
commit
e2201949ba
@ -121,6 +121,7 @@ public class MessageListFragment extends ListFragment
|
||||
private Mailbox mMailbox;
|
||||
private boolean mIsEasAccount;
|
||||
private boolean mIsRefreshable;
|
||||
private int mCountTotalAccounts;
|
||||
|
||||
// Controller access
|
||||
private Controller mController;
|
||||
@ -1033,6 +1034,7 @@ public class MessageListFragment extends ListFragment
|
||||
mMailbox = result.mMailbox;
|
||||
mIsEasAccount = result.mIsEasAccount;
|
||||
mIsRefreshable = result.mIsRefreshable;
|
||||
mCountTotalAccounts = result.mCountTotalAccounts;
|
||||
getLoaderManager().initLoader(LOADER_ID_MESSAGES_LOADER, null,
|
||||
new MessagesLoaderCallback(mMailboxChanging));
|
||||
|
||||
@ -1089,7 +1091,8 @@ public class MessageListFragment extends ListFragment
|
||||
|
||||
// Update the list
|
||||
mListAdapter.changeCursor(cursor);
|
||||
mListAdapter.setShowColorChips(mMailboxId < 0); // Show chips if combined view
|
||||
// Show chips if combined view.
|
||||
mListAdapter.setShowColorChips(mMailboxId < 0 && mCountTotalAccounts > 1);
|
||||
setListAdapter(mListAdapter);
|
||||
setListShown(true);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.email.data;
|
||||
|
||||
import com.android.email.provider.EmailContent;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
import com.android.email.provider.EmailContent.Mailbox;
|
||||
|
||||
@ -35,14 +36,16 @@ public class MailboxAccountLoader extends AsyncTaskLoader<MailboxAccountLoader.R
|
||||
public final Mailbox mMailbox;
|
||||
public final boolean mIsEasAccount;
|
||||
public final boolean mIsRefreshable;
|
||||
public final int mCountTotalAccounts;
|
||||
|
||||
private Result(boolean found, Account account, Mailbox mailbox, boolean isEasAccount,
|
||||
boolean isRefreshable) {
|
||||
boolean isRefreshable, int countTotalAccounts) {
|
||||
mIsFound = found;
|
||||
mAccount = account;
|
||||
mMailbox = mailbox;
|
||||
mIsEasAccount = isEasAccount;
|
||||
mIsRefreshable = isRefreshable;
|
||||
mCountTotalAccounts = countTotalAccounts;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +85,9 @@ public class MailboxAccountLoader extends AsyncTaskLoader<MailboxAccountLoader.R
|
||||
}
|
||||
}
|
||||
}
|
||||
Result result = new Result(found, account, mailbox, isEasAccount, isRefreshable);
|
||||
final int countAccounts = EmailContent.count(mContext, Account.CONTENT_URI);
|
||||
Result result = new Result(found, account, mailbox, isEasAccount, isRefreshable,
|
||||
countAccounts);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user