code: public final void setVisibility(final int visibility, final boolean animate) {
          boolean visible = visibility == View.VISIBLE;
          Boolean tag = (Boolean) getTag();
          setTag(visible);
  
          if (animate) {
              if (tag == null || tag != visible) {
                  if (getAnimation() != null) {
                      getAnimation().cancel();
  
                  }
  
                  animate().alpha(visible ? 1 : 0).setDuration(
                          getResources().getInteger(android.R.integer.config_mediumAnimTime))
                          .setListener(createVisibilityAnimationListener(visible)).start();
              }
          } else {
              super.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
          }
      }
docs: Sets the visibility of the divider.
  
  @param visibility
  The visibility, which should be set, as an {@link Integer} value. Must be one of
  {@link #VISIBLE}, {@link #INVISIBLE} or {@link #GONE}.
  @param animate
  True, if the visibility should be changed in an animated manner, false otherwise