get Hidden Alpha Animation - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

get Hidden Alpha Animation

Demo Code


//package com.java2s;

import android.view.animation.AlphaAnimation;

import android.view.animation.Animation.AnimationListener;

public class Main {

    public static final long DEFAULT_ANIMATION_DURATION = 1000;

    public static AlphaAnimation getHiddenAlphaAnimation(
            long durationMillis, AnimationListener animationListener) {
        return getAlphaAnimation(1.0f, 0.0f, durationMillis,
                animationListener);//from   w w w . ja  va 2 s  .  co m
    }

    public static AlphaAnimation getHiddenAlphaAnimation(long durationMillis) {
        return getHiddenAlphaAnimation(durationMillis, null);
    }

    public static AlphaAnimation getHiddenAlphaAnimation(
            AnimationListener animationListener) {
        return getHiddenAlphaAnimation(DEFAULT_ANIMATION_DURATION,
                animationListener);
    }

    public static AlphaAnimation getHiddenAlphaAnimation() {
        return getHiddenAlphaAnimation(DEFAULT_ANIMATION_DURATION, null);
    }

    public static AlphaAnimation getAlphaAnimation(float fromAlpha,
            float toAlpha, long durationMillis,
            AnimationListener animationListener) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha,
                toAlpha);
        alphaAnimation.setDuration(durationMillis);
        if (animationListener != null) {
            alphaAnimation.setAnimationListener(animationListener);
        }
        return alphaAnimation;
    }

    public static AlphaAnimation getAlphaAnimation(float fromAlpha,
            float toAlpha, long durationMillis) {
        return getAlphaAnimation(fromAlpha, toAlpha, durationMillis, null);
    }

    public static AlphaAnimation getAlphaAnimation(float fromAlpha,
            float toAlpha, AnimationListener animationListener) {
        return getAlphaAnimation(fromAlpha, toAlpha,
                DEFAULT_ANIMATION_DURATION, animationListener);
    }

    public static AlphaAnimation getAlphaAnimation(float fromAlpha,
            float toAlpha) {
        return getAlphaAnimation(fromAlpha, toAlpha,
                DEFAULT_ANIMATION_DURATION, null);
    }
}

Related Tutorials