Skip to content
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

Error deleting in multiselect example #93

Closed
readbeard opened this issue Mar 24, 2016 · 3 comments
Closed

Error deleting in multiselect example #93

readbeard opened this issue Mar 24, 2016 · 3 comments
Assignees
Labels

Comments

@readbeard
Copy link

Hi,
I noticed that in the multiselect example, the snackbar is shown even when there is no element selected.
Steps for reproducing:

  • Long click on an item
  • Delete the item clicking on the trash button
  • Wait until the undo snackbar is dismissed
  • Click again on the trash button.
@readbeard
Copy link
Author

I think you can solve the problem in this way:
In class UndoHelper, in the method

public Snackbar remove(View view, String text, String actionText, @Snackbar.Duration int duration, Set<Integer> positions)

you can add the following line:

if(positions.isEmpty()){
  return Snackbar snackbar = Snackbar.make(view,"No item selected",duration);
}

@mikepenz
Copy link
Owner

@readbeard this should not happen if the ActionMode is finished when the action is clicked.

mode.finish() should do the job here:
https://github.com/mikepenz/FastAdapter/blob/develop/app/src/main/java/com/mikepenz/fastadapter/app/MultiselectSampleActivity.java#L157

Related to #94

@mikepenz mikepenz self-assigned this Mar 24, 2016
mikepenz added a commit that referenced this issue Mar 24, 2016
@readbeard
Copy link
Author

Hi,
i think your fix won't work. In fact, if you call mode.finish(), the undo operation won't work anymore. I tried it before your reply, and that's the reason why i posted my solution.
Do you confirm that?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants