Example usage for android.animation IntEvaluator IntEvaluator

List of usage examples for android.animation IntEvaluator IntEvaluator

Introduction

In this page you can find the example usage for android.animation IntEvaluator IntEvaluator.

Prototype

IntEvaluator

Source Link

Usage

From source file:com.arsy.maps_library.MapRipple.java

private void startAnimation(final int numberOfRipple) {
    ValueAnimator animator = ValueAnimator.ofInt(0, (int) mDistance);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.setDuration(mRippleDuration);
    animator.setEvaluator(new IntEvaluator());
    animator.setInterpolator(new LinearInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override/*from w w w.j av a 2 s  . co m*/
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            int animated = (int) valueAnimator.getAnimatedValue();
            mGroundOverlays[numberOfRipple].setDimensions(animated);
            if (mDistance - animated <= 10) {
                if (mLatLng != mPrevLatLng) {
                    mGroundOverlays[numberOfRipple].setPosition(mLatLng);
                }
            }
        }
    });
    animator.start();
    mAnimators[numberOfRipple] = animator;
}

From source file:com.taobao.weex.ui.animation.DimensionUpdateListener.java

DimensionUpdateListener(@NonNull View view) {
    this.view = view;
    intEvaluator = new IntEvaluator();
}

From source file:zemin.notification.NotificationView.java

private void updateContentBackground() {
    Drawable background = mBackground;/*from  w w w  .j av  a2  s. com*/
    if (hasState(CONTENT_BACKGROUND_CHANGED)) {
        if (mContentBackground != null) {
            if (mShadowEnabled) {
                final Drawable[] layers = new Drawable[] {
                        getResources().getDrawable(android.R.drawable.dialog_holo_light_frame),
                        mContentBackground, };
                background = new LayerDrawable(layers);

                int l, t, r, b;
                l = t = r = b = 0;

                for (int i = 0, size = layers.length; i < size; i++) {
                    Rect rect = new Rect();
                    layers[i].getPadding(rect);

                    l += rect.left;
                    t += rect.top;
                    r += rect.right;
                    b += rect.bottom;
                }
                setContentPadding(l, t, r, b);

            } else {

                background = mContentBackground;

                Rect rect = new Rect();
                background.getPadding(rect);
                setContentPadding(rect.left, rect.top, rect.right, rect.bottom);
            }

            if (mContentBackground instanceof GradientDrawable) {
                GradientDrawable b = (GradientDrawable) mContentBackground;
                b.setCornerRadius(mCornerRadius);
                b.setStroke(mStrokeWidth, mStrokeColor);

                if (mBackgroundColorAnimator != null) {
                    mBackgroundColorAnimator.cancel();
                    mBackgroundColorAnimator = null;
                }

                ColorProperty colorProperty = new ColorProperty();
                mBackgroundColorAnimator = ObjectAnimator.ofObject(b, colorProperty, new ArgbEvaluator(), 0, 0);
                mBackgroundColorAnimator.setDuration(mBackgroundTransitionTime);

                if (mBackgroundAlphaAnimator != null) {
                    mBackgroundAlphaAnimator.cancel();
                    mBackgroundAlphaAnimator = null;
                }

                AlphaProperty alphaProperty = new AlphaProperty();
                mBackgroundAlphaAnimator = ObjectAnimator.ofObject(b, alphaProperty, new IntEvaluator(), 0, 0);
                mBackgroundAlphaAnimator.setDuration(mBackgroundTransitionTime);
            }
        }

        clearState(CONTENT_BACKGROUND_CHANGED);
        clearState(CONTENT_BACKGROUND_CHANGED_MINOR);

    } else if (hasState(CONTENT_BACKGROUND_CHANGED_MINOR)) {
        if (mContentBackground instanceof GradientDrawable) {
            GradientDrawable b = (GradientDrawable) mContentBackground;
            b.setStroke(mStrokeWidth, mStrokeColor);
            mBackgroundColorAnimator.setDuration(mBackgroundTransitionTime);
            mBackgroundAlphaAnimator.setDuration(mBackgroundTransitionTime);
        }

        clearState(CONTENT_BACKGROUND_CHANGED_MINOR);
    }

    mBackground = background;
    mContentView.setBackground(background);
}