Search in sources :

Example 31 with Animator

use of com.nineoldandroids.animation.Animator in project PersistentSearch by KieronQuinn.

the class MaterialMenuDrawable method initAnimations.

private void initAnimations(int transformDuration, int pressedDuration) {
    transformation = ObjectAnimator.ofFloat(this, transformationProperty, 0);
    transformation.setInterpolator(new DecelerateInterpolator(3));
    transformation.setDuration(transformDuration);
    transformation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            transformationRunning = false;
            setIconState(animatingIconState);
        }
    });
    pressedCircle = ObjectAnimator.ofFloat(this, pressedProgressProperty, 0, 0);
    pressedCircle.setDuration(pressedDuration);
    pressedCircle.setInterpolator(new DecelerateInterpolator());
    pressedCircle.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            pressedProgressValue = 0;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            pressedProgressValue = 0;
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter)

Example 32 with Animator

use of com.nineoldandroids.animation.Animator in project PersistentSearch by KieronQuinn.

the class SupportAnimatorPreL method addListener.

@Override
public void addListener(final AnimatorListener listener) {
    Animator a = mSupportFramework.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 33 with Animator

use of com.nineoldandroids.animation.Animator in project ListViewAnimations by nhaarman.

the class ViewAnimator method cancelExistingAnimation.

/**
     * Cancels any existing animations for given View.
     */
void cancelExistingAnimation(@NonNull final View view) {
    int hashCode = view.hashCode();
    Animator animator = mAnimators.get(hashCode);
    if (animator != null) {
        animator.end();
        mAnimators.remove(hashCode);
    }
}
Also used : Animator(com.nineoldandroids.animation.Animator) SuppressLint(android.annotation.SuppressLint)

Example 34 with Animator

use of com.nineoldandroids.animation.Animator in project ListViewAnimations by nhaarman.

the class AnimatorUtil method concatAnimators.

/**
     * Merges given Animators into one array.
     */
@NonNull
public static Animator[] concatAnimators(@NonNull final Animator[] childAnimators, @NonNull final Animator[] animators, @NonNull final Animator alphaAnimator) {
    Animator[] allAnimators = new Animator[childAnimators.length + animators.length + 1];
    int i;
    for (i = 0; i < childAnimators.length; ++i) {
        allAnimators[i] = childAnimators[i];
    }
    for (Animator animator : animators) {
        allAnimators[i] = animator;
        ++i;
    }
    allAnimators[allAnimators.length - 1] = alphaAnimator;
    return allAnimators;
}
Also used : Animator(com.nineoldandroids.animation.Animator) NonNull(android.support.annotation.NonNull)

Example 35 with Animator

use of com.nineoldandroids.animation.Animator in project AdvancedMaterialDrawer by madcyph3r.

the class MaterialRippleLayoutNineOld method startRipple.

private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled)
        return;
    float endRadius = getEndRadius();
    cancelAnimations();
    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });
    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Aggregations

Animator (com.nineoldandroids.animation.Animator)139 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)83 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)67 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)53 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)29 StateAnimator (carbon.animation.StateAnimator)28 View (android.view.View)27 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)13 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 RecyclerView (android.support.v7.widget.RecyclerView)6 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)6 ViewGroup (android.view.ViewGroup)5 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 ArcAnimator (io.codetail.animation.arcanimator.ArcAnimator)4 Paint (android.graphics.Paint)3 Rect (android.graphics.Rect)3 GestureDetector (android.view.GestureDetector)3