Search in sources :

Example 66 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 67 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 68 with Animator

use of com.nineoldandroids.animation.Animator in project smartmodule by carozhu.

the class ToggleExpandLayout method close.

public void close() {
    if (isOpen) {
        isOpen = false;
        for (OnToggleTouchListener l : listeners) {
            l.onStartClose(expandHeight, originalHeight);
        }
        int childCount = getChildCount();
        for (int i = 0; i < childCount - 1; i++) {
            View child = getChildAt(i);
            View preChild = getChildAt(i + 1);
            CloseViewAnimator animator = new CloseViewAnimator(mPosY, mTop, i);
            animator.animate(child);
            Log.e("animate open", "invoked");
            if (i == 0) {
                animator.addAnimatorListener(new Animator.AnimatorListener() {

                    @Override
                    public void onAnimationStart(Animator animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        for (int i = 0; i < getChildCount() - 1; i++) {
                            View child = getChildAt(i);
                            child.setVisibility(INVISIBLE);
                        }
                        for (OnToggleTouchListener l : listeners) {
                            l.onClosed();
                        }
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {
                    }
                });
            }
            mPosY = mPosY - preChild.getMeasuredHeight();
        }
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) View(android.view.View)

Example 69 with Animator

use of com.nineoldandroids.animation.Animator in project smartmodule by carozhu.

the class ToggleExpandLayout method open.

public void open() {
    if (!isOpen) {
        isOpen = true;
        for (int i = 0; i < getChildCount() - 1; i++) {
            View child = getChildAt(i);
            child.setVisibility(VISIBLE);
        }
        mPosY = 0;
        for (OnToggleTouchListener l : listeners) {
            l.onStartOpen(expandHeight, originalHeight);
        }
        int childCount = getChildCount();
        for (int i = childCount - 2; i > -1; i--) {
            View child = getChildAt(i);
            View preChild = getChildAt(i + 1);
            int preHeight = preChild.getMeasuredHeight();
            OpenViewAnimator animator = new OpenViewAnimator(mTop, mPosY + preHeight, i);
            animator.animate(child);
            Log.e("animate open", "invoked");
            if (i == 0) {
                animator.addAnimatorListener(new Animator.AnimatorListener() {

                    @Override
                    public void onAnimationStart(Animator animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        for (OnToggleTouchListener l : listeners) {
                            l.onOpen();
                        }
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {
                    }
                });
            }
            mPosY = mPosY + preHeight;
        }
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) View(android.view.View)

Example 70 with Animator

use of com.nineoldandroids.animation.Animator in project android-shapeLoadingView by zzz40500.

the class LoadingView method stopLoading.

private void stopLoading() {
    mStopped = true;
    if (mUpAnimatorSet != null) {
        if (mUpAnimatorSet.isRunning()) {
            mUpAnimatorSet.cancel();
        }
        mUpAnimatorSet.removeAllListeners();
        for (Animator animator : mUpAnimatorSet.getChildAnimations()) {
            animator.removeAllListeners();
        }
        mUpAnimatorSet = null;
    }
    if (mDownAnimatorSet != null) {
        if (mDownAnimatorSet.isRunning()) {
            mDownAnimatorSet.cancel();
        }
        mDownAnimatorSet.removeAllListeners();
        for (Animator animator : mDownAnimatorSet.getChildAnimations()) {
            animator.removeAllListeners();
        }
        mDownAnimatorSet = null;
    }
    this.removeCallbacks(mFreeFallRunnable);
}
Also used : Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

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