Search in sources :

Example 46 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project openkit-android by OpenKit.

the class PickerFragment method setAlpha.

private static void setAlpha(View view, float alpha) {
    // Set the alpha appropriately (setAlpha is API >= 11, this technique works on all API levels).
    AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
    alphaAnimation.setDuration(0);
    alphaAnimation.setFillAfter(true);
    view.startAnimation(alphaAnimation);
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 47 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project FastDev4Android by jiangqqlmj.

the class BaseAdapterHelper method setAlpha.

/**
     * Add an action to set the alpha of a view. Can be called multiple times.
     * Alpha between 0-1.
     * 设置控件的显示的透明度
     */
public BaseAdapterHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        retrieveView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        retrieveView(viewId).startAnimation(alpha);
    }
    return this;
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 48 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project KJFrameForAndroid by kymjs.

the class KJAnimations method getAlphaAnimation.

/**
     * 透明度 Alpha
     */
public static Animation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) {
    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(durationMillis);
    alpha.setFillAfter(true);
    return alpha;
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 49 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project Lazy by l123456789jy.

the class ViewAnimationUtils method invisibleViewByAlpha.

// /**
// * 默认动画持续时间
// */
// public static final long DEFAULT_ANIMATION_DURATION = 300;
/*
     *  ************************************************************* 视图透明度渐变动画
	 * ********************************************************************
	 */
/**
     * 将给定视图渐渐隐去(view.setVisibility(View.INVISIBLE))
     *
     * @param view              被处理的视图
     * @param isBanClick        在执行动画的过程中是否禁止点击
     * @param durationMillis    持续时间,毫秒
     * @param animationListener 动画监听器
     */
public static void invisibleViewByAlpha(final View view, long durationMillis, final boolean isBanClick, final AnimationListener animationListener) {
    if (view.getVisibility() != View.INVISIBLE) {
        view.setVisibility(View.INVISIBLE);
        AlphaAnimation hiddenAlphaAnimation = AnimationUtils.getHiddenAlphaAnimation(durationMillis);
        hiddenAlphaAnimation.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                if (isBanClick) {
                    view.setClickable(false);
                }
                if (animationListener != null) {
                    animationListener.onAnimationStart(animation);
                }
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
                if (animationListener != null) {
                    animationListener.onAnimationRepeat(animation);
                }
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                if (isBanClick) {
                    view.setClickable(true);
                }
                if (animationListener != null) {
                    animationListener.onAnimationEnd(animation);
                }
            }
        });
        view.startAnimation(hiddenAlphaAnimation);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 50 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project Lazy by l123456789jy.

the class ViewAnimationUtils method visibleViewByAlpha.

/**
     * 将给定视图渐渐显示出来(view.setVisibility(View.VISIBLE))
     *
     * @param view              被处理的视图
     * @param durationMillis    持续时间,毫秒
     * @param isBanClick        在执行动画的过程中是否禁止点击
     * @param animationListener 动画监听器
     */
public static void visibleViewByAlpha(final View view, long durationMillis, final boolean isBanClick, final AnimationListener animationListener) {
    if (view.getVisibility() != View.VISIBLE) {
        view.setVisibility(View.VISIBLE);
        AlphaAnimation showAlphaAnimation = AnimationUtils.getShowAlphaAnimation(durationMillis);
        showAlphaAnimation.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                if (isBanClick) {
                    view.setClickable(false);
                }
                if (animationListener != null) {
                    animationListener.onAnimationStart(animation);
                }
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
                if (animationListener != null) {
                    animationListener.onAnimationRepeat(animation);
                }
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                if (isBanClick) {
                    view.setClickable(true);
                }
                if (animationListener != null) {
                    animationListener.onAnimationEnd(animation);
                }
            }
        });
        view.startAnimation(showAlphaAnimation);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener) 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