Only show flag-oriented pre-canned searches when message stars are

enabled.  This is an interim workaround for Issue 1411.
This commit is contained in:
Daniel Applebaum 2010-04-17 04:41:25 +00:00
parent f27aa4c5c0
commit 405d5f2e59
1 changed files with 19 additions and 8 deletions

View File

@ -24,6 +24,8 @@ import com.fsck.k9.activity.setup.AccountSetupBasics;
import com.fsck.k9.activity.setup.Prefs; import com.fsck.k9.activity.setup.Prefs;
import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Flag;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -392,16 +394,25 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{ {
BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts(); BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts();
BaseAccount[] newAccounts = new BaseAccount[accounts.length + 4]; List<BaseAccount> newAccounts = new ArrayList<BaseAccount>(accounts.length + 4);
newAccounts[0] = integratedInboxAccount; newAccounts.add(integratedInboxAccount);
newAccounts[1] = integratedInboxStarredAccount; if (K9.messageListStars())
newAccounts[2] = unreadAccount; {
newAccounts[3] = flaggedAccount; newAccounts.add(integratedInboxStarredAccount);
System.arraycopy(accounts, 0, newAccounts, 4, accounts.length); }
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); getListView().setAdapter(mAdapter);
if (newAccounts.length > 0) if (newAccounts.size() > 0)
{ {
mHandler.progress(Window.PROGRESS_START); mHandler.progress(Window.PROGRESS_START);
} }