@Override public ViewPropertyAnimator yBy(float value) { animatePropertyBy(Y, value); return this; }
@Override public ViewPropertyAnimator translationXBy(float value) { animatePropertyBy(TRANSLATION_X, value); return this; }
@Override public ViewPropertyAnimator rotationXBy(float value) { animatePropertyBy(ROTATION_X, value); return this; }
@Override public ViewPropertyAnimator rotationYBy(float value) { animatePropertyBy(ROTATION_Y, value); return this; }
@Override public ViewPropertyAnimator scaleXBy(float value) { animatePropertyBy(SCALE_X, value); return this; }
@Override public ViewPropertyAnimator scaleYBy(float value) { animatePropertyBy(SCALE_Y, value); return this; }
@Override public ViewPropertyAnimator xBy(float value) { animatePropertyBy(X, value); return this; }
@Override public ViewPropertyAnimator rotationBy(float value) { animatePropertyBy(ROTATION, value); return this; }
@Override public ViewPropertyAnimator translationYBy(float value) { animatePropertyBy(TRANSLATION_Y, value); return this; }
@Override public ViewPropertyAnimator alphaBy(float value) { animatePropertyBy(ALPHA, 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); }
/** * 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 xBy(float value) { animatePropertyBy(X, value); return this; }
@Override public ViewPropertyAnimator yBy(float value) { animatePropertyBy(Y, value); return this; }
@Override public ViewPropertyAnimator rotationYBy(float value) { animatePropertyBy(ROTATION_Y, value); return this; }
@Override public ViewPropertyAnimator translationXBy(float value) { animatePropertyBy(TRANSLATION_X, value); return this; }
@Override public ViewPropertyAnimator translationYBy(float value) { animatePropertyBy(TRANSLATION_Y, value); return this; }
@Override public ViewPropertyAnimator alphaBy(float value) { animatePropertyBy(ALPHA, 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); }