Example usage for android.widget Scroller forceFinished

List of usage examples for android.widget Scroller forceFinished

Introduction

In this page you can find the example usage for android.widget Scroller forceFinished.

Prototype

public final void forceFinished(boolean finished) 

Source Link

Document

Force the finished field to a particular value.

Usage

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;
}