Example usage for android.support.v4.widget EdgeEffectCompat setSize

List of usage examples for android.support.v4.widget EdgeEffectCompat setSize

Introduction

In this page you can find the example usage for android.support.v4.widget EdgeEffectCompat setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

Set the size of this edge effect in pixels.

Usage

From source file:com.h6ah4i.android.widget.advrecyclerview.draggable.BaseEdgeEffectDecorator.java

private static void updateGlowSize(RecyclerView rv, EdgeEffectCompat glow, int dir) {
    int width = rv.getMeasuredWidth();
    int height = rv.getMeasuredHeight();

    if (getClipToPadding(rv)) {
        width -= rv.getPaddingLeft() + rv.getPaddingRight();
        height -= rv.getPaddingTop() + rv.getPaddingBottom();
    }/* ww w  .  j  a  v  a 2s  .c o m*/

    width = Math.max(0, width);
    height = Math.max(0, height);

    if (dir == EDGE_LEFT || dir == EDGE_RIGHT) {
        int t = width;
        width = height;
        height = t;
    }

    glow.setSize(width, height);
}

From source file:com.github.shareme.gwsmaterialuikit.library.advancerv.draggable.BaseEdgeEffectDecorator.java

private static void updateGlowSize(RecyclerView rv, EdgeEffectCompat glow, int dir) {
    int width = rv.getMeasuredWidth();
    int height = rv.getMeasuredHeight();

    if (getClipToPadding(rv)) {
        width -= rv.getPaddingLeft() + rv.getPaddingRight();
        height -= rv.getPaddingTop() + rv.getPaddingBottom();
    }//from  ww w. j a  va2  s.  c  o m

    width = Math.max(0, width);
    height = Math.max(0, height);

    if (dir == EDGE_LEFT || dir == EDGE_RIGHT) {
        int t = width;
        //noinspection SuspiciousNameCombination
        width = height;
        height = t;
    }

    glow.setSize(width, height);
}

From source file:me.oriley.vista.VistaEdgeEffectHelper.java

@CheckResult
private boolean replaceEdgeEffectCompat(@NonNull Context context, @NonNull Field field,
        @NonNull VistaEdgeEffect edgeEffect) {
    if (EDGE_EFFECT_COMPAT_DELEGATE == null) {
        Log.e(TAG, "Unable to find edge effect delegate field");
        return false;
    }//from   w  ww .  j a  v a  2  s  . com

    try {
        EdgeEffectCompat edgeEffectCompat = new EdgeEffectCompat(context);
        EDGE_EFFECT_COMPAT_DELEGATE.set(edgeEffectCompat, edgeEffect);

        field.set(mHost, edgeEffectCompat);
        edgeEffectCompat.setSize(mHost.getMeasuredWidth(), mHost.getMeasuredHeight());
        Log.d(TAG, "Replaced edge effect " + field + " in " + mHost);
        return true;
    } catch (Exception e) {
        Log.e(TAG, "Error replacing edge effect " + field + " in " + mHost);
        e.printStackTrace();
        return false;
    }
}