private AnimatorListener createVisibilityAnimatorListener ( final int visibility ) { return new AnimatorListener ( ) { @ Override public void onAnimationStart ( final Animator animation ) { if ( visibility == View . VISIBLE ) { FloatingActionButton . super . setVisibility ( visibility ) ; } } @ Override public void onAnimationRepeat ( final Animator animation ) { } @ Override public void onAnimationEnd ( final Animator animation ) { FloatingActionButton . super . setVisibility ( visibility ) ; visibilityAnimator = null ; } @ Override public void onAnimationCancel ( final Animator animation ) { visibilityAnimator = null ; } } ; }
Creates and returns a listener which allows to adapt the visibility of the floating action button depending on the progress of an animation which is used to change the visibility .