Search in sources :

Example 1 with AnimatorUpdateListener

use of com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener in project Signal-Android by WhisperSystems.

the class TransferControlView method getWidthAnimator.

private Animator getWidthAnimator(final int from, final int to) {
    final ValueAnimator anim = ValueAnimator.ofInt(from, to);
    anim.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int val = (Integer) animation.getAnimatedValue();
            final ViewGroup.LayoutParams layoutParams = getLayoutParams();
            layoutParams.width = val;
            setLayoutParams(layoutParams);
        }
    });
    anim.setInterpolator(new FastOutSlowInInterpolator());
    anim.setDuration(TRANSITION_MS);
    return anim;
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) AnimatorUpdateListener(com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 2 with AnimatorUpdateListener

use of com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener in project SimplifyReader by chentao0707.

the class PlayerDiscView method reverseDiscAnimator.

private void reverseDiscAnimator() {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
    mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());
    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }
    mDiscLayoutAnimator.start();
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorUpdateListener(com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 3 with AnimatorUpdateListener

use of com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener in project Signal-Android by signalapp.

the class TransferControlView method getWidthAnimator.

private Animator getWidthAnimator(final int from, final int to) {
    final ValueAnimator anim = ValueAnimator.ofInt(from, to);
    anim.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int val = (Integer) animation.getAnimatedValue();
            final ViewGroup.LayoutParams layoutParams = getLayoutParams();
            layoutParams.width = val;
            setLayoutParams(layoutParams);
        }
    });
    anim.setInterpolator(new FastOutSlowInInterpolator());
    anim.setDuration(TRANSITION_MS);
    return anim;
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) AnimatorUpdateListener(com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 4 with AnimatorUpdateListener

use of com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener in project SimplifyReader by chentao0707.

the class PlayerDiscView method startDiscAnimator.

private void startDiscAnimator(float animatedValue) {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
    mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
    mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());
    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }
    mDiscLayoutAnimator.start();
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) AnimatorUpdateListener(com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Aggregations

ValueAnimator (com.nineoldandroids.animation.ValueAnimator)4 AnimatorUpdateListener (com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener)4 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)1 LinearInterpolator (android.view.animation.LinearInterpolator)1