Scroller getFinalY - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Scroller getFinalY method.

This code example shows how to use the following methods:computeScrollOffset, forceFinished, getCurrY, getFinalY, isFinished
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
            int currY = scroller.getCurrY(); 
            int delta = lastScrollY - currY; 
            lastScrollY = currY; 
            if (delta != 0) { 
                listener.onScroll(delta); 
            } 
             
            // scrolling is not finished when it comes to final Y 
            // so, finish it manually  
            if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) { 
                currY = scroller.getFinalY(); 
                scroller.forceFinished(true); 
            } 
            if (!scroller.isFinished()) { 

7
CodeRank
This code example shows how to use the following methods:computeScrollOffset, forceFinished, getCurrY, getFinalY, isFinished
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
            int currY = scroller.getCurrY(); 
            int delta = lastScrollY - currY; 
            lastScrollY = currY; 
            if (delta != 0) { 
                listener.onScroll(delta); 
            } 
             
            // scrolling is not finished when it comes to final Y 
            // so, finish it manually  
            if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) { 
                currY = scroller.getFinalY(); 
                scroller.forceFinished(true); 
            } 
            if (!scroller.isFinished()) { 

7
CodeRank
This code example shows how to use the following methods:computeScrollOffset, forceFinished, getCurrY, getFinalY, isFinished
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
            int currY = scroller.getCurrY(); 
            int delta = lastScrollY - currY; 
            lastScrollY = currY; 
            if (delta != 0) { 
                listener.onScroll(delta); 
            } 
             
            // scrolling is not finished when it comes to final Y 
            // so, finish it manually  
            if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) { 
                currY = scroller.getFinalY(); 
                scroller.forceFinished(true); 
            } 
            if (!scroller.isFinished()) { 

6
CodeRank
This code example shows how to use the following methods:getCurrY, getFinalX, getFinalY, startScroll
			} 
		} 
	} 
 
	public void smoothScrollBy(int dx, int dy) {
		mScroller.startScroll(mScroller.getFinalX(), mScroller.getFinalY(), dx,
				dy);
		invalidate();
	} 
 
	public void smoothScrollTo(int fx, int fy) {
		int dx = fx - mScroller.getFinalX();
		int dy = fy - mScroller.getFinalY();
		smoothScrollBy(dx, dy);
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		final int action = event.getAction();
		final float x = event.getX();

6
CodeRank
This code example shows how to use the following methods:getCurrX, getCurrY, getFinalX, getFinalY, startScroll
		int screenWidth  = getWidth();
		int screenHeight = getHeight();
		// We might be mid scroll; we want to calculate where we scroll to based on 
		// where this scroll would end, not where we are now (to allow for people 
		// bashing 'forwards' very fast. 
		int remainingX = mScroller.getFinalX() - mScroller.getCurrX();
		int remainingY = mScroller.getFinalY() - mScroller.getCurrY();
		// right/bottom is in terms of pixels within the scaled document; e.g. 1000 
		int top = -(v.getTop()  + mYScroll + remainingY);
		int right  = screenWidth -(v.getLeft() + mXScroll + remainingX);
		int bottom = screenHeight+top;
		// docWidth/Height are the width/height of the scaled document e.g. 2000x3000 
		int docWidth  = v.getMeasuredWidth();
		int docHeight = v.getMeasuredHeight();
 
		int xOffset, yOffset;
		if (bottom >= docHeight) {
			// We are flush with the bottom. Advance to next column. 
			if (right + screenWidth > docWidth) {
				// No room for another column - go to next page 

5
CodeRank
This code example shows how to use the following methods:getCurrX, getCurrY, getFinalX, getFinalY, startScroll
		int screenWidth  = getWidth();
		int screenHeight = getHeight();
		// We might be mid scroll; we want to calculate where we scroll to based on 
		// where this scroll would end, not where we are now (to allow for people 
		// bashing 'forwards' very fast. 
		int remainingX = mScroller.getFinalX() - mScroller.getCurrX();
		int remainingY = mScroller.getFinalY() - mScroller.getCurrY();
		// right/bottom is in terms of pixels within the scaled document; e.g. 1000 
		int top = -(v.getTop()  + mYScroll + remainingY);
		int right  = screenWidth -(v.getLeft() + mXScroll + remainingX);
		int bottom = screenHeight+top;
		// docWidth/Height are the width/height of the scaled document e.g. 2000x3000 
		int docWidth  = v.getMeasuredWidth();
		int docHeight = v.getMeasuredHeight();
 
		int xOffset, yOffset;
		if (bottom >= docHeight) {
			// We are flush with the bottom. Advance to next column. 
			if (right + screenWidth > docWidth) {
				// No room for another column - go to next page 

5
CodeRank
This code example shows how to use the following methods:getCurrX, getCurrY, getFinalX, getFinalY, startScroll
		int screenWidth  = getWidth();
		int screenHeight = getHeight();
		// We might be mid scroll; we want to calculate where we scroll to based on 
		// where this scroll would end, not where we are now (to allow for people 
		// bashing 'forwards' very fast. 
		int remainingX = mScroller.getFinalX() - mScroller.getCurrX();
		int remainingY = mScroller.getFinalY() - mScroller.getCurrY();
		// right/bottom is in terms of pixels within the scaled document; e.g. 1000 
		int top = -(v.getTop()  + mYScroll + remainingY);
		int right  = screenWidth -(v.getLeft() + mXScroll + remainingX);
		int bottom = screenHeight+top;
		// docWidth/Height are the width/height of the scaled document e.g. 2000x3000 
		int docWidth  = v.getMeasuredWidth();
		int docHeight = v.getMeasuredHeight();
 
		int xOffset, yOffset;
		if (bottom >= docHeight) {
			// We are flush with the bottom. Advance to next column. 
			if (right + screenWidth > docWidth) {
				// No room for another column - go to next page 

5
CodeRank
This code example shows how to use the following methods:getCurrX, getCurrY, getFinalX, getFinalY, isFinished
                /* 
                 * If being flinged and user touches the screen, initiate drag; 
                 * otherwise don't.  mScroller.isFinished should be false when 
                 * being flinged. 
                 */ 
                final int xyDist = Math.abs(!mVertical ? (mScroller.getFinalX() - mScroller.getCurrX()) :
                        (mScroller.getFinalY() - mScroller.getCurrY()));
                final boolean finishedScrolling = (mScroller.isFinished() || xyDist < mTouchSlop);
                if (finishedScrolling) {
                    mTouchState = TOUCH_STATE_REST;
                    mScroller.abortAnimation();
                } else { 
                    mTouchState = TOUCH_STATE_SCROLLING;
                } 
 
                // check if this can be the beginning of a tap on the side of the pages 
                // to scroll the current page 
                if (mTouchState != TOUCH_STATE_PREV_PAGE && mTouchState != TOUCH_STATE_NEXT_PAGE) {
                    if (getChildCount() > 0) {
                        if (hitsPreviousPage(x, y)) {
3
CodeRank
getFinalY Method Overview
Returns where the scroll will end.
See Code Examples for other Android Scroller Methods: