Example usage for android.animation AnimatorListenerAdapter onAnimationEnd

List of usage examples for android.animation AnimatorListenerAdapter onAnimationEnd

Introduction

In this page you can find the example usage for android.animation AnimatorListenerAdapter onAnimationEnd.

Prototype

@Override
public void onAnimationEnd(Animator animation) 

Source Link

Usage

From source file:Main.java

public static void fadeOut(final View view, final AnimatorListenerAdapter listener) {
    view.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
        @Override/* www . ja  v a  2s.  co  m*/
        public void onAnimationEnd(Animator animation) {
            listener.onAnimationEnd(animation);
            view.setAlpha(1f);
        }
    });

}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void hide(final View view, int cornerType, int animRes, final boolean goneOrInvisible,
        final AnimatorListenerAdapter listener) {
    int[] amaya = calulateCorner(view, cornerType);
    //            if(view)
    Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], amaya[2], 0);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override//from w  w w. j  a v a 2s  . co m
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(goneOrInvisible ? View.GONE : View.INVISIBLE);
            if (listener != null)
                listener.onAnimationEnd(animation);
        }
    });
    anim.setDuration(300);
    anim.start();
}

From source file:android.support.transition.FadePort.java

/**
 * Utility method to handle creating and running the Animator.
 *//*from  w  w w  . j  a  v  a 2  s .  c o  m*/
private Animator createAnimation(View view, float startAlpha, float endAlpha,
        AnimatorListenerAdapter listener) {
    if (startAlpha == endAlpha) {
        // run listener if we're noop'ing the animation, to get the end-state results now
        if (listener != null) {
            listener.onAnimationEnd(null);
        }
        return null;
    }
    final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", startAlpha, endAlpha);
    if (DBG) {
        Log.d(LOG_TAG, "Created animator " + anim);
    }
    if (listener != null) {
        anim.addListener(listener);
    }
    return anim;
}

From source file:uk.ac.hutton.ics.buntata.fragment.IntroNetworkFragment.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void circularHideView(final View view, final AnimatorListenerAdapter listener) {
    if (anim != null && anim.isRunning())
        anim.end();//from   w  ww .  ja  va  2 s.co m

    /* get the center for the clipping circle */
    int cx = view.getWidth() / 2;
    int cy = view.getHeight();

    /* get the initial radius for the clipping circle */
    float initialRadius = (float) Math.hypot(cx, cy);

    /* create the animation (the final radius is zero) */
    anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);

    /* make the view invisible when the animation is done */
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.INVISIBLE);

            if (listener != null) {
                listener.onAnimationEnd(animation);
            }
        }
    });

    anim.start();
}