From e2201949bab24427aff4f5d85e36e96f6a2a8af6 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 23 Nov 2010 16:57:45 -0800 Subject: [PATCH] Don't show color chips when there's only one account Bug 3225322 Change-Id: Idb299f54dc6f746e7d451a7a04fb971a432a869a --- src/com/android/email/activity/MessageListFragment.java | 5 ++++- src/com/android/email/data/MailboxAccountLoader.java | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/activity/MessageListFragment.java b/src/com/android/email/activity/MessageListFragment.java index e02af7ec1..176162fcb 100644 --- a/src/com/android/email/activity/MessageListFragment.java +++ b/src/com/android/email/activity/MessageListFragment.java @@ -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); diff --git a/src/com/android/email/data/MailboxAccountLoader.java b/src/com/android/email/data/MailboxAccountLoader.java index 645b8017a..e91921ee3 100644 --- a/src/com/android/email/data/MailboxAccountLoader.java +++ b/src/com/android/email/data/MailboxAccountLoader.java @@ -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