diff --git a/res/values/strings.xml b/res/values/strings.xml
index 830ccf0a6..2e5a94a7d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -339,6 +339,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
Use a fixed-width font when showing plain-text messages
Return to list after delete
Return to message list after message deletion
+ Show next message after delete
+ Show next message by default after message deletion
Confirm actions
Show a dialog whenever you perform selected actions
diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml
index d3297c942..58c41afdf 100644
--- a/res/xml/global_preferences.xml
+++ b/res/xml/global_preferences.xml
@@ -217,6 +217,12 @@
android:title="@string/global_settings_messageview_return_to_list_label"
android:summary="@string/global_settings_messageview_return_to_list_summary" />
+
+
classObject, String methodName) {
try {
return classObject.getMethod(methodName, boolean.class);
diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java
index d1df6dcad..d10ee7186 100644
--- a/src/com/fsck/k9/activity/MessageView.java
+++ b/src/com/fsck/k9/activity/MessageView.java
@@ -89,7 +89,7 @@ public class MessageView extends K9Activity implements OnClickListener {
private Message mMessage;
private static final int PREVIOUS = 1;
private static final int NEXT = 2;
- private int mLastDirection = PREVIOUS;
+ private int mLastDirection = (K9.messageViewShowNext()) ? NEXT : PREVIOUS;
private MessagingController mController = MessagingController.getInstance(getApplication());
private MessageReference mNextMessage = null;
private MessageReference mPreviousMessage = null;
diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java
index aa9168c65..c9f5c15a3 100644
--- a/src/com/fsck/k9/activity/setup/Prefs.java
+++ b/src/com/fsck/k9/activity/setup/Prefs.java
@@ -69,6 +69,7 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_COMPACT_LAYOUTS = "compact_layouts";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
+ private static final String PREFERENCE_MESSAGEVIEW_SHOW_NEXT = "messageview_show_next";
private static final String PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED = "messageview_zoom_controls";
private static final String PREFERENCE_QUIET_TIME_ENABLED = "quiet_time_enabled";
private static final String PREFERENCE_QUIET_TIME_STARTS = "quiet_time_starts";
@@ -106,6 +107,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mChangeContactNameColor;
private CheckBoxPreference mFixedWidth;
private CheckBoxPreference mReturnToList;
+ private CheckBoxPreference mShowNext;
private CheckBoxPreference mZoomControlsEnabled;
private CheckBoxPreference mMobileOptimizedLayout;
private ListPreference mBackgroundOps;
@@ -256,6 +258,9 @@ public class Prefs extends K9PreferenceActivity {
mReturnToList = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST);
mReturnToList.setChecked(K9.messageViewReturnToList());
+ mShowNext = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_SHOW_NEXT);
+ mShowNext.setChecked(K9.messageViewShowNext());
+
mZoomControlsEnabled = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED);
mZoomControlsEnabled.setChecked(K9.zoomControlsEnabled());
@@ -365,6 +370,7 @@ public class Prefs extends K9PreferenceActivity {
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());
K9.setMessageViewReturnToList(mReturnToList.isChecked());
+ K9.setMessageViewShowNext(mShowNext.isChecked());
K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked());
K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked());