List of usage examples for android.widget Scroller forceFinished
public final void forceFinished(boolean finished)
From source file:org.telegram.ui.Components.NumberPicker.java
private boolean moveToFinalScrollerPosition(Scroller scroller) { scroller.forceFinished(true); int amountToScroll = scroller.getFinalY() - scroller.getCurrY(); int futureScrollOffset = (mCurrentScrollOffset + amountToScroll) % mSelectorElementHeight; int overshootAdjustment = mInitialScrollOffset - futureScrollOffset; if (overshootAdjustment != 0) { if (Math.abs(overshootAdjustment) > mSelectorElementHeight / 2) { if (overshootAdjustment > 0) { overshootAdjustment -= mSelectorElementHeight; } else { overshootAdjustment += mSelectorElementHeight; }// w w w . jav a 2s.c o m } amountToScroll += overshootAdjustment; scrollBy(0, amountToScroll); return true; } return false; }