private AnimatorListener createHideAnimationListener ( @ NonNull final View animatedView , @ Nullable final AnimatorListener listener ) { return new AnimatorListener ( ) { @ Override public void onAnimationStart ( final Animator animation ) { if ( listener != null ) { listener . onAnimationStart ( animation ) ; } } @ Override public void onAnimationEnd ( final Animator animation ) { animatedView . setVisibility ( View . GONE ) ; if ( listener != null ) { listener . onAnimationEnd ( animation ) ; } } @ Override public void onAnimationCancel ( final Animator animation ) { if ( listener != null ) { listener . onAnimationCancel ( animation ) ; } } @ Override public void onAnimationRepeat ( final Animator animation ) { if ( listener != null ) { listener . onAnimationRepeat ( animation ) ; } } } ; }
Creates and returns an animation listener which allows to hide the animated view once the animation is finished .