Java Code Examples for android.support.v4.view.ViewCompat#setOverScrollMode()

The following examples show how to use android.support.v4.view.ViewCompat#setOverScrollMode() . 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: WrappingLinearLayoutManager.java    From aptoide-client with GNU General Public License v2.0 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}
 
Example 2
Source File: WrapLinearLayoutManager.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}
 
Example 3
Source File: CustomLinearLayoutManager.java    From Loop with Apache License 2.0 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}
 
Example 4
Source File: TouchChildPagerLayoutManager.java    From MultiView with Apache License 2.0 5 votes vote down vote up
@Override
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
    final int layoutDirection = dx > 0 ? 1 : -1;
    View currView = getCurrentPageView();
    //check if we need to work with the child view
    if (recyclerView != null && currView != null && currView.canScrollHorizontally(layoutDirection)
            && ((layoutDirection == 1 && currView.getLeft() <= 0) ||
            (layoutDirection == -1 && currView.getRight() >= currView.getWidth()))
            ) {
        dOffset = 0;
        if (lastTouchEvent != null) {
            currView.dispatchTouchEvent(lastTouchEvent);
            lastTouchEvent = null;
        }
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_NEVER);

        if ((layoutDirection == 1 && currView.getLeft() < 0) || (layoutDirection == -1 && currView.getRight() > currView.getWidth())) {
            adjust();
        }
        return 0;
    } else if (Math.abs(dOffset + dx) < triggPx &&
            recyclerView != null && currView != null &&
            currView.getLeft() == 0 && currView.getRight() == currView.getWidth()
            ) {
        dOffset += dx;
        if (lastTouchEvent != null) {
            currView.dispatchTouchEvent(lastTouchEvent);
            lastTouchEvent = null;
        }
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_NEVER);
        return 0;
    } else {
        dOffset = 0;
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_ALWAYS);
        return super.scrollHorizontallyBy(dx, recycler, state);
    }
}
 
Example 5
Source File: TouchChildPagerLayoutManager.java    From MultiView with Apache License 2.0 5 votes vote down vote up
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
    final int layoutDirection = dy > 0 ? 1 : -1;
    View currView = getCurrentPageView();
    //check if we need to work with the child view
    if (recyclerView != null && currView != null && currView.canScrollVertically(layoutDirection)
            && ((layoutDirection == 1 && currView.getTop() <= 0) ||
            (layoutDirection == -1 && currView.getBottom() >= currView.getHeight()))
            ) {
        dOffset = 0;
        if (lastTouchEvent != null) {
            currView.dispatchTouchEvent(lastTouchEvent);
            lastTouchEvent = null;
        }
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_NEVER);
        if ((layoutDirection == 1 && currView.getTop() < 0) ||
                (layoutDirection == -1 && currView.getBottom() > currView.getHeight())) {
            adjust();
        }
        return 0;
    } else if (Math.abs(dOffset + dy) < triggPy &&
            recyclerView != null && currView != null &&
            currView.getTop() == 0 && currView.getBottom() == currView.getHeight()
            ) {
        dOffset += dy;
        if (lastTouchEvent != null) {
            currView.dispatchTouchEvent(lastTouchEvent);
            lastTouchEvent = null;
        }
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_NEVER);
        return 0;
    } else {
        dOffset = 0;
        ViewCompat.setOverScrollMode(recyclerView, ViewCompat.OVER_SCROLL_ALWAYS);
        return super.scrollVerticallyBy(dy, recycler, state);
    }
}
 
Example 6
Source File: LinearLayoutManager2.java    From MultiView with Apache License 2.0 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}
 
Example 7
Source File: MyLinearLayoutManager.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}
 
Example 8
Source File: WrapContentManagerRecyclerView.java    From Expense-Tracker-App with MIT License 5 votes vote down vote up
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
        throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
    if (this.view == null) throw new IllegalStateException("view == null");
    this.overScrollMode = overScrollMode;
    ViewCompat.setOverScrollMode(view, overScrollMode);
}