Example usage for android.widget EdgeEffect isFinished

List of usage examples for android.widget EdgeEffect isFinished

Introduction

In this page you can find the example usage for android.widget EdgeEffect isFinished.

Prototype

public boolean isFinished() 

Source Link

Document

Reports if this EdgeEffect's animation is finished.

Usage

From source file:com.bitflake.counter.HorizontalPicker.java

private void drawEdgeEffect(Canvas canvas, EdgeEffect edgeEffect, int degrees) {

    if (canvas == null || edgeEffect == null || (degrees != 90 && degrees != 270)) {
        return;//from  w w  w.  j  a va 2  s  .  c  om
    }

    if (!edgeEffect.isFinished()) {
        final int restoreCount = canvas.getSaveCount();
        final int width = getWidth();
        final int height = getHeight();

        canvas.rotate(degrees);

        if (degrees == 270) {
            canvas.translate(-height, Math.max(0, getScrollX()));
        } else { // 90
            canvas.translate(0, -(Math.max(getScrollRange(), getScaleX()) + width));
        }

        edgeEffect.setSize(height, width);
        if (edgeEffect.draw(canvas)) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                postInvalidateOnAnimation();
            } else {
                postInvalidate();
            }
        }

        canvas.restoreToCount(restoreCount);
    }

}