Search in sources :

Example 51 with ValueAnimator

use of android.animation.ValueAnimator in project android_frameworks_base by ResurrectionRemix.

the class KeyguardAffordanceView method getAnimatorToRadius.

private ValueAnimator getAnimatorToRadius(float circleRadius) {
    ValueAnimator animator = ValueAnimator.ofFloat(mCircleRadius, circleRadius);
    mCircleAnimator = animator;
    mCircleStartValue = mCircleRadius;
    mCircleWillBeHidden = circleRadius == 0.0f;
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mCircleRadius = (float) animation.getAnimatedValue();
            updateIconColor();
            invalidate();
        }
    });
    animator.addListener(mCircleEndListener);
    return animator;
}
Also used : ValueAnimator(android.animation.ValueAnimator)

Example 52 with ValueAnimator

use of android.animation.ValueAnimator in project android_frameworks_base by ResurrectionRemix.

the class DragDownHelper method cancelExpansion.

private void cancelExpansion() {
    ValueAnimator anim = ValueAnimator.ofFloat(mLastHeight, 0);
    anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
    anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mDragDownCallback.setEmptyDragAmount((Float) animation.getAnimatedValue());
        }
    });
    anim.start();
}
Also used : ValueAnimator(android.animation.ValueAnimator)

Example 53 with ValueAnimator

use of android.animation.ValueAnimator in project UltimateAndroid by cymcsg.

the class DefaultLayoutAnimator method transitionToFrame.

// @Override
public ValueAnimator transitionToFrame(final Rect of, final FreeFlowItem nf, final View v) {
    ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
    anim.setDuration(cellPositionTransitionAnimationDuration);
    anim.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            try {
                int itemWidth = of.width() + (int) ((nf.frame.width() - of.width()) * animation.getAnimatedFraction());
                int itemHeight = of.height() + (int) ((nf.frame.height() - of.height()) * animation.getAnimatedFraction());
                int widthSpec = MeasureSpec.makeMeasureSpec(itemWidth, MeasureSpec.EXACTLY);
                int heightSpec = MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY);
                v.measure(widthSpec, heightSpec);
                Rect frame = new Rect();
                Rect nff = nf.frame;
                frame.left = (int) (of.left + (nff.left - of.left) * animation.getAnimatedFraction());
                frame.top = (int) (of.top + (nff.top - of.top) * animation.getAnimatedFraction());
                frame.right = frame.left + (int) (of.width() + (nff.width() - of.width()) * animation.getAnimatedFraction());
                frame.bottom = frame.top + (int) (of.height() + (nff.height() - of.height()) * animation.getAnimatedFraction());
                v.layout(frame.left, frame.top, frame.right, frame.bottom);
            // v.layout(nf.frame.left, nf.frame.top, nf.frame.right,
            // nf.frame.bottom);
            // v.setAlpha((1 - alpha) * animation.getAnimatedFraction()
            // + alpha);
            } catch (NullPointerException e) {
                Logs.e(TAG, "Nullpointer exception");
                e.printStackTrace();
                animation.cancel();
            }
        }
    });
    anim.setInterpolator(new DecelerateInterpolator(2.0f));
    return anim;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Rect(android.graphics.Rect) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator)

Example 54 with ValueAnimator

use of android.animation.ValueAnimator in project android_packages_apps_Launcher2 by CyanogenMod.

the class DragLayer method fadeOutDragView.

private void fadeOutDragView() {
    mFadeOutAnim = new ValueAnimator();
    mFadeOutAnim.setDuration(150);
    mFadeOutAnim.setFloatValues(0f, 1f);
    mFadeOutAnim.removeAllUpdateListeners();
    mFadeOutAnim.addUpdateListener(new AnimatorUpdateListener() {

        public void onAnimationUpdate(ValueAnimator animation) {
            final float percent = (Float) animation.getAnimatedValue();
            float alpha = 1 - percent;
            mDropView.setAlpha(alpha);
        }
    });
    mFadeOutAnim.addListener(new AnimatorListenerAdapter() {

        public void onAnimationEnd(Animator animation) {
            if (mDropView != null) {
                mDragController.onDeferredEndDrag(mDropView);
            }
            mDropView = null;
            invalidate();
        }
    });
    mFadeOutAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator)

Example 55 with ValueAnimator

use of android.animation.ValueAnimator in project android_packages_apps_Launcher2 by CyanogenMod.

the class DragView method crossFade.

public void crossFade(int duration) {
    ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1f);
    va.setDuration(duration);
    va.setInterpolator(new DecelerateInterpolator(1.5f));
    va.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mCrossFadeProgress = animation.getAnimatedFraction();
        }
    });
    va.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator)

Aggregations

ValueAnimator (android.animation.ValueAnimator)1224 Animator (android.animation.Animator)625 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)455 ObjectAnimator (android.animation.ObjectAnimator)187 ArrayList (java.util.ArrayList)128 Paint (android.graphics.Paint)124 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)111 LinearInterpolator (android.view.animation.LinearInterpolator)102 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)91 View (android.view.View)90 AnimatorSet (android.animation.AnimatorSet)87 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)74 ArgbEvaluator (android.animation.ArgbEvaluator)57 ViewGroup (android.view.ViewGroup)44 TextView (android.widget.TextView)44 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)40 PropertyValuesHolder (android.animation.PropertyValuesHolder)36 ImageView (android.widget.ImageView)34 Interpolator (android.view.animation.Interpolator)31 SuppressLint (android.annotation.SuppressLint)25