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();
}
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();
}
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);
}
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;
}
}
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;
}
Aggregations