diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 3bd249beb..d755c0537 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -1356,14 +1356,12 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme @Override public void showNextMessageOrReturn() { - if (K9.messageViewReturnToList()) { + if (K9.messageViewReturnToList() || !showNextMessage()) { if (mDisplayMode == DisplayMode.SPLIT_VIEW) { showMessageViewPlaceHolder(); } else { showMessageList(); } - } else { - showNextMessage(); } } @@ -1377,18 +1375,24 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme mActionBarSubject.setMessageHeader(header); } - private void showNextMessage() { + private boolean showNextMessage() { MessageReference ref = mMessageViewFragment.getMessageReference(); if (ref != null) { - mMessageListFragment.openNext(ref); + if (mMessageListFragment.openNext(ref)) { + return true; + } } + return false; } - private void showPreviousMessage() { + private boolean showPreviousMessage() { MessageReference ref = mMessageViewFragment.getMessageReference(); if (ref != null) { - mMessageListFragment.openPrevious(ref); + if (mMessageListFragment.openPrevious(ref)) { + return true; + } } + return false; } private void showMessageList() { diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java index c48ec2a23..08b8ce5b2 100644 --- a/src/com/fsck/k9/fragment/MessageListFragment.java +++ b/src/com/fsck/k9/fragment/MessageListFragment.java @@ -2854,22 +2854,24 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick } } - public void openPrevious(MessageReference messageReference) { + public boolean openPrevious(MessageReference messageReference) { int position = getPosition(messageReference); if (position <= 0) { - return; + return false; } openMessageAtPosition(position - 1); + return true; } - public void openNext(MessageReference messageReference) { + public boolean openNext(MessageReference messageReference) { int position = getPosition(messageReference); if (position < 0 || position == mAdapter.getCount() - 1) { - return; + return false; } openMessageAtPosition(position + 1); + return true; } public boolean isFirst(MessageReference messageReference) {