private float calculateDy ( float distanceY ) { int currentY = view . getScrollY ( ) ; float nextY = distanceY + currentY ; boolean isInsideVertically = nextY >= minY && nextY <= maxY ; return isInsideVertically ? distanceY : 0 ; }
Returns the distance in the Y axes to perform the scroll taking into account the view boundary .