Example usage for android.view.animation Animation setRepeatMode

List of usage examples for android.view.animation Animation setRepeatMode

Introduction

In this page you can find the example usage for android.view.animation Animation setRepeatMode.

Prototype

public void setRepeatMode(int repeatMode) 

Source Link

Document

Defines what this animation should do when it reaches the end.

Usage

From source file:Main.java

public static void blink(View view, int durationMs, int repeatCount) {
    Animation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(durationMs); //You can manage the time of the blink with this parameter
    anim.setStartOffset(0);/*  w ww . j a v  a 2 s . co  m*/
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(repeatCount);
    view.startAnimation(anim);

}

From source file:Main.java

public static void startBlink(View view) {
    if (null == view) {
        return;// ww  w  . j a v a 2s. c  om
    }
    Animation alphaAnimation = new AlphaAnimation(1, 0);
    alphaAnimation.setDuration(500);
    alphaAnimation.setInterpolator(new LinearInterpolator());
    alphaAnimation.setRepeatCount(Animation.INFINITE);
    alphaAnimation.setRepeatMode(Animation.REVERSE);
    view.startAnimation(alphaAnimation);
}

From source file:Main.java

public static void animateView(View view) {
    final Animation animation = new AlphaAnimation(1f, 0f);
    animation.setDuration(1000); // Animate for 1 seconds
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    view.startAnimation(animation);/*from w  w w  . ja v  a 2  s  .  c om*/
}

From source file:Main.java

public static Animation createForeverReverseRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(720, 0, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}

From source file:Main.java

public static Animation createForeverRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(0, 1080, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}

From source file:Main.java

public static void animaBotao(Button botao) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(400);//from  w ww  .  j ava2s  .  c o  m
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
    botao.startAnimation(animation);
}

From source file:Main.java

public static AnimationSet FlipAnimation(int duration, int repeatCount) {
    AnimationSet flip = new AnimationSet(true);
    if (duration > 20) //Flip anim
    {/*from w ww .jav a2  s .co m*/
        Animation from_middle1_anim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF,
                .5f, Animation.RELATIVE_TO_SELF, .5f);
        from_middle1_anim.setDuration(duration);
        from_middle1_anim.setStartOffset(0);
        from_middle1_anim.setRepeatMode(Animation.REVERSE);
        from_middle1_anim.setRepeatCount(repeatCount);

        flip.addAnimation(from_middle1_anim);
    } else // no anim
    {
        Animation noAnim = new AlphaAnimation(1f, 1f);
        noAnim.setDuration(duration);
        flip.addAnimation(noAnim);
    }
    return flip;
}

From source file:Main.java

public static void setFlickerAnimation(View v) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha
    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter
                                                         // animation
                                                         // rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation
                                                  // infinitely
    animation.setRepeatMode(Animation.REVERSE); //
    v.setAnimation(animation);//  w ww .  j a v  a 2s.co  m
}

From source file:pl.wasat.smarthma.customviews.EntryItemView.java

private void titleAnimation() {
    String title = this.entry.getTitle().replaceFirst("urn:ogc:def:", "");
    if (title.length() < 30) {
        tvEntryTitle.setText(title);/* w w w.  j av a2  s . com*/
        return;
    }

    int stopAnimPos = -1000;
    int startAnimPos = 20;
    int duration = 30000;

    Animation animation = new TranslateAnimation(startAnimPos, stopAnimPos, 0, 0);
    animation.setDuration(duration);
    animation.setRepeatMode(Animation.RESTART);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(this);

    tvEntryTitle.setText(title);
    tvEntryTitle.measure(0, 0);
    tvEntryTitle.setAnimation(animation);
}

From source file:heartware.com.heartware_master.ProfileFragment.java

/**
 * start the animation on the graph//  www .j a  v a2 s  .  co  m
 */
private void triggerAnimation() {
    // set up animation
    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.animated_view);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    mGraph.startAnimation(animation);
}