Search in sources :

Example 61 with Animator

use of com.nineoldandroids.animation.Animator in project MultiPhotoPicker by wangeason.

the class ImagePagerFragment method runExitAnimation.

/**
   * The exit animation is basically a reverse of the enter animation, except that if
   * the orientation has changed we simply scale the picture back into the center of
   * the screen.
   *
   * @param endAction This action gets run after the animation completes (this is
   * when we actually switch activities)
   */
public void runExitAnimation(final Runnable endAction) {
    if (!getArguments().getBoolean(ARG_HAS_ANIM, false) || !hasAnim) {
        endAction.run();
        return;
    }
    final long duration = ANIM_DURATION;
    // Animate image back to thumbnail size/location
    ViewPropertyAnimator.animate(mViewPager).setDuration(duration).setInterpolator(new AccelerateInterpolator()).scaleX((float) thumbnailWidth / mViewPager.getWidth()).scaleY((float) thumbnailHeight / mViewPager.getHeight()).translationX(thumbnailLeft).translationY(thumbnailTop).setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            endAction.run();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    // Fade out background
    ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0);
    bgAnim.setDuration(duration);
    bgAnim.start();
    // Animate a color filter to take the image back to grayscale,
    // in parallel with the image scaling and moving into place.
    ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this, "saturation", 1, 0);
    colorizer.setDuration(duration);
    colorizer.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ViewPropertyAnimator(com.nineoldandroids.view.ViewPropertyAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 62 with Animator

use of com.nineoldandroids.animation.Animator in project AisenWeiBo by wangdan.

the class SupportAnimatorPreL method addListener.

@Override
public void addListener(final AnimatorListener listener) {
    Animator a = mAnimator.get();
    if (a == null) {
        return;
    }
    if (listener == null) {
        a.addListener(null);
        return;
    }
    a.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            listener.onAnimationStart();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            listener.onAnimationEnd();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            listener.onAnimationCancel();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
            listener.onAnimationRepeat();
        }
    });
}
Also used : Animator(com.nineoldandroids.animation.Animator)

Example 63 with Animator

use of com.nineoldandroids.animation.Animator in project AisenWeiBo by wangdan.

the class ArcAnimator method setupStartValues.

@Override
public void setupStartValues() {
    super.setupStartValues();
    Animator a = mAnimator.get();
    if (a != null)
        a.setupStartValues();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator)

Example 64 with Animator

use of com.nineoldandroids.animation.Animator in project AisenWeiBo by wangdan.

the class ArcAnimator method start.

@Override
public void start() {
    super.start();
    Animator a = mAnimator.get();
    if (a != null)
        a.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator)

Example 65 with Animator

use of com.nineoldandroids.animation.Animator in project AisenWeiBo by wangdan.

the class ArcAnimator method end.

@Override
public void end() {
    super.end();
    Animator a = mAnimator.get();
    if (a != null)
        a.end();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator)

Aggregations

Animator (com.nineoldandroids.animation.Animator)136 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)81 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)68 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)49 StateAnimator (carbon.animation.StateAnimator)29 View (android.view.View)24 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)24 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)11 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 RecyclerView (android.support.v7.widget.RecyclerView)5 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)5 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)5 Paint (android.graphics.Paint)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ViewGroup (android.view.ViewGroup)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 ArcAnimator (io.codetail.animation.arcanimator.ArcAnimator)4 GestureDetector (android.view.GestureDetector)3 MotionEvent (android.view.MotionEvent)3