Example usage for android.animation ObjectAnimator setRepeatCount

List of usage examples for android.animation ObjectAnimator setRepeatCount

Introduction

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

Prototype

public void setRepeatCount(int value) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java

private void startBoringAnimation() {
    scanLine.setVisibility(View.VISIBLE);
    // Create animators for y axe
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        int yMax = 0;
        yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight();
        yMax = (int) (yMax * 0.9);// 174;

        ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax);
        oay.setRepeatCount(Animation.INFINITE);
        oay.setDuration(ANIM_DURATION);/*from   w w w .j  a  v a  2  s .c o  m*/
        oay.setRepeatMode(ValueAnimator.REVERSE);

        oay.setInterpolator(new LinearInterpolator());
        oay.start();

        //for draw points near ir_scanline
        markFakeFeaturePoint.setObjectAnimator(oay);
    }

    //scanAnimation.

}

From source file:com.mac.SafeWalk.WelcomeActivity.java

public void animate(ImageView dot) {
    if (dot != null) {
        Log.w("WelcomeActivity", "setting up animation");
        ObjectAnimator appear = ObjectAnimator.ofFloat(dot, "alpha", 0f, 1f);
        appear.setRepeatCount(2);
        appear.setDuration(2000);//  w w w.  j  av a 2s  .c o m
        appear.start();
        ObjectAnimator translation = ObjectAnimator.ofFloat(dot, "translationX", 0, -400f);
        translation.setDuration(2000);
        translation.setRepeatCount(2);
        translation.start();
        Log.w("WelcomeActivity", "starting animation");
    }
}

From source file:com.example.google.maps.folding_map.MainActivity.java

public void animateFold() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldingLayout, "foldFactor",
            mFoldingLayout.getFoldFactor(), 1);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(1);
    animator.setDuration(FOLD_ANIMATION_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();//from  w w  w  . j  a  va 2s. c  o  m
}

From source file:me.lizheng.deckview.views.DeckChildViewHeader.java

/**
 * Notifies the associated TaskView has been focused.
 *///  w  ww .  j  a  va 2 s .c  om
void onTaskViewFocusChanged(boolean focused, boolean animateFocusedState) {
    // If we are not animating the visible state, just return
    if (!animateFocusedState)
        return;

    boolean isRunning = false;
    if (mFocusAnimator != null) {
        isRunning = mFocusAnimator.isRunning();
        DVUtils.cancelAnimationWithoutCallbacks(mFocusAnimator);
    }

    if (focused) {
        // Pulse the background color
        int currentColor = mBackgroundColor;
        int lightPrimaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark);
        ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor,
                lightPrimaryColor);

        backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int color = (int) animation.getAnimatedValue();
                mBackgroundColorDrawable.setColor(color);
                mBackgroundColor = color;
            }
        });

        backgroundColor.setRepeatCount(ValueAnimator.INFINITE);
        backgroundColor.setRepeatMode(ValueAnimator.REVERSE);

        // Pulse the translation
        ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 15f);
        translation.setRepeatCount(ValueAnimator.INFINITE);
        translation.setRepeatMode(ValueAnimator.REVERSE);

        mFocusAnimator = new AnimatorSet();
        mFocusAnimator.playTogether(backgroundColor, translation);
        mFocusAnimator.setStartDelay(750);
        mFocusAnimator.setDuration(750);
        mFocusAnimator.start();
    } else if (isRunning) {
        // Restore the background color
        int currentColor = mBackgroundColor;
        ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor,
                mCurrentPrimaryColor);
        backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int color = (int) animation.getAnimatedValue();
                mBackgroundColorDrawable.setColor(color);
                mBackgroundColor = color;
            }
        });

        // Restore the translation
        ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 0f);

        mFocusAnimator = new AnimatorSet();
        mFocusAnimator.playTogether(backgroundColor, translation);
        mFocusAnimator.setDuration(150);
        mFocusAnimator.start();
    }
}

From source file:com.hippo.widget.ProgressView.java

