Example usage for android.support.v4.view ViewCompat getOverScrollMode

List of usage examples for android.support.v4.view ViewCompat getOverScrollMode

Introduction

In this page you can find the example usage for android.support.v4.view ViewCompat getOverScrollMode.

Prototype

public static int getOverScrollMode(View v) 

Source Link

Document

Returns the over-scroll mode for this view.

Usage

From source file:com.fengmap.drpeng.common.CustomLinearLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public CustomLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:io.c0nnector.github.least.managers.LinearLayoutManagerWrap.java

@SuppressWarnings("UnusedDeclaration")
public LinearLayoutManagerWrap(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:com.aptoide.amethyst.ui.WrappingLinearLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public WrappingLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:pl.pola_app.helpers.ProductsListLinearLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public ProductsListLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:com.bubble.simpleword.util.MyLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public MyLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:com.example.sunislee.testrecyclerview.NewLinearLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public NewLinearLayoutManager(RecyclerView view) {
    super(view.getContext());
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:com.example.sunislee.testrecyclerview.NewLinearLayoutManager.java

@SuppressWarnings("UnusedDeclaration")
public NewLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
    super(view.getContext(), orientation, reverseLayout);
    this.view = view;
    this.overScrollMode = ViewCompat.getOverScrollMode(view);
}

From source file:com.evilduck.piano.views.instrument.PianoView.java

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    boolean needsInvalidate = false;

    final int overScrollMode = ViewCompat.getOverScrollMode(this);
    if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS
            || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS)) {
        if (!leftEdgeEffect.isFinished()) {
            final int restoreCount = canvas.save();
            final int height = getHeight() - getPaddingTop() - getPaddingBottom();
            final int width = getWidth();

            canvas.rotate(270);/*from  ww w .  java  2 s .  c  om*/
            canvas.translate(-height + getPaddingTop(), 0);
            leftEdgeEffect.setSize(height, width);
            needsInvalidate |= leftEdgeEffect.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
        if (!rightEdgeEffect.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth();
            final int height = getHeight() - getPaddingTop() - getPaddingBottom();

            canvas.rotate(90);
            canvas.translate(-getPaddingTop(), -width);
            rightEdgeEffect.setSize(height, width);
            needsInvalidate |= rightEdgeEffect.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
    } else {
        leftEdgeEffect.finish();
        rightEdgeEffect.finish();
    }

    if (needsInvalidate) {
        ViewCompat.postInvalidateOnAnimation(this);
    }
}

From source file:android.support.v7.widget.RecyclerView.java

public RecyclerView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final int version = Build.VERSION.SDK_INT;
    mPostUpdatesOnAnimation = version >= 16;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER);

    mItemAnimator.setListener(mItemAnimatorListener);
}

From source file:cn.ieclipse.af.view.StaggeredGridView.java

/**
 *
 * @param deltaY Pixels that content should move by
 * @return true if the movement completed, false if it was stopped prematurely.
 *///w ww.  j  a  v  a  2  s  . c om
private boolean trackMotionScroll(int deltaY, boolean allowOverScroll) {
    final boolean contentFits = contentFits();
    final int allowOverhang = Math.abs(deltaY);

    final int overScrolledBy;
    final int movedBy;
    if (!contentFits) {
        final int overhang;
        final boolean up;
        mPopulating = true;
        if (deltaY > 0) {
            overhang = fillUp(mFirstPosition - 1, allowOverhang);
            up = true;
        } else {
            overhang = fillDown(mFirstPosition + getChildCount(), allowOverhang) + mItemMargin;
            up = false;
        }
        movedBy = Math.min(overhang, allowOverhang);
        offsetChildren(up ? movedBy : -movedBy);
        recycleOffscreenViews();
        mPopulating = false;
        overScrolledBy = allowOverhang - overhang;
    } else {
        overScrolledBy = allowOverhang;
        movedBy = 0;
    }

    if (allowOverScroll) {
        final int overScrollMode = ViewCompat.getOverScrollMode(this);

        if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS
                || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && !contentFits)) {

            if (overScrolledBy > 0) {
                EdgeEffectCompat edge = deltaY > 0 ? mTopEdge : mBottomEdge;
                edge.onPull((float) Math.abs(deltaY) / getHeight());
                ViewCompat.postInvalidateOnAnimation(this);
            }
        }
    }

    return deltaY == 0 || movedBy != 0;
}