@Override public ViewPropertyAnimator y(float value) { animateProperty(Y, value); return this; }
@Override public ViewPropertyAnimator rotationXBy(float value) { animatePropertyBy(ROTATION_X, value); return this; }
/** * Utility function, called by the various xBy(), yBy(), etc. methods. This method is * just like animateProperty(), except the value is an offset from the property's * current value, instead of an absolute "to" value. * * @param constantName The specifier for the property being animated * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float byValue) { float fromValue = getValue(constantName); animatePropertyBy(constantName, fromValue, byValue); }
@Override public void start() { startAnimation(); }
/** * This method returns a ViewPropertyAnimator object, which can be used to animate specific * properties on this View. * * @param view View to animate. * @return The ViewPropertyAnimator associated with this View. */ public static ViewPropertyAnimator animate(View view) { ViewPropertyAnimator animator = ANIMATORS.get(view); if (animator == null) { final int version = Integer.valueOf(Build.VERSION.SDK); if (version >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { animator = new ViewPropertyAnimatorICS(view); } else if (version >= Build.VERSION_CODES.HONEYCOMB) { animator = new ViewPropertyAnimatorHC(view); } else { animator = new ViewPropertyAnimatorPreHC(view); } ANIMATORS.put(view, animator); } return animator; }
@Override public void start() { startAnimation(); }
/** * This method returns a ViewPropertyAnimator object, which can be used to animate specific * properties on this View. * * @param view View to animate. * @return The ViewPropertyAnimator associated with this View. */ public static ViewPropertyAnimator animate(View view) { ViewPropertyAnimator animator = ANIMATORS.get(view); if (animator == null) { final int version = Integer.valueOf(Build.VERSION.SDK); if (version >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { animator = new ViewPropertyAnimatorICS(view); } else if (version >= Build.VERSION_CODES.HONEYCOMB) { animator = new ViewPropertyAnimatorHC(view); } else { animator = new ViewPropertyAnimatorPreHC(view); } ANIMATORS.put(view, animator); } return animator; }
@Override public ViewPropertyAnimator rotationYBy(float value) { animatePropertyBy(ROTATION_Y, value); return this; }
@Override public ViewPropertyAnimator translationX(float value) { animateProperty(TRANSLATION_X, value); return this; }
/** * Utility function, called by the various x(), y(), etc. methods. This stores the * constant name for the property along with the from/delta values that will be used to * calculate and set the property during the animation. This structure is added to the * pending animations, awaiting the eventual start() of the underlying animator. A * Runnable is posted to start the animation, and any pending such Runnable is canceled * (which enables us to end up starting just one animator for all of the properties * specified at one time). * * @param constantName The specifier for the property being animated * @param toValue The value to which the property will animate */ private void animateProperty(int constantName, float toValue) { float fromValue = getValue(constantName); float deltaValue = toValue - fromValue; animatePropertyBy(constantName, fromValue, deltaValue); }
@Override public ViewPropertyAnimator rotationBy(float value) { animatePropertyBy(ROTATION, value); return this; }
@Override public ViewPropertyAnimator scaleX(float value) { animateProperty(SCALE_X, value); return this; }
/** * Utility function, called by the various xBy(), yBy(), etc. methods. This method is * just like animateProperty(), except the value is an offset from the property's * current value, instead of an absolute "to" value. * * @param constantName The specifier for the property being animated * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float byValue) { float fromValue = getValue(constantName); animatePropertyBy(constantName, fromValue, byValue); }
@Override public ViewPropertyAnimator translationXBy(float value) { animatePropertyBy(TRANSLATION_X, value); return this; }
@Override public ViewPropertyAnimator rotationX(float value) { animateProperty(ROTATION_X, value); return this; }
/** * Utility function, called by the various x(), y(), etc. methods. This stores the * constant name for the property along with the from/delta values that will be used to * calculate and set the property during the animation. This structure is added to the * pending animations, awaiting the eventual start() of the underlying animator. A * Runnable is posted to start the animation, and any pending such Runnable is canceled * (which enables us to end up starting just one animator for all of the properties * specified at one time). * * @param constantName The specifier for the property being animated * @param toValue The value to which the property will animate */ private void animateProperty(int constantName, float toValue) { float fromValue = getValue(constantName); float deltaValue = toValue - fromValue; animatePropertyBy(constantName, fromValue, deltaValue); }
@Override public ViewPropertyAnimator alphaBy(float value) { animatePropertyBy(ALPHA, value); return this; }
@Override public ViewPropertyAnimator translationY(float value) { animateProperty(TRANSLATION_Y, value); return this; }
@Override public ViewPropertyAnimator xBy(float value) { animatePropertyBy(X, value); return this; }
@Override public ViewPropertyAnimator rotation(float value) { animateProperty(ROTATION, value); return this; }