code: private void adaptHeaderBackground(@Nullable final BackgroundAnimation animation) {
          if (headerBackgroundImageView != null) {
              Drawable newBackground = headerBackground;
  
              if (animation != null && newBackground != null) {
                  Drawable previousBackground = headerBackgroundImageView.getDrawable();
  
                  if (previousBackground != null) {
                      if (previousBackground instanceof AbstractTransitionDrawable) {
                          previousBackground =
                                  ((AbstractTransitionDrawable) previousBackground).getDrawable(1);
                      }
  
                      if (animation instanceof CircleTransitionAnimation) {
                          CircleTransitionAnimation circleTransitionAnimation =
                                  (CircleTransitionAnimation) animation;
                          CircleTransitionDrawable transition = new CircleTransitionDrawable(
                                  new Drawable[]{previousBackground, newBackground});
                          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());
                          newBackground = transition;
                      } else if (animation instanceof CrossFadeTransitionAnimation) {
                          CrossFadeTransitionDrawable transition = new CrossFadeTransitionDrawable(
                                  new Drawable[]{previousBackground, newBackground});
                          transition.setListener(animation.getListener());
                          transition.startTransition(animation.getDuration());
                          newBackground = transition;
                      } else {
                          throw new RuntimeException("Unknown type of animation: " +
                                  animation.getClass().getSimpleName());
                      }
                  }
              }
  
              headerBackgroundImageView.setImageDrawable(newBackground);
          }
      }
docs: Adapts the background of the dialog's header.
  
  @param animation
  The animation, which should be used to change the background, as an instance of the
  class {@link BackgroundAnimation} or null, if no animation should be used