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

Temporary disable drag and drop #23

Open
DanielRitvas opened this issue Nov 21, 2015 · 1 comment
Open

Temporary disable drag and drop #23

DanielRitvas opened this issue Nov 21, 2015 · 1 comment

Comments

@DanielRitvas
Copy link

Hello, I know how to disable drag and drop for specific type of ViewHolder at all, but how can I control it's "on/off" state from activity?

@wiktorwar
Copy link

You should use global boolean parameter and then set dragFlags to 0 when drag&drop is off, otherwise set proper drag flags.
@OverRide
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
int dragFlags = DriversSingleton.getDriversSingleton().isEditMode()? ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT:0;
final int swipeFlags = 0;
return makeMovementFlags(dragFlags, swipeFlags);
}

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

No branches or pull requests

2 participants