Example usage for android.view.animation AlphaAnimation setFillAfter

List of usage examples for android.view.animation AlphaAnimation setFillAfter

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setFillAfter.

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

From source file:Main.java

public static Animation getAlpha(float fromAlpha, float toAlpha, long duration) {
    AlphaAnimation animation = new AlphaAnimation(fromAlpha, toAlpha);
    animation.setFillAfter(true);
    animation.setDuration(duration);//ww  w .j  av a  2 s .  c  o  m
    return animation;
}

From source file:Main.java

public static Animation getAplhaAnimation(float fromAlpha, float toAlpha) {
    AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
    alphaAnimation.setFillAfter(true);
    alphaAnimation.setDuration(0);//from   w w w .  jav  a2 s  .c  o  m
    return (alphaAnimation);
}

From source file:Main.java

public static AlphaAnimation getOutAlphaAnim() {
    AlphaAnimation animation = new AlphaAnimation(1, 0);
    animation.setDuration(1000);/*w ww . j a  v  a  2s .  c o m*/
    animation.setFillAfter(true);
    return animation;
}

From source file:Main.java

public static Animation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) {
    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(durationMillis);//from w  w w  . ja  v  a2 s.  c o m
    alpha.setFillAfter(true);
    return alpha;
}

From source file:Main.java

public static void disappear(long during, View view) {
    AlphaAnimation disappearAnimation = new AlphaAnimation(1, 0);
    disappearAnimation.setDuration(during);
    disappearAnimation.setFillAfter(true);
    view.startAnimation(disappearAnimation);
}

From source file:Main.java

public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, int intDuration,
        boolean boolFillAfter) {
    AlphaAnimation mAnmation = new AlphaAnimation(fromAlpha, toAlpha);
    mAnmation.setDuration(intDuration);/*www  .ja  v a 2s  .  com*/
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void alphaAnimation(View v, float fromAlpha, float toAlpha, long durationMillis,
        boolean fillAfter) {
    AlphaAnimation animation = new AlphaAnimation(fromAlpha, toAlpha);
    animation.setDuration(durationMillis);
    animation.setFillAfter(fillAfter);
    animation.setRepeatMode(Animation.REVERSE);
    v.startAnimation(animation);/*from  ww w.j  a v a2s.c o  m*/
}

From source file:Main.java

public static void setAlphaAnimation(View view, float fromAlpha, float toAlpha, int intDuration,
        boolean boolFillAfter) {
    AlphaAnimation mAnmation = new AlphaAnimation(fromAlpha, toAlpha);
    mAnmation.setDuration(intDuration);/*  w  w w . j  a  v a 2s.co  m*/
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

From source file:Main.java

@SuppressLint("NewApi")
public static void setAlpha(View view, float alpha) {
    if (Build.VERSION.SDK_INT < 11) {
        final AlphaAnimation animation = new AlphaAnimation(alpha, alpha);
        animation.setDuration(0);/*w  ww  .  j  a  v a  2  s .  co m*/
        animation.setFillAfter(true);
        view.startAnimation(animation);
    } else {
        view.setAlpha(alpha);
    }
}

From source file:Main.java

/**
 * Change opacity of a given view, with the alpha level given as parameter.
 * This method considers the environment version.
 *
 * @param view       View that will change its opacity
 * @param alphaLevel Alpha level representing the opacity, where 0.0 is completely transparent, and 1.0 is completely opaque
 *///from   w w  w  . ja  v  a 2  s .  c  o m
public static void setAlphaForAllVersions(View view, float alphaLevel) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        view.setAlpha(alphaLevel);
    } else {
        AlphaAnimation alpha = new AlphaAnimation(alphaLevel, alphaLevel);
        alpha.setDuration(0); // Make animation instant
        alpha.setFillAfter(true); // Tell it to persist after the animation ends
        view.startAnimation(alpha);
    }
}