Example usage for android.animation ObjectAnimator getPropertyName

List of usage examples for android.animation ObjectAnimator getPropertyName

Introduction

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

Prototype

@Nullable
public String getPropertyName() 

Source Link

Document

Gets the name of the property that will be animated.

Usage

From source file:android.support.graphics.drawable.AnimatedVectorDrawableCompat.java

/**
 * Utility function to fix color interpolation prior to Lollipop. Without this fix, colors
 * are evaluated as raw integers instead of as colors, which leads to artifacts during
 * fillColor animations.//from www .j  ava2 s .  co m
 */
private void setupColorAnimator(Animator animator) {
    if (animator instanceof AnimatorSet) {
        List<Animator> childAnimators = ((AnimatorSet) animator).getChildAnimations();
        if (childAnimators != null) {
            for (int i = 0; i < childAnimators.size(); ++i) {
                setupColorAnimator(childAnimators.get(i));
            }
        }
    }
    if (animator instanceof ObjectAnimator) {
        ObjectAnimator objectAnim = (ObjectAnimator) animator;
        final String propertyName = objectAnim.getPropertyName();
        if ("fillColor".equals(propertyName) || "strokeColor".equals(propertyName)) {
            if (mArgbEvaluator == null) {
                mArgbEvaluator = new ArgbEvaluator();
            }
            objectAnim.setEvaluator(mArgbEvaluator);
        }
    }
}