use of android.animation.ArgbEvaluator in project welcome-coordinator by txusballesteros.
the class MainActivity method initializeBackgroundTransitions.
private void initializeBackgroundTransitions() {
final Resources resources = getResources();
final int colorPage1 = ResourcesCompat.getColor(resources, R.color.page1, getTheme());
final int colorPage2 = ResourcesCompat.getColor(resources, R.color.page2, getTheme());
final int colorPage3 = ResourcesCompat.getColor(resources, R.color.page3, getTheme());
final int colorPage4 = ResourcesCompat.getColor(resources, R.color.page4, getTheme());
backgroundAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorPage1, colorPage2, colorPage3, colorPage4);
backgroundAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
coordinatorLayout.setBackgroundColor((int) animation.getAnimatedValue());
}
});
}
use of android.animation.ArgbEvaluator in project MusicLake by caiyonglong.
the class TransitionAnimationUtils method startColorAnimation.
/**
* 颜色渐变动画
*/
public static void startColorAnimation(View mView, int newColor) {
int olderColor = ((ColorDrawable) mView.getBackground()).getColor();
ObjectAnimator objectAnimator;
objectAnimator = ObjectAnimator.ofInt(mView, "backgroundColor", olderColor, newColor).setDuration(800);
objectAnimator.setEvaluator(new ArgbEvaluator());
objectAnimator.start();
}
use of android.animation.ArgbEvaluator in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HighlightablePreferenceGroupAdapter method removeHighlightBackground.
private void removeHighlightBackground(View v, boolean animate) {
if (!animate) {
v.setTag(R.id.preference_highlighted, false);
v.setBackgroundResource(mNormalBackgroundRes);
Log.d(TAG, "RemoveHighlight: No animation requested - setting normal background");
return;
}
if (!Boolean.TRUE.equals(v.getTag(R.id.preference_highlighted))) {
// Not highlighted, no-op
Log.d(TAG, "RemoveHighlight: Not highlighted - skipping");
return;
}
int colorFrom = mHighlightColor;
int colorTo = Color.WHITE;
v.setTag(R.id.preference_highlighted, false);
final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(HIGHLIGHT_FADE_OUT_DURATION);
colorAnimation.addUpdateListener(animator -> v.setBackgroundColor((int) animator.getAnimatedValue()));
colorAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// Animation complete - the background is now white. Change to mNormalBackgroundRes
// so it is white and has ripple on touch.
v.setBackgroundResource(mNormalBackgroundRes);
}
});
colorAnimation.start();
Log.d(TAG, "Starting fade out animation");
}
use of android.animation.ArgbEvaluator in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HighlightablePreferenceGroupAdapter method addHighlightBackground.
private void addHighlightBackground(View v, boolean animate) {
v.setTag(R.id.preference_highlighted, true);
if (!animate) {
v.setBackgroundColor(mHighlightColor);
Log.d(TAG, "AddHighlight: Not animation requested - setting highlight background");
requestRemoveHighlightDelayed(v);
return;
}
mFadeInAnimated = true;
final int colorFrom = Color.WHITE;
final int colorTo = mHighlightColor;
final ValueAnimator fadeInLoop = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
fadeInLoop.setDuration(HIGHLIGHT_FADE_IN_DURATION);
fadeInLoop.addUpdateListener(animator -> v.setBackgroundColor((int) animator.getAnimatedValue()));
fadeInLoop.setRepeatMode(ValueAnimator.REVERSE);
fadeInLoop.setRepeatCount(4);
fadeInLoop.start();
Log.d(TAG, "AddHighlight: starting fade in animation");
requestRemoveHighlightDelayed(v);
}
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) {
if (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();
}
}
Aggregations