Search in sources :

Example 16 with ArgbEvaluator

use of android.animation.ArgbEvaluator in project ahbottomnavigation by aurelhubert.

the class AHHelper method updateViewBackgroundColor.

/**
	 * Update text color with animation
	 */
public static void updateViewBackgroundColor(final View view, @ColorInt int fromColor, @ColorInt int toColor) {
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
    colorAnimation.setDuration(150);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            view.setBackgroundColor((Integer) animator.getAnimatedValue());
        }
    });
    colorAnimation.start();
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) ValueAnimator(android.animation.ValueAnimator)

Example 17 with ArgbEvaluator

use of android.animation.ArgbEvaluator in project Space-Navigation-View by armcha.

the class Utils method changeImageViewTintWithAnimation.

/**
     * Change given image view tint with animation
     *
     * @param image     target image view
     * @param fromColor start animation from color
     * @param toColor   final color
     */
static void changeImageViewTintWithAnimation(final ImageView image, int fromColor, int toColor) {
    ValueAnimator imageTintChangeAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
    imageTintChangeAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            image.setColorFilter((Integer) animator.getAnimatedValue());
        }
    });
    imageTintChangeAnimation.setDuration(150);
    imageTintChangeAnimation.start();
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) ValueAnimator(android.animation.ValueAnimator)

Example 18 with ArgbEvaluator

use of android.animation.ArgbEvaluator in project android-topeka by googlesamples.

the class QuizActivity method prepareCircularReveal.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void prepareCircularReveal(View startView, FrameLayout targetView) {
    int centerX = (startView.getLeft() + startView.getRight()) / 2;
    // Subtract the start view's height to adjust for relative coordinates on screen.
    int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight();
    float endRadius = (float) Math.hypot(centerX, centerY);
    mCircularReveal = ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, startView.getWidth(), endRadius);
    mCircularReveal.setInterpolator(new FastOutLinearInInterpolator());
    mCircularReveal.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mIcon.setVisibility(View.GONE);
            mCircularReveal.removeListener(this);
        }
    });
    // Adding a color animation from the FAB's color to transparent creates a dissolve like
    // effect to the circular reveal.
    int accentColor = ContextCompat.getColor(this, mCategory.getTheme().getAccentColor());
    mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, accentColor, Color.TRANSPARENT);
    mColorChange.setEvaluator(new ArgbEvaluator());
    mColorChange.setInterpolator(mInterpolator);
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ViewPropertyAnimatorListenerAdapter(android.support.v4.view.ViewPropertyAnimatorListenerAdapter) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) SuppressLint(android.annotation.SuppressLint) TargetApi(android.annotation.TargetApi)

Example 19 with ArgbEvaluator

use of android.animation.ArgbEvaluator in project ExpectAnim by florent37.

the class TextColorAnimExpectation method getAnimator.

@Override
public Animator getAnimator(View viewToMove) {
    if (viewToMove instanceof TextView) {
        final ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewToMove, "textColor", ((TextView) viewToMove).getCurrentTextColor(), textColor);
        objectAnimator.setEvaluator(new ArgbEvaluator());
        return objectAnimator;
    } else {
        return null;
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) TextView(android.widget.TextView)

Example 20 with ArgbEvaluator

use of android.animation.ArgbEvaluator in project ViewAnimator by florent37.

the class AnimationBuilder method textColor.

/**
     * Text color animation builder.
     *
     * @param colors the colors
     * @return the animation builder
     */
public AnimationBuilder textColor(int... colors) {
    for (View view : views) {
        if (view instanceof TextView) {
            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "textColor", colors);
            objectAnimator.setEvaluator(new ArgbEvaluator());
            this.animatorList.add(objectAnimator);
        }
    }
    return this;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

ArgbEvaluator (android.animation.ArgbEvaluator)58 ValueAnimator (android.animation.ValueAnimator)28 ObjectAnimator (android.animation.ObjectAnimator)18 Animator (android.animation.Animator)10 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)7 TargetApi (android.annotation.TargetApi)6 View (android.view.View)6 Paint (android.graphics.Paint)5 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 TextView (android.widget.TextView)4 SuppressLint (android.annotation.SuppressLint)3 ViewGroup (android.view.ViewGroup)3 AnimatorListener (android.animation.Animator.AnimatorListener)2 AnimatorSet (android.animation.AnimatorSet)2 PropertyValuesHolder (android.animation.PropertyValuesHolder)2 Intent (android.content.Intent)2 Drawable (android.graphics.drawable.Drawable)2 Toolbar (android.support.v7.widget.Toolbar)2