Search in sources :

Example 11 with ValueAnimator

use of com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator in project UltimateAndroid by cymcsg.

the class RiseNumberTextView method runInt.

private void runInt() {
    ValueAnimator valueAnimator = ValueAnimator.ofInt((int) fromNumber, (int) number);
    valueAnimator.setDuration(duration);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            setText(valueAnimator.getAnimatedValue().toString());
            if (valueAnimator.getAnimatedFraction() >= 1) {
                mPlayingState = STOPPED;
                if (mEndListener != null)
                    mEndListener.onEndFinish();
            }
        }
    });
    valueAnimator.start();
}
Also used : ValueAnimator(com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator)

Aggregations

ValueAnimator (com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator)11 Animator (com.marshalchen.common.uimodule.nineoldandroids.animation.Animator)5 AnimatorListenerAdapter (com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorListenerAdapter)5 ViewPropertyAnimator (com.marshalchen.common.uimodule.nineoldandroids.view.ViewPropertyAnimator)2 ArrayList (java.util.ArrayList)2 SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AnimatorUpdateListener (com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener)1