Search in sources :

Example 56 with Animator

use of com.nineoldandroids.animation.Animator in project MaterialCalendar by Haoxiqiang.

the class MemoFragment method release.

void release() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), startBluePairBottom);
    objectAnimator.addListener(new SimpleListener() {

        @Override
        public void onAnimationEnd(Animator animator) {
            disappearBluePair();
        }
    });
    objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
    objectAnimator.start();
}
Also used : ArcAnimator(io.codetail.animation.arcanimator.ArcAnimator) Animator(com.nineoldandroids.animation.Animator) SupportAnimator(io.codetail.animation.SupportAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 57 with Animator

use of com.nineoldandroids.animation.Animator in project NineOldAndroids by JakeWharton.

the class ViewPropertyAnimatorHC method animatePropertyBy.

/**
     * Utility function, called by animateProperty() and animatePropertyBy(), which handles the
     * details of adding a pending animation and posting the request to start the animation.
     *
     * @param constantName The specifier for the property being animated
     * @param startValue The starting value of the property
     * @param byValue The amount by which the property will change
     */
private void animatePropertyBy(int constantName, float startValue, float byValue) {
    // First, cancel any existing animations on this property
    if (mAnimatorMap.size() > 0) {
        Animator animatorToCancel = null;
        Set<Animator> animatorSet = mAnimatorMap.keySet();
        for (Animator runningAnim : animatorSet) {
            PropertyBundle bundle = mAnimatorMap.get(runningAnim);
            if (bundle.cancel(constantName)) {
                // there can only ever be one such animation running.
                if (bundle.mPropertyMask == NONE) {
                    // the animation is no longer changing anything - cancel it
                    animatorToCancel = runningAnim;
                    break;
                }
            }
        }
        if (animatorToCancel != null) {
            animatorToCancel.cancel();
        }
    }
    NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue);
    mPendingAnimations.add(nameValuePair);
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
        v.post(mAnimationStarter);
    }
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) View(android.view.View)

Example 58 with Animator

use of com.nineoldandroids.animation.Animator in project NineOldAndroids by JakeWharton.

the class ViewPropertyAnimatorPreHC method cancel.

@Override
public void cancel() {
    if (mAnimatorMap.size() > 0) {
        HashMap<Animator, PropertyBundle> mAnimatorMapCopy = (HashMap<Animator, PropertyBundle>) mAnimatorMap.clone();
        Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
        for (Animator runningAnim : animatorSet) {
            runningAnim.cancel();
        }
    }
    mPendingAnimations.clear();
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
    }
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) HashMap(java.util.HashMap) View(android.view.View)

Example 59 with Animator

use of com.nineoldandroids.animation.Animator in project appsly-android-rest by 47deg.

the class MainActivity method animateContent.

private void animateContent() {
    ViewHelper.setRotation(imageViewIcon, 20);
    ViewHelper.setTranslationY(imageViewIcon, -100);
    ViewHelper.setTranslationX(textViewCity, 100);
    ViewHelper.setAlpha(linearLayoutContent, 0);
    ViewHelper.setTranslationY(descriptionTempContent, 200);
    ViewHelper.setTranslationY(contentBottom, 200);
    animate(imageViewIcon).setDuration(300).setInterpolator(new AccelerateInterpolator()).translationY(0).setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            iconFall(imageViewIcon, 10);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    }).start();
    animate(textViewCity).setDuration(1000).setInterpolator(new AccelerateDecelerateInterpolator()).translationX(0).start();
    animate(linearLayoutContent).setDuration(1000).alpha(1).start();
    animate(contentBottom).setDuration(1000).translationY(0).start();
    animate(descriptionTempContent).setDuration(1000).translationY(0).start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 60 with Animator

use of com.nineoldandroids.animation.Animator in project PhotoNoter by yydcdut.

the class PhotoDetailActivity method showWidget.

@Override
public void showWidget(final IPhotoDetailPresenter.OnAnimationAdapter onAnimationAdapter) {
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(1000);
    animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "Y", -getActionBarSize() - (AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), ObjectAnimator.ofFloat(mBottomLayout, "Y", mBottomLayout.getTop() + getActionBarSize(), mBottomLayout.getTop()), ObjectAnimator.ofFloat(mStatusCoverView, "Y", -getActionBarSize(), 0f));
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationStarted(IPhotoDetailPresenter.STATE_SHOW);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationEnded(IPhotoDetailPresenter.STATE_SHOW);
            }
        }
    });
    animation.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

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