private void setupAnimators() {
    ObjectAnimator trimStart = ObjectAnimator.ofFloat(this, "trimStart", 0.0f, 0.75f);
    trimStart.setDuration(1333L);//from   ww w. ja v a 2  s.c  o m
    trimStart.setInterpolator(TRIM_START_INTERPOLATOR);
    trimStart.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimEnd = ObjectAnimator.ofFloat(this, "trimEnd", 0.0f, 0.75f);
    trimEnd.setDuration(1333L);
    trimEnd.setInterpolator(TRIM_END_INTERPOLATOR);
    trimEnd.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimOffset = ObjectAnimator.ofFloat(this, "trimOffset", 0.0f, 0.25f);
    trimOffset.setDuration(1333L);
    trimOffset.setInterpolator(LINEAR_INTERPOLATOR);
    trimOffset.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimRotation = ObjectAnimator.ofFloat(this, "trimRotation", 0.0f, 720.0f);
    trimRotation.setDuration(6665L);
    trimRotation.setInterpolator(LINEAR_INTERPOLATOR);
    trimRotation.setRepeatCount(Animation.INFINITE);

    mAnimators.add(trimStart);
    mAnimators.add(trimEnd);
    mAnimators.add(trimOffset);
    mAnimators.add(trimRotation);
}

From source file:com.bar.foldinglayout.sample.FoldingLayoutActivity.java

/**
 * Animates the folding view inwards (to a completely folded state) from its
 * current state and then back out to its original state.
 *///from w w  w.ja v  a 2  s.c  o  m
public void animateFold() {
    float foldFactor = mFoldLayout.getFoldFactor();

    ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldLayout, "foldFactor", foldFactor, 1);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(1);
    animator.setDuration(FOLD_ANIMATION_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}

From source file:fr.tvbarthel.apps.cameracolorpicker.activities.MainActivity.java

/**
 * Make a subtle animation for a {@link com.melnykov.fab.FloatingActionButton} drawing attention to the button.
 *
 * @param fab the {@link com.melnykov.fab.FloatingActionButton} to animate.
 *//*w ww.  j ava  2s.  c  om*/
private void animateFab(final FloatingActionButton fab) {
    fab.postDelayed(new Runnable() {
        @Override
        public void run() {
            // Play a subtle animation
            final long duration = 450;

            final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_X, 1f, 1.2f, 1f);
            scaleXAnimator.setDuration(duration);
            scaleXAnimator.setRepeatCount(1);

            final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_Y, 1f, 1.2f, 1f);
            scaleYAnimator.setDuration(duration);
            scaleYAnimator.setRepeatCount(1);

            scaleXAnimator.start();
            scaleYAnimator.start();

            final AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.play(scaleXAnimator).with(scaleYAnimator);
            animatorSet.start();
        }
    }, 400);
}

From source file:de.baumann.thema.RequestActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.request_grid);
    switcherLoad = (ViewSwitcher) findViewById(R.id.viewSwitcherLoadingMain);
    context = this;

    android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }/*w w w. j a  v  a 2 s  .com*/

    if (savedInstanceState == null) {

        //Loading Logo Animation
        ImageView logo = (ImageView) findViewById(R.id.imageViewLogo);
        ObjectAnimator logoAni = (ObjectAnimator) AnimatorInflater.loadAnimator(context,
                R.animator.request_flip);
        logoAni.setRepeatCount(Animation.INFINITE);
        logoAni.setRepeatMode(Animation.RESTART);
        logoAni.setTarget(logo);
        logoAni.setDuration(2000);
        logoAni.start();

        taskList.execute();
    } else {
        populateView(list_activities_final);
        switcherLoad.showNext();
    }
}

From source file:io.vit.vitio.Fragments.Today.TodayFragment.java

private void animateView() {
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) {
        return;//ww w.j  a  v a 2 s  . co  m
    }
    //float dimension = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, getResources().getDisplayMetrics());
    ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(ocassionImage, "scaleX", 1f, 0.8f);
    ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(ocassionImage, "scaleY", 1f, 0.8f);
    objectAnimatorX.setDuration(6000);
    objectAnimatorY.setDuration(6000);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(objectAnimatorX, objectAnimatorY);
    animatorSet.setInterpolator(new LinearInterpolator());
    objectAnimatorX.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorX.setRepeatMode(ObjectAnimator.REVERSE);
    objectAnimatorY.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorY.setRepeatMode(ObjectAnimator.REVERSE);
    animatorSet.start();
    objectAnimatorX.start();
}

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

/**
 * @param drawable//  w w  w.  j  ava 2 s . co 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;
}