Scroller isFinished - 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 isFinished method.

This code example shows how to use the following methods:abortAnimation, isFinished
		final float x = event.getX();
		final float y = event.getY();
		switch (action) {
		case MotionEvent.ACTION_DOWN:
			//Log.e(TAG, "event down!"); 
			if (!mScroller.isFinished()) {
				mScroller.abortAnimation();
			} 
			mLastMotionX = x;
			 
			//---------------New Code---------------------- 
			mLastMotionY = y;
			//--------------------------------------------- 
			 
			break; 
		case MotionEvent.ACTION_MOVE:
			int deltaX = (int) (mLastMotionX - x);
			 
			//---------------New Code---------------------- 
			int deltaY = (int) (mLastMotionY - y);
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()) { 

7
CodeRank
This code example shows how to use the following methods:computeScrollOffset, getCurrX, getCurrY, isFinished
		postInvalidate();
	} 
 
	@Override 
	public void computeScroll() { 
		if (!mScroller.isFinished()) {
			if (mScroller.computeScrollOffset()) {
				int oldX = mSlidingView.getScrollX();
				int oldY = mSlidingView.getScrollY();
				int x = mScroller.getCurrX();
				int y = mScroller.getCurrY();
				if (oldX != x || oldY != y) {
					if (mSlidingView != null) {
						mSlidingView.scrollTo(x, y);
						if (x < 0)
							bgShade.scrollTo(x + 20, y);// 背景阴影右偏
						else 
							bgShade.scrollTo(x - 20, y);// 背景阴影左偏
					} 
				} 
6
CodeRank
This code example shows how to use the following methods:abortAnimation, isFinished
        final float x = event.getX();
        final float y = event.getY();
 
        switch (action) {
        case MotionEvent.ACTION_DOWN:
            if (!scroller.isFinished()) {
                scroller.abortAnimation();
            } 
 
            mLastMotionX = x;
            mLastMotionY = y;
            isDragging = true;
            break; 
        case MotionEvent.ACTION_MOVE:
            final int xDiff = (int) Math.abs(x - mLastMotionX);
            if (xDiff > mTouchSlop) {
                isDragging = true;
            } 
 
            if (isDragging) {
6
CodeRank
This code example shows how to use the following methods:computeScrollOffset, getCurrX, getCurrY, isFinished
	public View getDisplayedView() {
		return mChildViews.get(mCurrent);
	} 
 
	public void run() { 
		if (!mScroller.isFinished()) {
			mScroller.computeScrollOffset();
			int x = mScroller.getCurrX();
			int y = mScroller.getCurrY();
			mXScroll += x - mScrollerLastX;
			mYScroll += y - mScrollerLastY;
			mScrollerLastX = x;
			mScrollerLastY = y;
			requestLayout();
			post(this);
		} else if (!mUserInteracting) {
			View v = mChildViews.get(mCurrent);
			postSettle(v);
		} 
	} 
6
CodeRank
This code example shows how to use the following methods:abortAnimation, getCurrX, getCurrY, isFinished, startScroll
	 
	/* 
	 * パネルが開いていれば閉じる。閉じていれば開く。 開閉途中であれば動作をキャンセルして元に戻す。 
	 */ 
	public synchronized void toggle() { 
		if (!mScroller.isFinished()) {
			mScroller.abortAnimation();
			int currX = mScroller.getCurrX();
			int currY = mScroller.getCurrY();
			if (opened) {
				mScroller.startScroll(currX, currY, (startX - currX),
						(startY - currY));
				opened = false;
			} else { 
				mScroller.startScroll(currX, currY, (finalX - currX),
						(finalY - currY));
				opened = true;
			} 
			invalidate();
			return; 
6
CodeRank
This code example shows how to use the following methods:computeScrollOffset, getCurrX, isFinished
This code example shows how to use the following methods:computeScrollOffset, forceFinished, isFinished
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
            int currPosition = getCurrentScrollerPosition(); 
            int delta = lastScrollPosition - currPosition; 
            lastScrollPosition = currPosition; 
            if (delta != 0) { 
                listener.onScroll(delta); 
            } 
             
            // scrolling is not finished when it comes to final Y 
            // so, finish it manually  
            if (Math.abs(currPosition - getFinalScrollerPosition()) < MIN_DELTA_FOR_SCROLLING) { 
                // currPosition = getFinalScrollerPosition(); 
                scroller.forceFinished(true); 
            } 
            if (!scroller.isFinished()) { 

6
CodeRank
This code example shows how to use the following methods:abortAnimation, isFinished
        final float x = event.getX();
 
        switch (action) {
            case MotionEvent.ACTION_DOWN:
 
                if (!mScroller.isFinished()) {
                    mScroller.abortAnimation();
                } 
                mLastMotionX = x;
                return true; 
 
            case MotionEvent.ACTION_MOVE:
 
                int deltaX = (int) (mLastMotionX - x);
                if (Math.abs(deltaX) > 10) {
                    setTouchState(TOUCH_STATE_SCROLLING);
                } 
 
                mLastMotionX = x;
 
6
CodeRank

Related Scroller isFinished Questions & Answers:

isFinished Method Overview
Returns whether the scroller has finished scrolling.
See Code Examples for other Android Scroller Methods: