Search in sources :

Example 96 with ValueAnimator

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

the class SwipeDismissTouchListener method performDismiss.

/**
     * Animates the dismissed list item to zero-height and fires the dismiss callback when all dismissed list item animations have completed.
     *
     * @param view the dismissed {@link android.view.View}.
     */
protected void performDismiss(@NonNull final View view, final int position) {
    mDismissedViews.add(view);
    mDismissedPositions.add(position);
    ValueAnimator animator = ValueAnimator.ofInt(view.getHeight(), 1).setDuration(mDismissAnimationTime);
    animator.addUpdateListener(new DismissAnimatorUpdateListener(view));
    animator.addListener(new DismissAnimatorListener());
    animator.start();
    mActiveDismissCount++;
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 97 with ValueAnimator

use of com.nineoldandroids.animation.ValueAnimator in project MinimalForm by sd6352051.

the class MinimalFormLayout method animPrevious.

private void animPrevious() {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(currentnumber, currentStep * progressnumber);
    valueAnimator.setDuration(ANIMATION_DURATION);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mProgressBar.setProgress((Integer) valueAnimator.getAnimatedValue());
        }
    });
    valueAnimator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 98 with ValueAnimator

use of com.nineoldandroids.animation.ValueAnimator in project MinimalForm by sd6352051.

the class MinimalFormLayout method animNext.

private void animNext() {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(currentnumber, currentStep * progressnumber);
    valueAnimator.setDuration(ANIMATION_DURATION);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            int i = (Integer) valueAnimator.getAnimatedValue();
            if (i == datasize * progressnumber) {
                success();
            } else {
                mProgressBar.setProgress(i);
            }
        }
    });
    valueAnimator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 99 with ValueAnimator

use of com.nineoldandroids.animation.ValueAnimator in project FlowingDrawer by mxn21.

the class ElasticDrawer method flowDown.

private void flowDown(final int finalX) {
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mMenuView.setUpDownFraction(animation.getAnimatedFraction());
        }
    });
    valueAnimator.addListener(new FlowingAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mDrawerState == STATE_OPENING) {
                mMenuVisible = finalX != 0;
                setOffsetPixels(finalX, 0, FlowingMenuLayout.TYPE_NONE);
                setDrawerState(finalX == 0 ? STATE_CLOSED : STATE_OPEN);
                stopLayerTranslation();
            }
        }
    });
    valueAnimator.setDuration(300);
    valueAnimator.setInterpolator(new OvershootInterpolator(4f));
    valueAnimator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 100 with ValueAnimator

use of com.nineoldandroids.animation.ValueAnimator in project FlowingDrawer by mxn21.

the class ElasticDrawer method smoothClose.

protected void smoothClose(final int eventY) {
    endDrag();
    setDrawerState(STATE_CLOSING);
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(mOffsetPixels, 0);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setOffsetPixels((Float) animation.getAnimatedValue(), eventY, FlowingMenuLayout.TYPE_DOWN_SMOOTH);
        }
    });
    valueAnimator.addListener(new FlowingAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mMenuVisible = false;
            setOffsetPixels(0, 0, FlowingMenuLayout.TYPE_NONE);
            setDrawerState(STATE_CLOSED);
            stopLayerTranslation();
        }
    });
    valueAnimator.setDuration(500);
    valueAnimator.setInterpolator(new DecelerateInterpolator(4f));
    valueAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Aggregations

ValueAnimator (com.nineoldandroids.animation.ValueAnimator)105 Animator (com.nineoldandroids.animation.Animator)55 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)46 StateAnimator (carbon.animation.StateAnimator)30 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)19 View (android.view.View)17 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)15 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 Paint (android.graphics.Paint)7 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)5 RecyclerView (android.support.v7.widget.RecyclerView)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 FrameLayout (android.widget.FrameLayout)4 ImageView (android.widget.ImageView)4 ArrayList (java.util.ArrayList)4 MotionEvent (android.view.MotionEvent)3 TouchInterceptionFrameLayout (com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout)3 AnimatorUpdateListener (com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener)3