code: private void obtainDialogPreviewBackground(@NonNull final TypedArray typedArray) {
          int backgroundColor =
                  typedArray.getColor(R.styleable.ColorPalettePreference_dialogPreviewBackground, -1);
  
          if (backgroundColor != -1) {
              setPreviewBackgroundColor(backgroundColor);
          } else {
              int resourceId = typedArray
                      .getResourceId(R.styleable.ColorPalettePreference_dialogPreviewBackground,
                              R.drawable.color_picker_default_preview_background);
              setDialogPreviewBackground(ContextCompat.getDrawable(getContext(), resourceId));
          }
      }
docs: Obtains the background, which should be used to preview colors in the preference's dialog,
  from a specific typed array.
  
  @param typedArray
  The typed array, the background should be obtained from, as an instance of the class
  {@link TypedArray}. The typed array may not be null