code: private void obtainPreviewBackground(@NonNull final TypedArray typedArray) {
          int backgroundColor = typedArray
                  .getColor(R.styleable.AbstractColorPickerPreference_previewBackground, -1);
  
          if (backgroundColor != -1) {
              setPreviewBackgroundColor(backgroundColor);
          } else {
              int resourceId = typedArray
                      .getResourceId(R.styleable.AbstractColorPickerPreference_previewBackground,
                              R.drawable.color_picker_default_preview_background);
              setPreviewBackground(ContextCompat.getDrawable(getContext(), resourceId));
          }
      }
docs: Obtains the background of the preview of the preference's color 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