From fce2fc12d0522ee09b5da4a709bf476710d87ca2 Mon Sep 17 00:00:00 2001 From: baolongnt Date: Fri, 25 Feb 2011 12:36:47 -0800 Subject: [PATCH] Implemented option to hide special accounts (issue 3060) --- res/values/strings.xml | 3 +++ res/xml/global_preferences.xml | 10 ++++++++- src/com/fsck/k9/K9.java | 13 +++++++++++- src/com/fsck/k9/activity/Accounts.java | 25 +++++++++++++++-------- src/com/fsck/k9/activity/setup/Prefs.java | 8 +++++++- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4fd6b3938..550849c82 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -921,6 +921,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Count search results Turn off for faster display + Hide special accounts + Hide the unified inbox and all messages accounts + %s %s - Starred - Unread diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index b58487e67..aee7235e2 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -92,6 +92,13 @@ android:title="@string/count_search_title" android:summary="@string/count_search_summary" /> + + + android:summary="@string/start_integrated_inbox_summary" + android:dependency="hide_special_accounts" /> newAccounts = new ArrayList(accounts.length + 4); - if (accounts.length > 0) { + List newAccounts; + if (!K9.isHideSpecialAccounts() + && accounts.length > 0) { + newAccounts = new ArrayList(accounts.length + 2); newAccounts.add(integratedInboxAccount); newAccounts.add(unreadAccount); } + else { + newAccounts = new ArrayList(accounts.length); + } newAccounts.addAll(Arrays.asList(accounts)); diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index fdd190b54..1e5096321 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -52,6 +52,7 @@ public class Prefs extends K9PreferenceActivity { private static final String PREFERENCE_PRIVACY_MODE = "privacy_mode"; private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts"; private static final String PREFERENCE_COUNT_SEARCH = "count_search"; + private static final String PREFERENCE_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts"; private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable"; private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines"; private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; @@ -88,6 +89,7 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mPrivacyMode; private CheckBoxPreference mMeasureAccounts; private CheckBoxPreference mCountSearch; + private CheckBoxPreference mHideSpecialAccounts; private CheckBoxPreference mTouchable; private ListPreference mPreviewLines; private CheckBoxPreference mStars; @@ -191,6 +193,9 @@ public class Prefs extends K9PreferenceActivity { mCountSearch = (CheckBoxPreference)findPreference(PREFERENCE_COUNT_SEARCH); mCountSearch.setChecked(K9.countSearchMessages()); + mHideSpecialAccounts = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_SPECIAL_ACCOUNTS); + mHideSpecialAccounts.setChecked(K9.isHideSpecialAccounts()); + mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable.setChecked(K9.messageListTouchable()); @@ -298,11 +303,12 @@ public class Prefs extends K9PreferenceActivity { K9.setUseVolumeKeysForNavigation(mVolumeNavigation.getCheckedItems()[0]); K9.setUseVolumeKeysForListNavigation(mVolumeNavigation.getCheckedItems()[1]); K9.setManageBack(mManageBack.isChecked()); - K9.setStartIntegratedInbox(mStartIntegratedInbox.isChecked()); + K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked()); K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]); K9.setKeyguardPrivacy(mPrivacyMode.isChecked()); K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked()); + K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked()); K9.setMessageListTouchable(mTouchable.isChecked()); K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue())); K9.setMessageListStars(mStars.isChecked());