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

Drop event, without swapItems on move #176

Closed
volser opened this issue Sep 28, 2016 · 7 comments
Closed

Drop event, without swapItems on move #176

volser opened this issue Sep 28, 2016 · 7 comments

Comments

@volser
Copy link

volser commented Sep 28, 2016

How to implement drop event without swapItems on drag?
I want to drag item into another item, not swap

@volser
Copy link
Author

volser commented Sep 28, 2016

I have folders and files.

I need:

  • Drag and drop files onto each other to create a folder
  • Drag and drop files into an already created folder to add to that folder

But:

  1. When Folder collapsed onMove don't work over folder
    I guess, because
    @Override
    public boolean canDropOver(RecyclerView recyclerView, RecyclerView.ViewHolder current, RecyclerView.ViewHolder target) {
        return current.getItemViewType() == target.getItemViewType();
    }
  1. I don't want swap items on drag, but
/**
 * Called when an item has been dragged far enough to trigger a move. This is
 * called every time an item is shifted, and NOT at the end of a "drop" event!!!
 */
    @Override
    @CallSuper
    public boolean onItemMove(int fromPosition, int toPosition) {
        swapItems(mItems, fromPosition, toPosition);
        //After the swap, delegate further actions to the user
        if (mItemMoveListener != null) {
            mItemMoveListener.onItemMove(fromPosition, toPosition);
        }
        return true;
    }

How to implement what I need? Thanks

@davideas
Copy link
Owner

@volser, You can override the methods and write your own, so instead of move you delete the item you are dragging. But this library is not designed for tree views, you will have troubles.

@volser
Copy link
Author

volser commented Sep 28, 2016

@davideas Thanks for feedback
I don't need treeview only 1 level of folders (without nested folders)

  1. I can't override method in ItemTouchHelperCallback
  2. I can override, but I should call super
    @callsuper

@volser
Copy link
Author

volser commented Sep 28, 2016

. 3. And how catch Drop event?

@davideas
Copy link
Owner

@volser, I need to give the possibility to set a custom ItemTouchHelperCallback, where you can override everything, for moment you can't intercept everything but something.
It will take sometime to rewrite that part.

@volser
Copy link
Author

volser commented Sep 28, 2016

Ok, thanks

@davideas
Copy link
Owner

davideas commented Oct 7, 2016

@volser, with next SNAPSHOT, you can now set the ItemTouchHelperCallback and override swipeItems() with empty method.
onItemMove() is with @CallSuper because there's the call to the listener.

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

No branches or pull requests

2 participants