diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java index b11caa1c6635a..1730a68ae31ca 100644 --- a/core/java/android/widget/OverScroller.java +++ b/core/java/android/widget/OverScroller.java @@ -394,4 +394,44 @@ public class OverScroller { public float getCurrVelocity() { return mCurrScroller.getCurrVelocity(); } + + /** + * Extend the scroll animation. This allows a running animation to scroll + * further and longer, when used with {@link #setFinalX(int)} or {@link #setFinalY(int)}. + * + * @param extend Additional time to scroll in milliseconds. + * @see #setFinalX(int) + * @see #setFinalY(int) + */ + public void extendDuration(int extend) { + if (mScrollMode == MODE_DEFAULT) { + mDefaultScroller.extendDuration(extend); + } + } + + /** + * Sets the final position (X) for this scroller. + * + * @param newX The new X offset as an absolute distance from the origin. + * @see #extendDuration(int) + * @see #setFinalY(int) + */ + public void setFinalX(int newX) { + if (mScrollMode == MODE_DEFAULT) { + mDefaultScroller.setFinalX(newX); + } + } + + /** + * Sets the final position (Y) for this scroller. + * + * @param newY The new Y offset as an absolute distance from the origin. + * @see #extendDuration(int) + * @see #setFinalX(int) + */ + public void setFinalY(int newY) { + if (mScrollMode == MODE_DEFAULT) { + mDefaultScroller.setFinalY(newY); + } + } }