use of android.animation.ArgbEvaluator in project qksms by moezbhatti.
the class ThemeManager method setTheme.
public static void setTheme(Theme theme) {
final int startColor = mBackgroundColor;
initializeTheme(theme);
final int endColor = mBackgroundColor;
if (startColor != endColor) {
ValueAnimator backgroundAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor);
backgroundAnimation.setDuration(TRANSITION_LENGTH);
backgroundAnimation.addUpdateListener(animation -> {
mBackgroundColor = (Integer) animation.getAnimatedValue();
LiveViewManager.refreshViews(QKPreference.BACKGROUND);
});
backgroundAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mBackgroundColor = endColor;
LiveViewManager.refreshViews(QKPreference.BACKGROUND);
WidgetProvider.notifyThemeChanged(mContext);
}
});
backgroundAnimation.start();
} else {
LiveViewManager.refreshViews(QKPreference.BACKGROUND);
WidgetProvider.notifyThemeChanged(mContext);
}
}
use of android.animation.ArgbEvaluator in project BoomMenu by Nightonke.
the class BoomMenuButton method lightBackground.
private void lightBackground(boolean immediately) {
createBackground();
AnimationManager.animate(background, "backgroundColor", 0, immediately ? 1 : hideDuration + hideDelay * (pieces.size() - 1), new ArgbEvaluator(), new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
boomStateEnum = BoomStateEnum.DidHide;
if (onBoomListener != null)
onBoomListener.onBoomDidHide();
clearViewsAndValues();
}
}, dimColor, Color.TRANSPARENT);
if (piecePlaceEnum == PiecePlaceEnum.Share) {
AnimationManager.animate(shareLinesView, "hideProcess", 0, immediately ? 1 : hideDuration + hideDelay * (pieces.size() - 1), Ease.getInstance(EaseEnum.Linear), 0f, 1f);
}
}
use of android.animation.ArgbEvaluator in project Depth-LIB-Android- by danielzeller.
the class RootActivity method fadeColoTo.
private void fadeColoTo(int newColor, TextView view) {
ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor);
color.setDuration(200);
color.start();
}
use of android.animation.ArgbEvaluator in project TransitionHelper by ImmortalZ.
the class ColorShowMethod method translate.
@Override
public void translate(InfoBean bean, RenderView parent, View child) {
if (startColor != 0) {
startColor = parent.getResources().getColor(startColor);
} else {
startColor = parent.getResources().getColor(R.color.showmethod_start_color);
}
if (endColor != 0) {
endColor = parent.getResources().getColor(endColor);
} else {
endColor = parent.getResources().getColor(R.color.showmethod_end_color);
}
parent.setPaintColor(endColor);
ObjectAnimator colorAnimator = ObjectAnimator.ofInt(parent, "backgroundColor", startColor, endColor);
colorAnimator.setEvaluator(new ArgbEvaluator());
set.playTogether(ObjectAnimator.ofFloat(child, "translationX", 0, -bean.translationX), ObjectAnimator.ofFloat(child, "translationY", 0, -bean.translationY), ObjectAnimator.ofFloat(child, "scaleX", 1 / bean.scalling), ObjectAnimator.ofFloat(child, "scaleY", 1 / bean.scalling), colorAnimator);
set.setInterpolator(new AccelerateInterpolator());
set.setDuration(duration).start();
}
use of android.animation.ArgbEvaluator in project Rutgers-Course-Tracker by tevjef.
the class SectionInfoFragment method showSectionTracked.
@Override
public void showSectionTracked(boolean sectionIsAdded, boolean shouldAnimateView) {
final int COLOR = ContextCompat.getColor(getParentActivity(), R.color.accent);
final int COLOR_DARK = ContextCompat.getColor(getParentActivity(), R.color.accent_dark);
final int ROTATION_NORMAL = 0;
final int ROTATION_ADDED = 225;
final int DURATION = 500;
if (shouldAnimateView) {
if (sectionIsAdded != mViewState.isSectionAdded) {
ViewCompat.animate(mFab).setDuration(DURATION).setInterpolator(new DecelerateInterpolator()).rotation(sectionIsAdded ? ROTATION_ADDED : ROTATION_NORMAL);
//I would much prefer to animate from the current coolor to the next but the fab has
// no method to get the current color and I'm not desparate enough to manage it myself.
// As for now, the fab will only animate on user click. Not from a db update.
ValueAnimator colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", sectionIsAdded ? COLOR : COLOR_DARK, sectionIsAdded ? COLOR_DARK : COLOR);
colorAnim.setDuration(500);
colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (mFab != null)
mFab.setBackgroundTintList(ColorStateList.valueOf((Integer) animation.getAnimatedValue()));
}
});
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
}
} else {
//Using ViewCompat to set the tint list is bugged on pre lollipop.
mFab.setBackgroundTintList(ColorStateList.valueOf(sectionIsAdded ? COLOR_DARK : COLOR));
ViewCompat.setRotation(mFab, sectionIsAdded ? ROTATION_ADDED : ROTATION_NORMAL);
}
mViewState.isSectionAdded = sectionIsAdded;
}
Aggregations