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

added new call back to handle when the dragged view is dropped #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SiavashB
Copy link

This allows the user to distinguish between a swap that happened as a result of the dragged item passing through other items, and a swap that happened when the item was dropped into its final position (finger was lifted off the screen).

This is useful for when as a result of the items swapping, an expensive operation is performed, and we want to avoid unnecessary calls to that operation.

@vanlooverenkoen
Copy link

vanlooverenkoen commented Sep 11, 2016

awesome, this was my solution.

 mDragLayout.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (MotionEventCompat.getActionMasked(motionEvent) == MotionEvent.ACTION_UP) {
                updatePreviewsCallback.executeCallback();
            }
            return false;
        }
    });

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

Successfully merging this pull request may close these issues.

2 participants