Example usage for android.view View clearAnimation

List of usage examples for android.view View clearAnimation

Introduction

In this page you can find the example usage for android.view View clearAnimation.

Prototype

public void clearAnimation() 

Source Link

Document

Cancels any animations for this view.

Usage

From source file:Main.java

public static void clearAnimation(View view) {
    view.clearAnimation();
    view.setVisibility(View.GONE);
}

From source file:Main.java

public static void startAnim(View view) {
    view.clearAnimation();
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.2f, 1f);
    scaleY.setDuration(300);//from  w w w. jav  a2s .c o m
    scaleY.start();
}

From source file:Main.java

public static void stopFlick(View view) {
    if (null == view) {
        return;//from   w  w  w .j ava 2s . c  o  m
    }
    view.clearAnimation();
}

From source file:Main.java

public static void stopBlink(View view) {
    if (null == view) {
        return;//from  ww  w. ja v a 2 s  . c  o m
    }
    view.clearAnimation();
}

From source file:Main.java

public static void SlideInRight(View v, final Runnable onComplete) {
    v.clearAnimation();
    TranslateAnimation aout = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f);
    aout.setDuration(300);// w w w.  j a v a  2 s  .  c om
    v.startAnimation(aout);
    if (onComplete != null)
        aout.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation arg0) {
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {
            }

            @Override
            public void onAnimationEnd(Animation arg0) {
                onComplete.run();
            }
        });
}

From source file:Main.java

public static void SlideOutLeft(View v, final Runnable onComplete) {
    v.clearAnimation();
    TranslateAnimation aout = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF,
            -1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f);
    aout.setDuration(300);//ww  w.  j a v a  2s  . c  o  m
    aout.setFillAfter(true);
    v.startAnimation(aout);
    if (onComplete != null)
        aout.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation arg0) {
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {
            }

            @Override
            public void onAnimationEnd(Animation arg0) {
                onComplete.run();
            }
        });
}

From source file:Main.java

private static void setAlpha(View view, float alphaValue) {

    if (alphaValue == 1) {
        view.clearAnimation();
    } else {/* w w  w  . j av a 2  s . co m*/
        AlphaAnimation alpha = new AlphaAnimation(alphaValue, alphaValue);
        alpha.setDuration(0); // Make animation instant
        alpha.setFillAfter(true); // Tell it to persist after the animation ends       
        view.startAnimation(alpha);
    }

}

From source file:Main.java

/**
 * hideRefreshAnimation/*  w w  w.j  a  va 2  s  .com*/
 * stop the refresh animation
 * @param v
 */
public static void hideRefreshAnimation(View v) {
    if (animation != null) {
        animation.cancel();
        v.clearAnimation();
        v.setAnimation(null);
        //v.setImageResource(R.drawable.refresh);
    }
}

From source file:Main.java

public static void animHide(final View v, int duration, float from, float to, final boolean gone) {
    v.clearAnimation();
    ObjectAnimator anim = ObjectAnimator.ofFloat(v, "alpha", from, to).setDuration(duration);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override/*from  w w  w .ja  v  a 2 s  . co m*/
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (gone) {
                v.setVisibility(View.GONE);
            }
        }
    });
    anim.start();
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static ViewPropertyAnimator fadeOut(final View from, int duration) {
    if (from.getVisibility() == View.VISIBLE) {
        from.clearAnimation();
        final ViewPropertyAnimator animator = from.animate();
        animator.alpha(0f).setDuration(duration).setListener(new AnimatorListenerAdapter() {
            @Override//  w w w  .j  a  v a2  s . co  m
            public void onAnimationEnd(Animator animation) {
                from.setVisibility(View.INVISIBLE);
                from.setAlpha(1f);
            }
        });
        return animator;
    }
    return null;
}