code: private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
          return new AnimationListener() {
  
              @Override
              public void onAnimationStart(final Animation animation) {
  
              }
  
              @Override
              public void onAnimationEnd(final Animation animation) {
                  clearAnimation();
                  maximized = show;
  
                  if (maximized) {
                      notifyOnMaximized();
                  } else {
                      notifyOnHidden(cancel);
                  }
              }
  
              @Override
              public void onAnimationRepeat(final Animation animation) {
  
              }
  
          };
      }
docs: Creates and returns a listener, which allows to handle the end of an animation, which has
  been used to show or hide the view.
  
  @param show
  True, if the view should be shown at the end of the animation, false otherwise
  @param cancel
  True, if the view should be canceled, false otherwise
  @return The listener, which has been created, as an instance of the type {@link
  AnimationListener}