Example usage for android.animation ObjectAnimator ofInt

List of usage examples for android.animation ObjectAnimator ofInt

Introduction

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

Prototype

public static <T> ObjectAnimator ofInt(T target, Property<T, Integer> xProperty, Property<T, Integer> yProperty,
        Path path) 

Source Link

Document

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

Usage

From source file:cn.njmeter.njmeter.widget.spinner.NiceSpinner.java

private void animateArrow(boolean shouldRotateUp) {
    int start = shouldRotateUp ? 0 : MAX_LEVEL;
    int end = shouldRotateUp ? MAX_LEVEL : 0;
    ObjectAnimator animator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.start();/*from w  ww .ja v  a  2s  .  c om*/
}

From source file:com.mina.breathitout.AnalyzeActivity.java

private void moveRight() {
    AnalyzeActivity.this.runOnUiThread(new Runnable() {
        @Override// www .  java 2s .c o  m
        public void run() {
            mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_in));
            mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_out));
            // controlling animation
            mViewFlipper.getInAnimation().setAnimationListener(mAnimationListener);
            if (android.os.Build.VERSION.SDK_INT >= 11) {
                // will update the "progress" propriety of seekbar until it reaches progress
                ObjectAnimator progressAnimation = ObjectAnimator.ofInt(progressBar, "progress", lastMaxTime,
                        0);
                progressAnimation.setDuration(1000); // 0.5 second
                progressAnimation.setInterpolator(new DecelerateInterpolator());
                progressAnimation.start();
            } else
                progressBar.setProgress(0); // no animation on Gingerbread or lower
            mViewFlipper.showNext();
        }
    });
}

From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java

private void transition() {
    int transitionColor = ContextCompat.getColor(this, R.color.color_transition_details_swipe);
    ValueAnimator colorAnim = ObjectAnimator.ofInt(detailsView, "backgroundColor", transitionColor,
            Color.TRANSPARENT);//from   www  .  java 2  s .c  om
    colorAnim.setDuration(250);
    colorAnim.setEvaluator(new ArgbEvaluator());
    colorAnim.setRepeatCount(0);
    colorAnim.setRepeatMode(ValueAnimator.REVERSE);
    colorAnim.start();
}

From source file:io.github.carlorodriguez.morningritual.MainActivity.java

private ObjectAnimator setAnimation(final ProgressBar progressBar, final TextView title, final TextView quote,
        final MorningRitual morningRitual, final FloatingActionButton fab) {
    final ObjectAnimator animator = ObjectAnimator.ofInt(progressBar, "progress", 0, 200000);

    animator.setDuration(getStepDurationInMillis(morningRitual));

    animator.setInterpolator(new LinearInterpolator());

    animator.addListener(new Animator.AnimatorListener() {
        @Override/*from w w w.  ja va  2  s.  c om*/
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            notifyStepFinish();

            morningRitual.nextStep();

            setNextMorningRitualStep(progressBar, title, quote, morningRitual, fab);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });

    return animator;
}

From source file:com.jaredrummler.materialspinner.MaterialSpinner.java

private void animateArrow(boolean shouldRotateUp) {
    int start = shouldRotateUp ? 0 : 10000;
    int end = shouldRotateUp ? 10000 : 0;
    ObjectAnimator animator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.start();//from  w w w . j  ava 2  s  .  co  m
}

From source file:com.hippo.android.animator.AnimatorsBase.java

static Animator recolorBackground(View view, int startColor, int endColor) {
    if (startColor != endColor) {
        Drawable drawable = view.getBackground();
        if (drawable instanceof ColorDrawable) {
            ObjectAnimator animator = ObjectAnimator.ofInt((ColorDrawable) drawable,
                    COLOR_DRAWABLE_COLOR_PROPERTY, startColor, endColor);
            animator.setEvaluator(new ArgbEvaluator());
            return animator;
        }/*w ww .jav a  2 s  . c om*/
    }
    return null;
}

From source file:com.betterAlarm.deskclock.DeskClock.java

private void setBackgroundColor() {
    final int duration;
    if (mLastHourColor == UNKNOWN_COLOR_ID) {
        mLastHourColor = getResources().getColor(R.color.default_background);
        duration = BACKGROUND_COLOR_INITIAL_ANIMATION_DURATION_MILLIS;
    } else {//w w  w . j  av  a  2s .  c  om
        duration = getResources().getInteger(android.R.integer.config_longAnimTime);
    }
    final int currHourColor = Utils.getCurrentHourColor();
    if (mLastHourColor != currHourColor) {
        final ObjectAnimator animator = ObjectAnimator.ofInt(getWindow().getDecorView(), "backgroundColor",
                mLastHourColor, currHourColor);
        animator.setDuration(duration);
        animator.setEvaluator(new ArgbEvaluator());
        animator.start();
        mLastHourColor = currHourColor;
    }
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

/**
 * @param drawable// ww w  .j  a v a  2s .  c o  m
 * @param left
 * @param right
 * @return
 */
public TSnackbar addIconProgressLoading(Drawable drawable, boolean left, boolean right) {
    final ObjectAnimator animator = ObjectAnimator.ofInt(drawable, "level", 0, 10000);
    animator.setDuration(1000);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.INFINITE);
    mView.setBackgroundColor(mContext.getResources().getColor(Prompt.SUCCESS.getBackgroundColor()));
    if (left) {
        mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
    }
    if (right) {
        mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
    }
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mCallback != null) {
                mCallback.onShown(TSnackbar.this);
            }
            SnackbarManager.getInstance().onShown(mManagerCallback);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
    animator.start();
    return this;
}

From source file:com.hippo.android.animator.AnimatorsBase.java

static Animator recolorText(TextView view, int startColor, int endColor) {
    if (startColor != endColor) {
        ObjectAnimator animator = ObjectAnimator.ofInt(view, TEXT_VIEW_COLOR_PROPERTY, startColor, endColor);
        animator.setEvaluator(new ArgbEvaluator());
        return animator;
    }//  w ww  .  j  a  v  a 2 s .c  om
    return null;
}

From source file:com.phonemetra.deskclock.DeskClock.java

private void setBackgroundColor() {
    final int duration;
    if (mLastHourColor == UNKNOWN_COLOR_ID) {
        mLastHourColor = getResources().getColor(R.color.default_background);
        duration = BACKGROUND_COLOR_INITIAL_ANIMATION_DURATION_MILLIS;
    } else {/*from w  ww . j  a  v a 2 s.  com*/
        duration = getResources().getInteger(android.R.integer.config_longAnimTime);
    }
    final int currHourColor = Utils.getCurrentHourColor(this);
    if (mLastHourColor != currHourColor) {
        final ObjectAnimator animator = ObjectAnimator.ofInt(getWindow().getDecorView(), "backgroundColor",
                mLastHourColor, currHourColor);
        animator.setDuration(duration);
        animator.setEvaluator(new ArgbEvaluator());
        animator.start();
        mLastHourColor = currHourColor;
    }
}