mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 22:15:15 -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:
parent
9044f73c01
commit
43b21f0a24
@ -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) {
|
||||||
@ -2292,9 +2292,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
|||||||
mSelectedCount += selectedCountDelta;
|
mSelectedCount += selectedCountDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the onPrepareActionMode is called
|
|
||||||
mActionMode.invalidate();
|
|
||||||
|
|
||||||
computeBatchDirection();
|
computeBatchDirection();
|
||||||
updateActionModeTitle();
|
updateActionModeTitle();
|
||||||
|
|
||||||
@ -3542,13 +3539,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.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user