DragLinearLayout
DragLinearLayout copied to clipboard
added new call back to handle when the dragged view is dropped
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.
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;
}
});