public final void update ( final float position ) { if ( reset ) { reset = false ; distance = 0 ; thresholdReachedPosition = - 1 ; dragStartTime = - 1 ; dragStartPosition = position ; reachedThreshold = false ; minDragDistance = 0 ; maxDragDistance = 0 ; } if ( ! reachedThreshold ) { if ( reachedThreshold ( position - dragStartPosition ) ) { dragStartTime = System . currentTimeMillis ( ) ; reachedThreshold = true ; thresholdReachedPosition = position ; } } else { float newDistance = position - thresholdReachedPosition ; if ( minDragDistance != 0 && minDragDistance > newDistance ) { newDistance = minDragDistance ; thresholdReachedPosition = position - minDragDistance ; } if ( maxDragDistance != 0 && maxDragDistance < newDistance ) { newDistance = maxDragDistance ; thresholdReachedPosition = position - maxDragDistance ; } distance = newDistance ; } }
Updates the instance by adding a new position . This will cause all properties to be re - calculated depending on the new position .