code: private void adaptHeaderIcon(@Nullable final DrawableAnimation animation) {
          if (headerIconImageView != null) {
              ImageViewCompat.setImageTintList(headerIconImageView, headerIconTintList);
              ImageViewCompat.setImageTintMode(headerIconImageView, headerIconTintMode);
              Drawable newIcon = headerIcon;
  
              if (animation != null && newIcon != null) {
                  Drawable previousIcon = headerIconImageView.getDrawable();
  
                  if (previousIcon != null) {
                      if (previousIcon instanceof AbstractTransitionDrawable) {
                          previousIcon = ((AbstractTransitionDrawable) previousIcon).getDrawable(1);
                      }
  
                      if (animation instanceof ScaleTransitionAnimation) {
                          ScaleTransitionDrawable transition =
                                  new ScaleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
                          transition.setListener(animation.getListener());
                          transition.startTransition(animation.getDuration());
                          newIcon = transition;
                      } else if (animation instanceof CircleTransitionAnimation) {
                          CircleTransitionAnimation circleTransitionAnimation =
                                  (CircleTransitionAnimation) animation;
                          CircleTransitionDrawable transition =
                                  new CircleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
                          transition.setRadius(circleTransitionAnimation.getRadius());
                          transition.setListener(circleTransitionAnimation.getListener());
  
                          if (circleTransitionAnimation.getX() != null) {
                              transition.setX(circleTransitionAnimation.getX());
                          }
  
                          if (circleTransitionAnimation.getY() != null) {
                              transition.setY(circleTransitionAnimation.getY());
                          }
  
                          transition.startTransition(circleTransitionAnimation.getDuration());
                          newIcon = transition;
                      } else if (animation instanceof CrossFadeTransitionAnimation) {
                          CrossFadeTransitionDrawable transition = new CrossFadeTransitionDrawable(
                                  new Drawable[]{previousIcon, newIcon});
                          transition.setCrossFade(true);
                          transition.setListener(animation.getListener());
                          transition.startTransition(animation.getDuration());
                          newIcon = transition;
                      } else {
                          throw new RuntimeException("Unknown type of animation: " +
                                  animation.getClass().getSimpleName());
                      }
                  }
              }
  
              headerIconImageView.setImageDrawable(newIcon);
          }
      }
docs: Adapt's the icon of the dialog's header.
  
  @param animation
  The animation, which should be used to change the icon, as an instance of the class
  {@link DrawableAnimation} or null, if no animation should be used