1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fix crashes when selecting messages in the message list

Throughout the code we make the assumption that onPrepareActionMode() is
called right after starting the action mode. However, this is not the case on
Android 5.1.
With this change we call ActionMode.invalidate() right after starting the
action mode which causes onPrepareActionMode() to be invoked.
This commit is contained in:
cketti 2015-03-13 21:12:21 +01:00
parent e1bd260bd0
commit 672a85bcf4

View File

@ -2224,7 +2224,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
} }
if (mActionMode == null) { if (mActionMode == null) {
mActionMode = getActivity().startActionMode(mActionModeCallback); startAndPrepareActionMode();
} }
computeBatchDirection(); computeBatchDirection();
updateActionModeTitle(); updateActionModeTitle();
@ -2283,7 +2283,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
return; return;
} }
} else { } else {
mActionMode = getActivity().startActionMode(mActionModeCallback); startAndPrepareActionMode();
} }
if (selected) { if (selected) {
@ -3542,13 +3542,18 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
} }
if (mActionMode == null) { if (mActionMode == null) {
mActionMode = getActivity().startActionMode(mActionModeCallback); startAndPrepareActionMode();
} }
recalculateSelectionCount(); recalculateSelectionCount();
updateActionModeTitle(); updateActionModeTitle();
} }
private void startAndPrepareActionMode() {
mActionMode = getActivity().startActionMode(mActionModeCallback);
mActionMode.invalidate();
}
/** /**
* Recalculates the selection count. * Recalculates the selection count.
* *