Search in sources :

Example 71 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project mobile-android by photo.

the class IapNotificationLayout method hide.

public void hide(long delayMillis) {
    if (getHandler() == null)
        return;
    if (getParent() == null)
        return;
    if (getVisibility() == View.GONE)
        return;
    AnimationListener listener = new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            setVisibility(View.GONE);
        }
    };
    float currentAlpha = 1.0f;
    final Animation animation = getAnimation();
    if (animation != null) {
        if (animation instanceof CustomAlphaAnimation) {
            currentAlpha = ((CustomAlphaAnimation) animation).getAlpha();
        }
        getAnimation().setAnimationListener(null);
        clearAnimation();
    }
    Animation newAnimation = new AlphaAnimation(currentAlpha, 0);
    newAnimation.setDuration(mIapHideDuration);
    newAnimation.setStartOffset(delayMillis);
    newAnimation.setAnimationListener(listener);
    startAnimation(newAnimation);
}
Also used : CustomAlphaAnimation(com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) CustomAlphaAnimation(com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation) AnimationListener(android.view.animation.Animation.AnimationListener) AlphaAnimation(android.view.animation.AlphaAnimation) CustomAlphaAnimation(com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation)

Example 72 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project MaterialNavigationDrawer by neokree.

the class Utils method setAlpha.

public static void setAlpha(View v, float alpha) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        v.setAlpha(alpha);
    } else {
        AlphaAnimation animation = new AlphaAnimation(alpha, alpha);
        animation.setDuration(0);
        animation.setFillAfter(true);
        v.startAnimation(animation);
    }
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 73 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project mobile-android by photo.

the class FeatherActivity method createInfoScreenAnimations.

/**
	 * Creates the info screen animations.
	 * 
	 * @param isOpening
	 *           the is opening
	 */
private void createInfoScreenAnimations(final boolean isOpening) {
    final float centerX = mViewFlipper.getWidth() / 2.0f;
    final float centerY = mViewFlipper.getHeight() / 2.0f;
    Animation mMainViewAnimationIn, mMainViewAnimationOut;
    final int duration = getResources().getInteger(R.integer.feather_config_infoscreen_animTime);
    // we allow the flip3d animation only if the OS is > android 2.2
    if (android.os.Build.VERSION.SDK_INT > 8) {
        mMainViewAnimationIn = new Flip3dAnimation(isOpening ? -180 : 180, 0, centerX, centerY);
        mMainViewAnimationOut = new Flip3dAnimation(0, isOpening ? 180 : -180, centerX, centerY);
        mMainViewAnimationIn.setDuration(duration);
        mMainViewAnimationOut.setDuration(duration);
    } else {
        // otherwise let's just use a regular alpha animation
        mMainViewAnimationIn = new AlphaAnimation(0.0f, 1.0f);
        mMainViewAnimationOut = new AlphaAnimation(1.0f, 0.0f);
        mMainViewAnimationIn.setDuration(duration / 2);
        mMainViewAnimationOut.setDuration(duration / 2);
    }
    mViewFlipper.setInAnimation(mMainViewAnimationIn);
    mViewFlipper.setOutAnimation(mMainViewAnimationOut);
}
Also used : Flip3dAnimation(com.aviary.android.feather.library.graphics.animation.Flip3dAnimation) Flip3dAnimation(com.aviary.android.feather.library.graphics.animation.Flip3dAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 74 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project mobile-android by photo.

the class FeatherActivity method hideProgressLoader.

/**
	 * Hide progress loader.
	 */
private void hideProgressLoader() {
    Animation fadeout = new AlphaAnimation(1, 0);
    fadeout.setDuration(getResources().getInteger(R.integer.feather_config_mediumAnimTime));
    fadeout.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mInlineProgressLoader.setVisibility(View.GONE);
        }
    });
    mInlineProgressLoader.startAnimation(fadeout);
}
Also used : Flip3dAnimation(com.aviary.android.feather.library.graphics.animation.Flip3dAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationListener(android.view.animation.Animation.AnimationListener) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 75 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project QLibrary by DragonsQC.

the class AnimationUtils method getAlphaAnimation.

/**
     * 获取一个透明度渐变动画
     *
     * @param fromAlpha         开始时的透明度
     * @param toAlpha           结束时的透明度都
     * @param durationMillis    持续时间
     * @param animationListener 动画监听器
     * @return 一个透明度渐变动画
     */
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;
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Aggregations

AlphaAnimation (android.view.animation.AlphaAnimation)261 Animation (android.view.animation.Animation)111 TranslateAnimation (android.view.animation.TranslateAnimation)89 AnimationSet (android.view.animation.AnimationSet)78 ScaleAnimation (android.view.animation.ScaleAnimation)56 View (android.view.View)29 LinearInterpolator (android.view.animation.LinearInterpolator)26 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)26 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)26 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)26 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)26 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)26 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)26 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)26 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)26 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)26 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)26 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)26 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)26 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)26