/**@class android.widget.Scroller @extends java.lang.Object <p>This class encapsulates scrolling. You can use scrollers ({@link android.widget.Scroller} or {@link android.widget.OverScroller}) to collect the data you need to produce a scrolling animation—for example, in response to a fling gesture. Scrollers track scroll offsets for you over time, but they don't automatically apply those positions to your view. It's your responsibility to get and apply new coordinates at a rate that will make the scrolling animation look smooth.</p> <p>Here is a simple example:</p> <pre> private Scroller mScroller = new Scroller(context); ... public void zoomIn() { // Revert any animation currently in progress mScroller.forceFinished(true); // Start scrolling by providing a starting point and // the distance to travel mScroller.startScroll(0, 0, 100, 0); // Invalidate to request a redraw invalidate(); }</pre> <p>To track the changing positions of the x/y coordinates, use {@link #computeScrollOffset}. The method returns a boolean to indicate whether the scroller is finished. If it isn't, it means that a fling or programmatic pan operation is still in progress. You can use this method to find the current offsets of the x and y coordinates, for example:</p> <pre>if (mScroller.computeScrollOffset()) { // Get current x and y positions int currX = mScroller.getCurrX(); int currY = mScroller.getCurrY(); ... }</pre> */ var Scroller = { /**The amount of friction applied to flings. The default value is {@link ViewConfiguration#getScrollFriction}. @param {Number} friction A scalar dimension-less value representing the coefficient of friction. */ setFriction : function( ) {}, /**Returns whether the scroller has finished scrolling. @return {Boolean} True if the scroller has finished scrolling, false otherwise. */ isFinished : function( ) {}, /**Force the finished field to a particular value. @param {Boolean} finished The new finished value. */ forceFinished : function( ) {}, /**Returns how long the scroll event will take, in milliseconds. @return {Number} The duration of the scroll in milliseconds. */ getDuration : function( ) {}, /**Returns the current X offset in the scroll. @return {Number} The new X offset as an absolute distance from the origin. */ getCurrX : function( ) {}, /**Returns the current Y offset in the scroll. @return {Number} The new Y offset as an absolute distance from the origin. */ getCurrY : function( ) {}, /**Returns the current velocity. @return {Number} The original velocity less the deceleration. Result may be negative. */ getCurrVelocity : function( ) {}, /**Returns the start X offset in the scroll. @return {Number} The start X offset as an absolute distance from the origin. */ getStartX : function( ) {}, /**Returns the start Y offset in the scroll. @return {Number} The start Y offset as an absolute distance from the origin. */ getStartY : function( ) {}, /**Returns where the scroll will end. Valid only for "fling" scrolls. @return {Number} The final X offset as an absolute distance from the origin. */ getFinalX : function( ) {}, /**Returns where the scroll will end. Valid only for "fling" scrolls. @return {Number} The final Y offset as an absolute distance from the origin. */ getFinalY : function( ) {}, /**Call this when you want to know the new location. If it returns true, the animation is not yet finished. */ computeScrollOffset : function( ) {}, /**Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration. @param {Number} startX Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. @param {Number} startY Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. @param {Number} dx Horizontal distance to travel. Positive numbers will scroll the content to the left. @param {Number} dy Vertical distance to travel. Positive numbers will scroll the content up. */ startScroll : function( ) {}, /**Start scrolling by providing a starting point, the distance to travel, and the duration of the scroll. @param {Number} startX Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. @param {Number} startY Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. @param {Number} dx Horizontal distance to travel. Positive numbers will scroll the content to the left. @param {Number} dy Vertical distance to travel. Positive numbers will scroll the content up. @param {Number} duration Duration of the scroll in milliseconds. */ startScroll : function( ) {}, /**Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling. @param {Number} startX Starting point of the scroll (X) @param {Number} startY Starting point of the scroll (Y) @param {Number} velocityX Initial velocity of the fling (X) measured in pixels per second. @param {Number} velocityY Initial velocity of the fling (Y) measured in pixels per second @param {Number} minX Minimum X value. The scroller will not scroll past this point. @param {Number} maxX Maximum X value. The scroller will not scroll past this point. @param {Number} minY Minimum Y value. The scroller will not scroll past this point. @param {Number} maxY Maximum Y value. The scroller will not scroll past this point. */ fling : function( ) {}, /**Stops the animation. Contrary to {@link #forceFinished}(boolean), aborting the animating cause the scroller to move to the final x and y position @see #forceFinished(boolean) */ abortAnimation : function( ) {}, /**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 {Number} extend Additional time to scroll in milliseconds. @see #setFinalX(int) @see #setFinalY(int) */ extendDuration : function( ) {}, /**Returns the time elapsed since the beginning of the scrolling. @return {Number} The elapsed time in milliseconds. */ timePassed : function( ) {}, /**Sets the final position (X) for this scroller. @param {Number} newX The new X offset as an absolute distance from the origin. @see #extendDuration(int) @see #setFinalY(int) */ setFinalX : function( ) {}, /**Sets the final position (Y) for this scroller. @param {Number} newY The new Y offset as an absolute distance from the origin. @see #extendDuration(int) @see #setFinalX(int) */ setFinalY : function( ) {}, /** @hide */ isScrollingInDirection : function( ) {}, };