Example usage for android.view ViewPropertyAnimator cancel

List of usage examples for android.view ViewPropertyAnimator cancel

Introduction

In this page you can find the example usage for android.view ViewPropertyAnimator cancel.

Prototype

public void cancel() 

Source Link

Document

Cancels all property animations that are currently running or pending.

Usage

From source file:Main.java

private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs,
        int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) {
    view.setScaleX(startScaleValue);/*  w ww  .j av  a 2 s  . com*/
    view.setScaleY(startScaleValue);

    final ViewPropertyAnimator animator = view.animate();
    animator.cancel();

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue)
                .setListener(listener);
    } else {
        animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener)
                .withLayer();
    }
    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.setStartDelay(startDelay);

    animator.start();
}

From source file:Main.java

private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs,
        int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) {
    view.setScaleX(startScaleValue);//w ww.  j a v a  2 s.co  m
    view.setScaleY(startScaleValue);

    final ViewPropertyAnimator animator = view.animate();
    animator.cancel();

    animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener)
            .withLayer();

    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.setStartDelay(startDelay);

    animator.start();
}

From source file:com.l4digital.fastscroll.FastScroller.java

private void cancelAnimation(ViewPropertyAnimator animator) {
    if (animator != null) {
        animator.cancel();
    }
}