Search in sources :

Example 1 with ArgbEvaluator

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);
    }
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator) ValueAnimator(android.animation.ValueAnimator)

Example 2 with ArgbEvaluator

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);
    }
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator)

Example 3 with ArgbEvaluator

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();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator)

Example 4 with ArgbEvaluator

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();
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator)

Example 5 with ArgbEvaluator

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;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ArgbEvaluator(android.animation.ArgbEvaluator) ValueAnimator(android.animation.ValueAnimator)

Aggregations

ArgbEvaluator (android.animation.ArgbEvaluator)97 ValueAnimator (android.animation.ValueAnimator)58 ObjectAnimator (android.animation.ObjectAnimator)29 Animator (android.animation.Animator)20 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)12 View (android.view.View)12 ColorDrawable (android.graphics.drawable.ColorDrawable)8 TextView (android.widget.TextView)8 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)7 AnimatorSet (android.animation.AnimatorSet)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)6 Paint (android.graphics.Paint)6 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)5 AnimatorListener (android.animation.Animator.AnimatorListener)4 TargetApi (android.annotation.TargetApi)4 ViewGroup (android.view.ViewGroup)4 SuppressLint (android.annotation.SuppressLint)3 Handler (android.os.Handler)3 Intent (android.content.Intent)2 ColorStateList (android.content.res.ColorStateList)2