From 405d5f2e59a82795196c8b96803dbf8e5772b49b Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Sat, 17 Apr 2010 04:41:25 +0000 Subject: [PATCH] Only show flag-oriented pre-canned searches when message stars are enabled. This is an interim workaround for Issue 1411. --- src/com/fsck/k9/activity/Accounts.java | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index e39d05969..dc636a445 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -24,6 +24,8 @@ import com.fsck.k9.activity.setup.AccountSetupBasics; import com.fsck.k9.activity.setup.Prefs; import com.fsck.k9.mail.Flag; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -392,16 +394,25 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC { BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts(); - BaseAccount[] newAccounts = new BaseAccount[accounts.length + 4]; - newAccounts[0] = integratedInboxAccount; - newAccounts[1] = integratedInboxStarredAccount; - newAccounts[2] = unreadAccount; - newAccounts[3] = flaggedAccount; - System.arraycopy(accounts, 0, newAccounts, 4, accounts.length); + List newAccounts = new ArrayList(accounts.length + 4); + newAccounts.add(integratedInboxAccount); + if (K9.messageListStars()) + { + newAccounts.add(integratedInboxStarredAccount); + } + newAccounts.add(unreadAccount); + if (K9.messageListStars()) + { + newAccounts.add(flaggedAccount); + } + for (BaseAccount account : accounts) + { + newAccounts.add(account); + } - mAdapter = new AccountsAdapter(newAccounts); + mAdapter = new AccountsAdapter(newAccounts.toArray(new BaseAccount[0])); getListView().setAdapter(mAdapter); - if (newAccounts.length > 0) + if (newAccounts.size() > 0) { mHandler.progress(Window.PROGRESS_START); }