use of android.animation.ArgbEvaluator in project LeafPic by HoraApps.
the class PlayerActivity method changeBackGroundColor.
private void changeBackGroundColor() {
int colorTo;
int colorFrom;
if (fullScreenMode) {
colorFrom = getBackgroundColor();
colorTo = (ContextCompat.getColor(PlayerActivity.this, R.color.md_black_1000));
} else {
colorFrom = (ContextCompat.getColor(PlayerActivity.this, R.color.md_black_1000));
colorTo = getBackgroundColor();
}
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(240);
colorAnimation.addUpdateListener(animator -> rootView.setBackgroundColor((Integer) animator.getAnimatedValue()));
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project LeafPic by HoraApps.
the class SingleMediaActivity method changeBackGroundColor.
private void changeBackGroundColor() {
int colorTo;
int colorFrom;
if (fullScreenMode) {
colorFrom = getBackgroundColor();
colorTo = (ContextCompat.getColor(SingleMediaActivity.this, R.color.md_black_1000));
} else {
colorFrom = (ContextCompat.getColor(SingleMediaActivity.this, R.color.md_black_1000));
colorTo = getBackgroundColor();
}
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(240);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
activityBackground.setBackgroundColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project qksms by moezbhatti.
the class ThemeManager method setColor.
public static void setColor(QKActivity activity, int color) {
AnalyticsManager.getInstance().sendEvent(AnalyticsManager.CATEGORY_PREFERENCE_CHANGE, SettingsFragment.CATEGORY_THEME, getColorString(color));
int colorFrom = mActiveColor;
mColor = color;
mActiveColor = color;
mPrefs.edit().putString(SettingsFragment.THEME, "" + color).apply();
setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_SENT, true));
setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_RECEIVED, false));
mTextOnColorPrimary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_primary : R.color.theme_light_text_primary);
mTextOnColorSecondary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_secondary : R.color.theme_light_text_secondary);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new CIELChEvaluator(colorFrom, color), 0);
colorAnimation.setDuration(TRANSITION_LENGTH);
colorAnimation.setInterpolator(new DecelerateInterpolator());
colorAnimation.addUpdateListener(animation -> {
setActiveColor((Integer) animation.getAnimatedValue());
});
colorAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
WidgetProvider.notifyThemeChanged(mContext);
}
});
colorAnimation.start();
if (activity.findViewById(R.id.toolbar_title) != null) {
// final Toolbar toolbar = (Toolbar) mActivity.findViewById(R.id.title);
final QKTextView title = (QKTextView) activity.findViewById(R.id.toolbar_title);
if (title.getCurrentTextColor() != mTextOnColorPrimary) {
ValueAnimator titleColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), title.getCurrentTextColor(), mTextOnColorPrimary);
titleColorAnimation.setDuration(TRANSITION_LENGTH);
titleColorAnimation.setInterpolator(new DecelerateInterpolator());
titleColorAnimation.addUpdateListener(animation -> {
int color1 = (Integer) animation.getAnimatedValue();
title.setTextColor(color1);
activity.colorMenuIcons(activity.getMenu(), color1);
});
titleColorAnimation.start();
}
}
}
use of android.animation.ArgbEvaluator in project Shuttle by timusus.
the class PlayerFragment method animateColors.
void animateColors(int from, int to, UnsafeConsumer<Integer> consumer) {
ValueAnimator valueAnimator = ValueAnimator.ofInt(from, to);
valueAnimator.setEvaluator(new ArgbEvaluator());
valueAnimator.setDuration(450);
valueAnimator.addUpdateListener(animator -> consumer.accept((Integer) animator.getAnimatedValue()));
valueAnimator.start();
}
use of android.animation.ArgbEvaluator in project ViewAnimator by florent37.
the class AnimationBuilder method backgroundColor.
/**
* Background color animation builder.
*
* @param colors the colors
* @return the animation builder
*/
public AnimationBuilder backgroundColor(int... colors) {
for (View view : views) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "backgroundColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
return this;
}
Aggregations