Loading src/com/fsck/k9/activity/MessageList.java +13 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,18 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme if (mDisplayMode != DisplayMode.MESSAGE_VIEW) { menu.findItem(R.id.next_message).setVisible(false); menu.findItem(R.id.previous_message).setVisible(false); } else { final MessageReference ref = mMessageViewFragment.getMessageReference(); final boolean canDoPrev = mMessageListFragment != null && !mMessageListFragment.isFirst(ref); final boolean canDoNext = mMessageListFragment != null && !mMessageListFragment.isLast(ref); final MenuItem prev = menu.findItem(R.id.previous_message); prev.setEnabled(canDoPrev); prev.getIcon().setAlpha(canDoPrev ? 255 : 127); final MenuItem next = menu.findItem(R.id.next_message); next.setEnabled(canDoNext); next.getIcon().setAlpha(canDoNext ? 255 : 127); } // Set title of menu item to switch to dark/light theme MenuItem toggleTheme = menu.findItem(R.id.toggle_message_view_theme); Loading Loading @@ -1063,6 +1075,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme showMessageView(); } } invalidateOptionsMenu(); } @Override Loading src/com/fsck/k9/fragment/MessageListFragment.java +19 −5 Original line number Diff line number Diff line Loading @@ -2838,6 +2838,24 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick openMessageAtPosition(position + 1); } public boolean isFirst(MessageReference messageReference) { return messageReference.equals(getReferenceForPosition(0)); } public boolean isLast(MessageReference messageReference) { return messageReference.equals(getReferenceForPosition(mAdapter.getCount() - 1)); } private MessageReference getReferenceForPosition(int position) { Cursor cursor = (Cursor) mAdapter.getItem(position); MessageReference ref = new MessageReference(); ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN); ref.folderName = cursor.getString(FOLDER_NAME_COLUMN); ref.uid = cursor.getString(UID_COLUMN); return ref; } private void openMessageAtPosition(int position) { // Scroll message into view if necessary int listViewPosition = adapterToListViewPosition(position); Loading @@ -2847,11 +2865,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick mListView.setSelection(listViewPosition); } Cursor cursor = (Cursor) mAdapter.getItem(position); MessageReference ref = new MessageReference(); ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN); ref.folderName = cursor.getString(FOLDER_NAME_COLUMN); ref.uid = cursor.getString(UID_COLUMN); MessageReference ref = getReferenceForPosition(position); // For some reason the mListView.setSelection() above won't do anything when we call // onOpenMessage() (and consequently mAdapter.notifyDataSetChanged()) right away. So we Loading Loading
src/com/fsck/k9/activity/MessageList.java +13 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,18 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme if (mDisplayMode != DisplayMode.MESSAGE_VIEW) { menu.findItem(R.id.next_message).setVisible(false); menu.findItem(R.id.previous_message).setVisible(false); } else { final MessageReference ref = mMessageViewFragment.getMessageReference(); final boolean canDoPrev = mMessageListFragment != null && !mMessageListFragment.isFirst(ref); final boolean canDoNext = mMessageListFragment != null && !mMessageListFragment.isLast(ref); final MenuItem prev = menu.findItem(R.id.previous_message); prev.setEnabled(canDoPrev); prev.getIcon().setAlpha(canDoPrev ? 255 : 127); final MenuItem next = menu.findItem(R.id.next_message); next.setEnabled(canDoNext); next.getIcon().setAlpha(canDoNext ? 255 : 127); } // Set title of menu item to switch to dark/light theme MenuItem toggleTheme = menu.findItem(R.id.toggle_message_view_theme); Loading Loading @@ -1063,6 +1075,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme showMessageView(); } } invalidateOptionsMenu(); } @Override Loading
src/com/fsck/k9/fragment/MessageListFragment.java +19 −5 Original line number Diff line number Diff line Loading @@ -2838,6 +2838,24 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick openMessageAtPosition(position + 1); } public boolean isFirst(MessageReference messageReference) { return messageReference.equals(getReferenceForPosition(0)); } public boolean isLast(MessageReference messageReference) { return messageReference.equals(getReferenceForPosition(mAdapter.getCount() - 1)); } private MessageReference getReferenceForPosition(int position) { Cursor cursor = (Cursor) mAdapter.getItem(position); MessageReference ref = new MessageReference(); ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN); ref.folderName = cursor.getString(FOLDER_NAME_COLUMN); ref.uid = cursor.getString(UID_COLUMN); return ref; } private void openMessageAtPosition(int position) { // Scroll message into view if necessary int listViewPosition = adapterToListViewPosition(position); Loading @@ -2847,11 +2865,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick mListView.setSelection(listViewPosition); } Cursor cursor = (Cursor) mAdapter.getItem(position); MessageReference ref = new MessageReference(); ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN); ref.folderName = cursor.getString(FOLDER_NAME_COLUMN); ref.uid = cursor.getString(UID_COLUMN); MessageReference ref = getReferenceForPosition(position); // For some reason the mListView.setSelection() above won't do anything when we call // onOpenMessage() (and consequently mAdapter.notifyDataSetChanged()) right away. So we Loading