diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java index 7b8113b8e..aa34110ff 100644 --- a/src/com/fsck/k9/fragment/MessageListFragment.java +++ b/src/com/fsck/k9/fragment/MessageListFragment.java @@ -2224,7 +2224,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } if (mActionMode == null) { - mActionMode = getActivity().startActionMode(mActionModeCallback); + startAndPrepareActionMode(); } computeBatchDirection(); updateActionModeTitle(); @@ -2283,7 +2283,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener return; } } else { - mActionMode = getActivity().startActionMode(mActionModeCallback); + startAndPrepareActionMode(); } if (selected) { @@ -2292,9 +2292,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener mSelectedCount += selectedCountDelta; } - // make sure the onPrepareActionMode is called - mActionMode.invalidate(); - computeBatchDirection(); updateActionModeTitle(); @@ -3542,13 +3539,18 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } if (mActionMode == null) { - mActionMode = getActivity().startActionMode(mActionModeCallback); + startAndPrepareActionMode(); } recalculateSelectionCount(); updateActionModeTitle(); } + private void startAndPrepareActionMode() { + mActionMode = getActivity().startActionMode(mActionModeCallback); + mActionMode.invalidate(); + } + /** * Recalculates the selection count. *