Search in sources :

Example 1 with AnimatorUpdateListener

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

the class AnimateDismissAdapter method createAnimatorForView.

private Animator createAnimatorForView(final View view) {
    final ViewGroup.LayoutParams lp = view.getLayoutParams();
    final int originalHeight = view.getHeight();
    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 0);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animator) {
            lp.height = 0;
            view.setLayoutParams(lp);
        }
    });
    animator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(final ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            view.setLayoutParams(lp);
        }
    });
    return animator;
}
Also used : ValueAnimator(com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator) Animator(com.marshalchen.common.uimodule.nineoldandroids.animation.Animator) ViewGroup(android.view.ViewGroup) AnimatorListenerAdapter(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorUpdateListener(com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator)

Aggregations

ViewGroup (android.view.ViewGroup)1 Animator (com.marshalchen.common.uimodule.nineoldandroids.animation.Animator)1 AnimatorListenerAdapter (com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorListenerAdapter)1 ValueAnimator (com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator)1 AnimatorUpdateListener (com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener)1