Search in sources :

Example 1 with CustomAlphaAnimation

use of com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation 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 2 with CustomAlphaAnimation

use of com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation in project mobile-android by photo.

the class IapNotificationLayout method show.

public void show(long delayMillis) {
    AnimationListener listener = new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            hide();
        }
    };
    Animation animation = new CustomAlphaAnimation(0.0f, 1.0f);
    animation.setStartOffset(delayMillis);
    animation.setInterpolator(new DecelerateInterpolator(1.0f));
    animation.setDuration(mIapShowDuration);
    animation.setAnimationListener(listener);
    startAnimation(animation);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) 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)

Aggregations

AlphaAnimation (android.view.animation.AlphaAnimation)2 Animation (android.view.animation.Animation)2 AnimationListener (android.view.animation.Animation.AnimationListener)2 CustomAlphaAnimation (com.aviary.android.feather.library.graphics.animation.CustomAlphaAnimation)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1