@@ -244,8 +244,7 @@ public PathParser.PathDataNode[] evaluate(float fraction,
244244 }
245245
246246 /**
247- * @param anim Null if this is a ValueAnimator, otherwise this is an
248- * ObjectAnimator
247+ * @param anim The animator, must not be null
249248 * @param arrayAnimator Incoming typed array for Animator's attributes.
250249 * @param arrayObjectAnimator Incoming typed array for Object Animator's
251250 * attributes.
@@ -259,10 +258,6 @@ private static void parseAnimatorFromTypeArray(ValueAnimator anim,
259258 int valueType = arrayAnimator .getInt (R .styleable .Animator_valueType ,
260259 VALUE_TYPE_FLOAT );
261260
262- if (anim == null ) {
263- anim = new ValueAnimator ();
264- }
265-
266261 TypeEvaluator evaluator = null ;
267262
268263 boolean getFloats = (valueType == VALUE_TYPE_FLOAT );
@@ -592,6 +587,11 @@ private static ValueAnimator loadAnimator(Resources res, Theme theme,
592587 arrayObjectAnimator = res .obtainAttributes (attrs , R .styleable .PropertyAnimator );
593588 }
594589 }
590+
591+ if (anim == null ) {
592+ anim = new ValueAnimator ();
593+ }
594+
595595 parseAnimatorFromTypeArray (anim , arrayAnimator , arrayObjectAnimator );
596596
597597 final int resID =
@@ -601,7 +601,9 @@ private static ValueAnimator loadAnimator(Resources res, Theme theme,
601601 }
602602
603603 arrayAnimator .recycle ();
604- arrayObjectAnimator .recycle ();
604+ if (arrayObjectAnimator != null ) {
605+ arrayObjectAnimator .recycle ();
606+ }
605607
606608 return anim ;
607609 }
0 commit comments