1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-13 04:55:04 -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 42419fc4e5
commit 08beb212c2

View File

@ -2217,7 +2217,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
}
if (mActionMode == null) {
mActionMode = getActivity().startActionMode(mActionModeCallback);
startAndPrepareActionMode();
}
computeBatchDirection();
updateActionModeTitle();
@ -2276,7 +2276,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
return;
}
} else {
mActionMode = getActivity().startActionMode(mActionModeCallback);
startAndPrepareActionMode();
}
if (selected) {
@ -2285,9 +2285,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
mSelectedCount += selectedCountDelta;
}
// make sure the onPrepareActionMode is called
mActionMode.invalidate();
computeBatchDirection();
updateActionModeTitle();
@ -3536,13 +3533,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.
*