use of android.animation.ArgbEvaluator in project ahbottomnavigation by aurelhubert.
the class AHHelper method updateDrawableColor.
/**
* Update image view color with animation
*/
public static void updateDrawableColor(final Context context, final Drawable drawable, final ImageView imageView, @ColorInt int fromColor, @ColorInt int toColor, final boolean forceTint) {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
colorAnimation.setDuration(150);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
imageView.setImageDrawable(AHHelper.getTintDrawable(drawable, (Integer) animator.getAnimatedValue(), forceTint));
imageView.requestLayout();
}
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project ahbottomnavigation by aurelhubert.
the class AHHelper method updateTextColor.
/**
* Update text color with animation
*/
public static void updateTextColor(final TextView textView, @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) {
textView.setTextColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project MaterialViewPager by florent37.
the class MaterialViewPagerAnimator method setColor.
/**
* Change the color of the statusbackground, toolbar, toolbarlayout and pagertitlestrip
* With a color transition animation
*
* @param color the final color
* @param duration the transition color animation duration
*/
void setColor(int color, int duration) {
final ValueAnimator colorAnim = ObjectAnimator.ofInt(mHeader.headerBackground, "backgroundColor", settings.color, color);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.setDuration(duration);
colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final int animatedValue = (Integer) animation.getAnimatedValue();
int colorAlpha = colorWithAlpha(animatedValue, lastPercent);
mHeader.headerBackground.setBackgroundColor(colorAlpha);
mHeader.statusBackground.setBackgroundColor(colorAlpha);
mHeader.toolbar.setBackgroundColor(colorAlpha);
mHeader.toolbarLayoutBackground.setBackgroundColor(colorAlpha);
mHeader.mPagerSlidingTabStrip.setBackgroundColor(colorAlpha);
//set the new color as MaterialViewPager's color
settings.color = animatedValue;
}
});
colorAnim.start();
}
use of android.animation.ArgbEvaluator in project Depth-LIB-Android- by danielzeller.
the class ParticleSystem method setColors.
public void setColors(int startColor, int endColor) {
this.startColor = startColor;
this.endColor = endColor;
color = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor, Color.TRANSPARENT).setDuration(DURATION);
}
use of android.animation.ArgbEvaluator in project ENViews by codeestX.
the class ENScrollView method unSelect.
public void unSelect() {
if (mCurrentState == STATE_UNSELECT) {
return;
}
mCurrentState = STATE_UNSELECT;
ValueAnimator valueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mLineColor, mBgLineColor);
valueAnimator.setDuration(mDuration);
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = 1 - valueAnimator.getAnimatedFraction();
mCurrentColor = (int) valueAnimator.getAnimatedValue();
invalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
valueAnimator.start();
}
Aggregations