List of usage examples for android.animation ValueAnimator setValues
public void setValues(PropertyValuesHolder... values)
From source file:android.support.graphics.drawable.AnimatorInflaterCompat.java
/** * @param anim The animator, must not be null * @param arrayAnimator Incoming typed array for Animator's attributes. * @param arrayObjectAnimator Incoming typed array for Object Animator's * attributes. * @param pixelSize The relative pixel size, used to calculate the * maximum error for path animations. *///from w ww. j ava 2 s . c om private static void parseAnimatorFromTypeArray(ValueAnimator anim, TypedArray arrayAnimator, TypedArray arrayObjectAnimator, float pixelSize, XmlPullParser parser) { long duration = TypedArrayUtils.getNamedInt(arrayAnimator, parser, "duration", AndroidResources.STYLEABLE_ANIMATOR_DURATION, 300); long startDelay = TypedArrayUtils.getNamedInt(arrayAnimator, parser, "startOffset", AndroidResources.STYLEABLE_ANIMATOR_START_OFFSET, 0); int valueType = TypedArrayUtils.getNamedInt(arrayAnimator, parser, "valueType", AndroidResources.STYLEABLE_ANIMATOR_VALUE_TYPE, VALUE_TYPE_UNDEFINED); // Change to requiring both value from and to, otherwise, throw exception for now. if (TypedArrayUtils.hasAttribute(parser, "valueFrom") && TypedArrayUtils.hasAttribute(parser, "valueTo")) { if (valueType == VALUE_TYPE_UNDEFINED) { valueType = inferValueTypeFromValues(arrayAnimator, AndroidResources.STYLEABLE_ANIMATOR_VALUE_FROM, AndroidResources.STYLEABLE_ANIMATOR_VALUE_TO); } PropertyValuesHolder pvh = getPVH(arrayAnimator, valueType, AndroidResources.STYLEABLE_ANIMATOR_VALUE_FROM, AndroidResources.STYLEABLE_ANIMATOR_VALUE_TO, ""); if (pvh != null) { anim.setValues(pvh); } } anim.setDuration(duration); anim.setStartDelay(startDelay); anim.setRepeatCount(TypedArrayUtils.getNamedInt(arrayAnimator, parser, "repeatCount", AndroidResources.STYLEABLE_ANIMATOR_REPEAT_COUNT, 0)); anim.setRepeatMode(TypedArrayUtils.getNamedInt(arrayAnimator, parser, "repeatMode", AndroidResources.STYLEABLE_ANIMATOR_REPEAT_MODE, ValueAnimator.RESTART)); if (arrayObjectAnimator != null) { setupObjectAnimator(anim, arrayObjectAnimator, valueType, pixelSize, parser); } }