use of android.animation.ArgbEvaluator in project qksms by moezbhatti.
the class ThemeManager method setNavigationBarTintEnabled.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setNavigationBarTintEnabled(QKActivity activity, boolean enabled) {
int colorFrom = enabled ? mResources.getColor(R.color.black) : mColor;
int colorTo = enabled ? mColor : mResources.getColor(R.color.black);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(TRANSITION_LENGTH);
colorAnimation.addUpdateListener(animation -> {
activity.getWindow().setNavigationBarColor(ColorUtils.darken((Integer) animation.getAnimatedValue()));
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project qksms by moezbhatti.
the class ThemeManager method setStatusBarTintEnabled.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setStatusBarTintEnabled(QKActivity activity, boolean enabled) {
int colorFrom = enabled ? mResources.getColor(R.color.black) : mColor;
int colorTo = enabled ? mColor : mResources.getColor(R.color.black);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(TRANSITION_LENGTH);
colorAnimation.addUpdateListener(animation -> {
activity.getWindow().setStatusBarColor(ColorUtils.darken((Integer) animation.getAnimatedValue()));
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project qksms by moezbhatti.
the class WelcomeNightFragment method onClick.
@Override
public void onClick(View v) {
if (v.getId() == R.id.welcome_night_hint) {
boolean night = ThemeManager.getTheme() == ThemeManager.Theme.LIGHT;
int backgroundColor = mContext.getResources().getColor(night ? R.color.grey_light_mega_ultra : R.color.grey_material);
int newBackgroundColor = mContext.getResources().getColor(night ? R.color.grey_material : R.color.grey_light_mega_ultra);
ThemeManager.setTheme(night ? ThemeManager.Theme.DARK : ThemeManager.Theme.LIGHT);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), backgroundColor, newBackgroundColor);
colorAnimation.setDuration(ThemeManager.TRANSITION_LENGTH);
colorAnimation.setInterpolator(new DecelerateInterpolator());
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int color = (Integer) animation.getAnimatedValue();
mContext.setColorBackground(color);
mNightHint.setTextColor(color);
}
});
colorAnimation.start();
PreferenceManager.getDefaultSharedPreferences(mContext).edit().putString(SettingsFragment.BACKGROUND, night ? ThemeManager.Theme.PREF_GREY : ThemeManager.Theme.PREF_OFFWHITE).commit();
}
}
use of android.animation.ArgbEvaluator in project android-app by spark.
the class Pin method getCancelAnimator.
Animator getCancelAnimator() {
ObjectAnimator backToTransparent1 = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_end);
ObjectAnimator goDark = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_go_dark);
ObjectAnimator backToTransparent2 = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_end);
ViewGroup parent = (ViewGroup) view.getParent();
ArgbEvaluator evaluator = new ArgbEvaluator();
for (ObjectAnimator animator : list(backToTransparent1, goDark, backToTransparent2)) {
animator.setTarget(parent);
animator.setEvaluator(evaluator);
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setTarget(parent);
animatorSet.playSequentially(backToTransparent1, goDark, backToTransparent2);
return animatorSet;
}
use of android.animation.ArgbEvaluator in project MaterialProgressBar by DreaminginCodeZH.
the class ObjectAnimatorCompatBase method ofArgb.
public static ObjectAnimator ofArgb(Object target, String propertyName, int... values) {
ObjectAnimator animator = ObjectAnimator.ofInt(target, propertyName, values);
animator.setEvaluator(new ArgbEvaluator());
return animator;
}
Aggregations