code: private void obtainColorPalette(@NonNull final TypedArray typedArray) {
          int resourceId =
                  typedArray.getResourceId(R.styleable.ColorPalettePreference_colorPalette, -1);
  
          if (resourceId != -1) {
              int[] obtainedColorPalette = getContext().getResources().getIntArray(resourceId);
              setColorPalette(obtainedColorPalette);
          }
      }
docs: Obtains the color palette from a specific typed array.
  
  @param typedArray
  The typed array, the color palette, should be obtained from, as an instance of the
  class {@link TypedArray}. The typed array may not be null