use of android.animation.ArgbEvaluator in project animate by hitherejoe.
the class ForegroundFrame method animateForegroundColor.
private void animateForegroundColor(@ColorInt final int targetColor) {
ObjectAnimator animator = ObjectAnimator.ofInt(this, FOREGROUND_COLOR, Color.TRANSPARENT, targetColor);
animator.setEvaluator(new ArgbEvaluator());
animator.setStartDelay(DELAY_COLOR_CHANGE);
animator.start();
}
use of android.animation.ArgbEvaluator in project android-topeka by googlesamples.
the class AbsQuizView method animateForegroundColor.
private void animateForegroundColor(@ColorInt final int targetColor) {
ObjectAnimator animator = ObjectAnimator.ofInt(this, ViewUtils.FOREGROUND_COLOR, Color.TRANSPARENT, targetColor);
animator.setEvaluator(new ArgbEvaluator());
animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY);
animator.start();
}
use of android.animation.ArgbEvaluator in project PageIndicatorView by romandanylyk.
the class ColorAnimation method createColorPropertyHolder.
protected PropertyValuesHolder createColorPropertyHolder(boolean isReverse) {
String propertyName;
int startColorValue;
int endColorValue;
if (isReverse) {
propertyName = ANIMATION_COLOR_REVERSE;
startColorValue = endColor;
endColorValue = startColor;
} else {
propertyName = ANIMATION_COLOR;
startColorValue = startColor;
endColorValue = endColor;
}
PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startColorValue, endColorValue);
holder.setEvaluator(new ArgbEvaluator());
return holder;
}
use of android.animation.ArgbEvaluator in project Transitions-Everywhere by andkulikov.
the class Recolor method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
final View view = endValues.view;
Drawable startBackground = (Drawable) startValues.values.get(PROPNAME_BACKGROUND);
Drawable endBackground = (Drawable) endValues.values.get(PROPNAME_BACKGROUND);
ObjectAnimator bgAnimator = null;
if (startBackground instanceof ColorDrawable && endBackground instanceof ColorDrawable) {
ColorDrawable startColor = (ColorDrawable) startBackground;
ColorDrawable endColor = (ColorDrawable) endBackground;
if (startColor.getColor() != endColor.getColor()) {
final int finalColor = endColor.getColor();
endColor.setColor(startColor.getColor());
bgAnimator = ObjectAnimator.ofInt(endColor, COLORDRAWABLE_COLOR, startColor.getColor(), finalColor);
bgAnimator.setEvaluator(new ArgbEvaluator());
}
}
ObjectAnimator textColorAnimator = null;
if (view instanceof TextView) {
TextView textView = (TextView) view;
int start = (Integer) startValues.values.get(PROPNAME_TEXT_COLOR);
int end = (Integer) endValues.values.get(PROPNAME_TEXT_COLOR);
if (start != end) {
textView.setTextColor(end);
textColorAnimator = ObjectAnimator.ofInt(textView, TEXTVIEW_TEXT_COLOR, start, end);
textColorAnimator.setEvaluator(new ArgbEvaluator());
}
}
return TransitionUtils.mergeAnimators(bgAnimator, textColorAnimator);
}
use of android.animation.ArgbEvaluator in project native-navigation by airbnb.
the class DefaultNavigationImplementation method reconcileStatusBarStyleOnLollipop.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void reconcileStatusBarStyleOnLollipop(final Activity activity, ReadableMap prev, ReadableMap next, boolean firstCall) {
if (firstCall || numberHasChanged("statusBarColor", prev, next)) {
boolean animated = false;
if (next.hasKey("statusBarAnimation")) {
animated = !("none".equals(next.getString("statusBarAnimation")));
}
Integer color = defaults.statusBarColor;
if (next.hasKey("statusBarColor")) {
color = next.getInt("statusBarColor");
}
if (animated) {
int curColor = activity.getWindow().getStatusBarColor();
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), curColor, color);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
activity.getWindow().setStatusBarColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.setDuration(300).setStartDelay(0);
colorAnimation.start();
} else {
activity.getWindow().setStatusBarColor(color);
}
}
if (firstCall || boolHasChanged("statusBarTranslucent", prev, next)) {
boolean translucent = defaults.statusBarTranslucent;
if (next.hasKey("statusBarTranslucent")) {
translucent = next.getBoolean("statusBarTranslucent");
}
View decorView = activity.getWindow().getDecorView();
// and consume all the top insets so no padding will be added under the status bar.
if (translucent) {
decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
WindowInsets defaultInsets = v.onApplyWindowInsets(insets);
return defaultInsets.replaceSystemWindowInsets(defaultInsets.getSystemWindowInsetLeft(), 0, defaultInsets.getSystemWindowInsetRight(), defaultInsets.getSystemWindowInsetBottom());
}
});
} else {
decorView.setOnApplyWindowInsetsListener(null);
}
ViewCompat.requestApplyInsets(decorView);
}
}
Aggregations