From 45339457f80925bd8fff42df3a1393658ee5c0a9 Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 3 Jul 2010 00:26:35 +0000 Subject: [PATCH] Added preference to go to Integrated Inbox on application startup. Fixes issue 1797 --- res/values/strings.xml | 2 ++ res/xml/global_preferences.xml | 4 ++++ src/com/fsck/k9/K9.java | 13 +++++++++++++ src/com/fsck/k9/activity/Accounts.java | 7 ++++++- src/com/fsck/k9/activity/setup/Prefs.java | 6 ++++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index e72303114..9e8773c31 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -765,6 +765,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Manage \"Back\" button Make \"Back\" always go up a level + Integrated Inbox on start + Show the Integrated Inbox after startup Show account size Turn off for faster display diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index e484588c0..67f8441e2 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -53,6 +53,10 @@ android:title="@string/manage_back_title" android:summary="@string/manage_back_summary" /> + diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index d154b6fdb..2c191ee2a 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -83,6 +83,7 @@ public class K9 extends Application private static boolean mGesturesEnabled = true; private static boolean mManageBack = false; + private static boolean mStartIntegratedInbox = false; private static boolean mMeasureAccounts = true; private static boolean mCountSearchMessages = true; @@ -302,6 +303,7 @@ public class K9 extends Application editor.putBoolean("animations", mAnimations); editor.putBoolean("gesturesEnabled", mGesturesEnabled); editor.putBoolean("manageBack", mManageBack); + editor.putBoolean("startIntegratedInbox", mStartIntegratedInbox); editor.putBoolean("measureAccounts", mMeasureAccounts); editor.putBoolean("countSearchMessages", mCountSearchMessages); editor.putBoolean("messageListStars",mMessageListStars); @@ -332,6 +334,7 @@ public class K9 extends Application mAnimations = sprefs.getBoolean("animations", true); mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", true); mManageBack = sprefs.getBoolean("manageBack", false); + mStartIntegratedInbox = sprefs.getBoolean("startIntegratedInbox", false); mMeasureAccounts = sprefs.getBoolean("measureAccounts", true); mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true); mMessageListStars = sprefs.getBoolean("messageListStars",true); @@ -476,6 +479,16 @@ public class K9 extends Application mManageBack = manageBack; } + public static boolean startIntegratedInbox() + { + return mStartIntegratedInbox; + } + + public static void setStartIntegratedInbox(boolean startIntegratedInbox) + { + mStartIntegratedInbox = startIntegratedInbox; + } + public static boolean isAnimations() { return mAnimations; diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index 96d189074..3c14797a7 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -325,7 +325,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC Account[] accounts = Preferences.getPreferences(this).getAccounts(); Intent intent = getIntent(); boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, true); - if (startup && accounts.length == 1) + if (startup && K9.startIntegratedInbox()) + { + onOpenAccount(integratedInboxAccount); + finish(); + } + else if (startup && accounts.length == 1) { onOpenAccount(accounts[0]); finish(); diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index f28570d37..c6a79a633 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -29,6 +29,7 @@ public class Prefs extends K9PreferenceActivity private static final String PREFERENCE_ANIMATIONS = "animations"; private static final String PREFERENCE_GESTURES = "gestures"; private static final String PREFERENCE_MANAGE_BACK = "manage_back"; + private static final String PREFERENCE_START_INTEGRATED_INBOX = "start_integrated_inbox"; private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes"; private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable"; @@ -46,6 +47,7 @@ public class Prefs extends K9PreferenceActivity private CheckBoxPreference mSensitiveLogging; private CheckBoxPreference mGestures; private CheckBoxPreference mManageBack; + private CheckBoxPreference mStartIntegratedInbox; private CheckBoxPreference mAnimations; private CheckBoxPreference mStars; private CheckBoxPreference mCheckboxes; @@ -158,6 +160,9 @@ public class Prefs extends K9PreferenceActivity mManageBack = (CheckBoxPreference)findPreference(PREFERENCE_MANAGE_BACK); mManageBack.setChecked(K9.manageBack()); + mStartIntegratedInbox = (CheckBoxPreference)findPreference(PREFERENCE_START_INTEGRATED_INBOX); + mStartIntegratedInbox.setChecked(K9.startIntegratedInbox()); + mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS); mStars.setChecked(K9.messageListStars()); @@ -201,6 +206,7 @@ public class Prefs extends K9PreferenceActivity K9.setAnimations(mAnimations.isChecked()); K9.setGesturesEnabled(mGestures.isChecked()); K9.setManageBack(mManageBack.isChecked()); + K9.setStartIntegratedInbox(mStartIntegratedInbox.isChecked()); K9.setMessageListStars(mStars.isChecked()); K9.setMessageListCheckboxes(mCheckboxes.isChecked()); K9.setMessageListTouchable(mTouchable.isChecked());