code: 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);
                  }
              }
  
          };
      }
docs: Creates and returns an animation listener, which allows to hide the animated view once the
  animation is finished.
  
  @param animatedView
  The animated view as an instance of the class {@link View}. The view may not be null
  @param listener
  The listener, which should be notified, as an instance of the type {@link
  AnimatorListener} or null, if no listener should be notified
  @return The animation listener, which has been created, as an instance of the type {@link
  AnimatorListener}