library/src/main/java/de/mrapp/android/view/FloatingActionButton.java
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;
            }

        };
    }
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.

@param visibility
The visibility, which is set by the observed animation, as an {@link Integer} value.
The visibility may be <code>View.VISIBLE</code>, <code>View.INVISIBLE</code> or
<code>View.GONE</code>
@return The listener, which has been created, as an instance of the type {@link
AnimatorListener}