DragLinearLayout icon indicating copy to clipboard operation
DragLinearLayout copied to clipboard

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

Open SiavashB opened this issue 9 years ago • 1 comments

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.

SiavashB avatar Sep 10 '16 00:09 SiavashB

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;
        }
    });

vanlooverenkoen avatar Sep 11 '16 09:09 vanlooverenkoen