Search in sources :

Example 6 with ValueAnimator

use of android.animation.ValueAnimator in project ENViews by codeestX.

the class ENPlayView method pause.

public void pause() {
    if (mCurrentState == STATE_PAUSE) {
        return;
    }
    mCurrentState = STATE_PAUSE;
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnimator.setDuration(mDuration);
    valueAnimator.setInterpolator(new AnticipateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
}
Also used : ValueAnimator(android.animation.ValueAnimator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 7 with ValueAnimator

use of android.animation.ValueAnimator in project ENViews by codeestX.

the class ENScrollView method select.

public void select() {
    if (mCurrentState == STATE_SELECT) {
        return;
    }
    mCurrentState = STATE_SELECT;
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mBgLineColor, mLineColor);
    valueAnimator.setDuration(mDuration);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            mCurrentColor = (int) valueAnimator.getAnimatedValue();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
    valueAnimator.start();
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 8 with ValueAnimator

use of android.animation.ValueAnimator in project ENViews by codeestX.

the class ENSearchView method start.

public void start() {
    if (mCurrentState == STATE_SEARCHING) {
        return;
    }
    mCurrentState = STATE_SEARCHING;
    ValueAnimator valueAnim = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnim.setDuration(mDuration);
    valueAnim.setInterpolator(new LinearInterpolator());
    valueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    valueAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentState = STATE_WAIT;
        }
    });
    valueAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 9 with ValueAnimator

use of android.animation.ValueAnimator in project ENViews by codeestX.

the class ENVolumeView method closeVolume.

private void closeVolume() {
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnimator.setDuration(800);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = 1 - valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 10 with ValueAnimator

use of android.animation.ValueAnimator in project ENViews by codeestX.

the class ENVolumeView method onSizeChanged.

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mWidth = w * 5 / 6;
    mHeight = h;
    mBaseLength = mWidth / 6;
    mCenterX = w / 2;
    mCenterY = h / 2;
    mPath.moveTo(mCenterX - 3 * mBaseLength, mCenterY);
    mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY - 0.5f * mBaseLength);
    mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY - 0.5f * mBaseLength);
    mPath.lineTo(mCenterX, mCenterY - 2 * mBaseLength);
    mPath.lineTo(mCenterX, mCenterY + 2 * mBaseLength);
    mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY + 0.5f * mBaseLength);
    mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY + 0.5f * mBaseLength);
    mPath.close();
    mPathMeasure.setPath(mPath, false);
    mPathLength = mPathMeasure.getLength();
    vibrateAnim = ValueAnimator.ofFloat(1.f, 100.f);
    vibrateAnim.setDuration(100);
    vibrateAnim.setInterpolator(new LinearInterpolator());
    vibrateAnim.setRepeatCount(ValueAnimator.INFINITE);
    vibrateAnim.setRepeatMode(ValueAnimator.REVERSE);
    vibrateAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) ValueAnimator(android.animation.ValueAnimator)

Aggregations

ValueAnimator (android.animation.ValueAnimator)710 Animator (android.animation.Animator)374 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)306 ObjectAnimator (android.animation.ObjectAnimator)141 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)88 ArrayList (java.util.ArrayList)75 Paint (android.graphics.Paint)66 AnimatorSet (android.animation.AnimatorSet)57 LinearInterpolator (android.view.animation.LinearInterpolator)50 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)49 View (android.view.View)47 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)40 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)32 PropertyValuesHolder (android.animation.PropertyValuesHolder)31 ViewGroup (android.view.ViewGroup)30 ArgbEvaluator (android.animation.ArgbEvaluator)28 Interpolator (android.view.animation.Interpolator)26 TextView (android.widget.TextView)25 RenderNodeAnimator (android.view.RenderNodeAnimator)20 Rect (android.graphics.Rect)19