Java Code Examples for android.support.v7.widget.RecyclerView#getScrollState()

The following examples show how to use android.support.v7.widget.RecyclerView#getScrollState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwipeItemTouchListener.java    From Tangram-Android with MIT License 6 votes vote down vote up
@Override
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
    if ((recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) ||
        !isAttachedToWindow(recyclerView) || !hasAdapter(recyclerView)) {
        return false;
    }

    if (findFixedChildViewUnder(motionEvent) != null) {
        return false;
    }

    if (findScrollableChildViewUnder(motionEvent) != null) {
        return false;
    }

    mSwipeGestureDector.onTouchEvent(motionEvent);
    return isSwiping();
}
 
Example 2
Source File: SwipeItemTouchListener.java    From Tangram-Android with MIT License 6 votes vote down vote up
@Override
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
    if ((recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) ||
            !isAttachedToWindow(recyclerView) || !hasAdapter(recyclerView)) {
        return false;
    }

    if (findFixedChildViewUnder(motionEvent) != null) {
        return false;
    }

    if (findScrollableChildViewUnder(motionEvent) != null) {
        return false;
    }

    mSwipeGestureDector.onTouchEvent(motionEvent);
    return isSwiping();
}
 
Example 3
Source File: TangramEngine.java    From Tangram-Android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void refresh(final boolean layoutUpdated) {
    final RecyclerView contentView = getContentView();

    if (contentView == null) {
        return;
    }

    if (contentView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
        // contentView.stopScroll();
    }

    updateRunnable = new Runnable() {
        @Override
        public void run() {
            if (!contentView.isComputingLayout()) {
                //to prevent notify update when recyclerView is in computingLayout  process
                mGroupBasicAdapter.notifyUpdate(layoutUpdated);

                if (mSwipeItemTouchListener != null) {
                    mSwipeItemTouchListener.updateCurrCard();
                }
            }
        }
    };
    contentView.post(updateRunnable);
}
 
Example 4
Source File: TangramEngine.java    From Tangram-Android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void refresh(final boolean layoutUpdated) {
    final RecyclerView contentView = getContentView();

    if (contentView == null) {
        return;
    }

    if (contentView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
        // contentView.stopScroll();
    }

    updateRunnable = new Runnable() {
        @Override
        public void run() {
            if (!contentView.isComputingLayout()) {
                //to prevent notify update when recyclerView is in computingLayout  process
                mGroupBasicAdapter.notifyUpdate(layoutUpdated);

                if (mSwipeItemTouchListener != null) {
                    mSwipeItemTouchListener.updateCurrCard();
                }
            }
        }
    };
    contentView.post(updateRunnable);
}