Example usage for android.animation FloatEvaluator FloatEvaluator

List of usage examples for android.animation FloatEvaluator FloatEvaluator

Introduction

In this page you can find the example usage for android.animation FloatEvaluator FloatEvaluator.

Prototype

FloatEvaluator

Source Link

Usage

From source file:com.pdftron.pdf.utils.ViewerUtils.java

/**
 * Creates an Animator object that varies the alpha property of the view. The
 * interpolation used is linear.//from   www .j  a  v a 2s  . c o  m
 *
 * @param view the view to be animated
 * @param listener the listener to be used by this Animator
 *
 * @return a new Animator object that will change the "alpha" property
 * of the view.
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static Animator createAlphaAnimator(View view, Animator.AnimatorListener listener) {
    if (view == null) {
        return null;
    }
    // We animate only the opacity of the view.
    ValueAnimator fader = ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f, 0.4f, 1.0f, 0.0f);
    fader.setDuration(1500);
    fader.setEvaluator(new FloatEvaluator());
    if (listener != null) {
        fader.addListener(listener);
    }
    return fader;
}