Example usage for android.widget Scroller computeScrollOffset

List of usage examples for android.widget Scroller computeScrollOffset

Introduction

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

Prototype

public boolean computeScrollOffset() 

Source Link

Document

Call this when you want to know the new location.

Usage

From source file:org.telegram.ui.Components.NumberPicker.java

@Override
public void computeScroll() {
    Scroller scroller = mFlingScroller;
    if (scroller.isFinished()) {
        scroller = mAdjustScroller;//from   w w  w .j  a  va 2 s.co  m
        if (scroller.isFinished()) {
            return;
        }
    }
    scroller.computeScrollOffset();
    int currentScrollerY = scroller.getCurrY();
    if (mPreviousScrollerY == 0) {
        mPreviousScrollerY = scroller.getStartY();
    }
    scrollBy(0, currentScrollerY - mPreviousScrollerY);
    mPreviousScrollerY = currentScrollerY;
    if (scroller.isFinished()) {
        onScrollerFinished(scroller);
    } else {
        invalidate();
    }
}