private boolean handleRowTouch(View view, MotionEvent event) { int action = event.getAction(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: mActivePointerId = event.getPointerId(0); mLastDownXlat = view.getTranslationX(); mLastDraggingView = view; mLastDownX = event.getRawX(); mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(event); int idx = mViews.indexOf(mLastDraggingView); mSpringChain.setControlSpringIndex(idx); mSpringChain.getControlSpring().setCurrentValue(mLastDownXlat); break; case MotionEvent.ACTION_MOVE: { final int pointerIndex = event.findPointerIndex(mActivePointerId); if (pointerIndex != -1) { final int location[] = {0, 0}; view.getLocationOnScreen(location); float x = event.getX(pointerIndex) + location[0]; float offset = x - mLastDownX + mLastDownXlat; mSpringChain.getControlSpring().setCurrentValue(offset); mVelocityTracker.addMovement(event); } break; } case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: final int pointerIndex = event.findPointerIndex(mActivePointerId); if (pointerIndex != -1) { mVelocityTracker.addMovement(event); mVelocityTracker.computeCurrentVelocity(1000); mSpringChain .getControlSpring() .setVelocity(mVelocityTracker.getXVelocity()) .setEndValue(0); } break; } return true; }