diff --git a/library/res/values/attrs.xml b/library/res/values/attrs.xml new file mode 100644 index 0000000..be7b487 --- /dev/null +++ b/library/res/values/attrs.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/src/com/nineoldandroids/animation/AnimatorInflater.java b/library/src/com/nineoldandroids/animation/AnimatorInflater.java index f3ab192..590ea41 100644 --- a/library/src/com/nineoldandroids/animation/AnimatorInflater.java +++ b/library/src/com/nineoldandroids/animation/AnimatorInflater.java @@ -17,13 +17,14 @@ import android.content.Context; import android.content.res.Resources; +import android.content.res.Resources.NotFoundException; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; -import android.content.res.Resources.NotFoundException; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import android.view.animation.AnimationUtils; +import com.nineoldandroids.R; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -40,35 +41,6 @@ * something file.) */ public class AnimatorInflater { - private static final int[] AnimatorSet = new int[] { - /* 0 */ android.R.attr.ordering, - }; - private static final int AnimatorSet_ordering = 0; - - private static final int[] PropertyAnimator = new int[] { - /* 0 */ android.R.attr.propertyName, - }; - private static final int PropertyAnimator_propertyName = 0; - - private static final int[] Animator = new int[] { - /* 0 */ android.R.attr.interpolator, - /* 1 */ android.R.attr.duration, - /* 2 */ android.R.attr.startOffset, - /* 3 */ android.R.attr.repeatCount, - /* 4 */ android.R.attr.repeatMode, - /* 5 */ android.R.attr.valueFrom, - /* 6 */ android.R.attr.valueTo, - /* 7 */ android.R.attr.valueType, - }; - private static final int Animator_interpolator = 0; - private static final int Animator_duration = 1; - private static final int Animator_startOffset = 2; - private static final int Animator_repeatCount = 3; - private static final int Animator_repeatMode = 4; - private static final int Animator_valueFrom = 5; - private static final int Animator_valueTo = 6; - private static final int Animator_valueType = 7; - /** * These flags are used when parsing AnimatorSet objects */ @@ -147,11 +119,10 @@ private static Animator createAnimatorFromXml(Context c, XmlPullParser parser, anim = loadAnimator(c, attrs, null); } else if (name.equals("set")) { anim = new AnimatorSet(); - TypedArray a = c.obtainStyledAttributes(attrs, - /*com.android.internal.R.styleable.*/AnimatorSet); + TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.AnimatorSet); TypedValue orderingValue = new TypedValue(); - a.getValue(/*com.android.internal.R.styleable.*/AnimatorSet_ordering, orderingValue); + a.getValue(R.styleable.AnimatorSet_ordering, orderingValue); int ordering = orderingValue.type == TypedValue.TYPE_INT_DEC ? orderingValue.data : TOGETHER; createAnimatorFromXml(c, parser, attrs, (AnimatorSet) anim, ordering); @@ -192,9 +163,9 @@ private static ObjectAnimator loadObjectAnimator(Context context, AttributeSet a loadAnimator(context, attrs, anim); TypedArray a = - context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/PropertyAnimator); + context.obtainStyledAttributes(attrs, R.styleable.PropertyAnimator); - String propertyName = a.getString(/*com.android.internal.R.styleable.*/PropertyAnimator_propertyName); + String propertyName = a.getString(R.styleable.PropertyAnimator_propertyName); anim.setPropertyName(propertyName); @@ -214,13 +185,13 @@ private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, V throws NotFoundException { TypedArray a = - context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/Animator); + context.obtainStyledAttributes(attrs, R.styleable.Animator); - long duration = a.getInt(/*com.android.internal.R.styleable.*/Animator_duration, 0); + long duration = a.getInt(R.styleable.Animator_duration, 0); - long startDelay = a.getInt(/*com.android.internal.R.styleable.*/Animator_startOffset, 0); + long startDelay = a.getInt(R.styleable.Animator_startOffset, 0); - int valueType = a.getInt(/*com.android.internal.R.styleable.*/Animator_valueType, + int valueType = a.getInt(R.styleable.Animator_valueType, VALUE_TYPE_FLOAT); if (anim == null) { @@ -228,8 +199,8 @@ private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, V } //TypeEvaluator evaluator = null; - int valueFromIndex = /*com.android.internal.R.styleable.*/Animator_valueFrom; - int valueToIndex = /*com.android.internal.R.styleable.*/Animator_valueTo; + int valueFromIndex = R.styleable.Animator_valueFrom; + int valueToIndex = R.styleable.Animator_valueTo; boolean getFloats = (valueType == VALUE_TYPE_FLOAT); @@ -319,13 +290,13 @@ private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, V anim.setDuration(duration); anim.setStartDelay(startDelay); - if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatCount)) { + if (a.hasValue(R.styleable.Animator_repeatCount)) { anim.setRepeatCount( - a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatCount, 0)); + a.getInt(R.styleable.Animator_repeatCount, 0)); } - if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatMode)) { + if (a.hasValue(R.styleable.Animator_repeatMode)) { anim.setRepeatMode( - a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatMode, + a.getInt(R.styleable.Animator_repeatMode, ValueAnimator.RESTART)); } //if (evaluator != null) { @@ -333,7 +304,7 @@ private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, V //} final int resID = - a.getResourceId(/*com.android.internal.R.styleable.*/Animator_interpolator, 0); + a.getResourceId(R.styleable.Animator_interpolator, 0); if (resID > 0) { anim.setInterpolator(AnimationUtils.loadInterpolator(context, resID)); } diff --git a/sample/res/anim/animator.xml b/sample/res/anim/animator.xml index 2432f19..f349664 100644 --- a/sample/res/anim/animator.xml +++ b/sample/res/anim/animator.xml @@ -14,10 +14,10 @@ limitations under the License. --> - + diff --git a/sample/res/anim/animator_set.xml b/sample/res/anim/animator_set.xml index cab24c5..41823e7 100644 --- a/sample/res/anim/animator_set.xml +++ b/sample/res/anim/animator_set.xml @@ -14,19 +14,19 @@ limitations under the License. --> - - - + + + diff --git a/sample/res/anim/color_animator.xml b/sample/res/anim/color_animator.xml index 08ca017..95b2109 100644 --- a/sample/res/anim/color_animator.xml +++ b/sample/res/anim/color_animator.xml @@ -14,10 +14,10 @@ limitations under the License. --> - + diff --git a/sample/res/anim/object_animator.xml b/sample/res/anim/object_animator.xml index 863d423..9b9b167 100644 --- a/sample/res/anim/object_animator.xml +++ b/sample/res/anim/object_animator.xml @@ -14,10 +14,10 @@ limitations under the License. --> - +