-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not remain in actionmode #94
Comments
@readbeard you can have any behavior you want. If you select an action, just finish the |
… those are updated later if the actionMode is finished * improve behavior mentioned in #94
will be improved in the next version |
Here is my solution to the improvement. Let me know if you like it and if it is a correct behaviour for you. public Snackbar remove(View view, String text, String actionText, @Snackbar.Duration int duration, Set<Integer> positions, ActionMode actionMode) { //<---
. . .
private void doChange(ActionMode actionMode) {
if (mHistory != null) {
if (mHistory.action == ACTION_REMOVE) {
Integer[] positions = new Integer[mHistory.positions.size()];
mHistory.positions.toArray(positions);
for (int i = positions.length - 1; i >= 0; i--) {
FastAdapter.RelativeInfo<Item> relativeInfo = mHistory.items.get(i);
if (relativeInfo.adapter instanceof IItemAdapter) {
((IItemAdapter) relativeInfo.adapter).remove(positions[i]);
}
}
}
}
actionMode.finish(); // <---
}
private void undoChange() {
if (mHistory != null) {
if (mHistory.action == ACTION_REMOVE) {
int count = 0;
for (Integer position : mHistory.positions) {
FastAdapter.RelativeInfo<Item> relativeInfo = mHistory.items.get(count);
if (relativeInfo.adapter instanceof IItemAdapter) {
IItemAdapter<Item> adapter = (IItemAdapter<Item>) relativeInfo.adapter;
adapter.add(position, relativeInfo.item);
if (relativeInfo.item.isSelected()) {
mAdapter.deselect(position); //<---
}
}
count++;
}
}
}
mHistory = null;
} |
@readbeard that was the case before. That's why I had to do the following change: |
Hi,
thanks for this great library!
I was wondering why the multichoice mode is not implemented as the one in gmail app. It think it would be better if the actionmode is closed as soon as an action is selected (for example, as soon as an item is deleted). Is it possible to do that?
Thanks in advance.
The text was updated successfully, but these errors were encountered: