public static void updateFromStyleResource(
      TextLayoutBuilder builder,
      Context context,
      AttributeSet attrs,
      @AttrRes int styleAttr,
      @StyleRes int styleRes) {
    TypedArray customAttrs =
        context.obtainStyledAttributes(attrs, R.styleable.TextStyle, styleAttr, styleRes);

    int textAppearanceId =
        customAttrs.getResourceId(R.styleable.TextStyle_android_textAppearance, -1);

    if (textAppearanceId > 0) {
      setTextAppearance(builder, context, textAppearanceId);
    }

    ColorStateList textColor =
        customAttrs.getColorStateList(R.styleable.TextStyle_android_textColor);

    int textSize =
        customAttrs.getDimensionPixelSize(
            R.styleable.TextStyle_android_textSize, DEFAULT_TEXT_SIZE_PX);

    int shadowColor =
        customAttrs.getInt(R.styleable.TextStyle_android_shadowColor, Color.TRANSPARENT);

    float dx = customAttrs.getFloat(R.styleable.TextStyle_android_shadowDx, 0.0f);

    float dy = customAttrs.getFloat(R.styleable.TextStyle_android_shadowDy, 0.0f);

    float radius = customAttrs.getFloat(R.styleable.TextStyle_android_shadowRadius, 0.0f);

    int textStyle = customAttrs.getInt(R.styleable.TextStyle_android_textStyle, -1);

    int ellipsize = customAttrs.getInt(R.styleable.TextStyle_android_ellipsize, 0);

    boolean singleLine = customAttrs.getBoolean(R.styleable.TextStyle_android_singleLine, false);

    int maxLines =
        customAttrs.getInt(
            R.styleable.TextStyle_android_maxLines, TextLayoutBuilder.DEFAULT_MAX_LINES);

    int breakStrategy = customAttrs.getInt(R.styleable.TextStyle_android_breakStrategy, -1);

    int hyphenationFrequency =
        customAttrs.getInt(R.styleable.TextStyle_android_hyphenationFrequency, -1);

    customAttrs.recycle();

    // NULLSAFE_FIXME[Parameter Not Nullable]
    builder.setTextColor(textColor);

    builder.setTextSize(textSize);
    builder.setShadowLayer(radius, dx, dy, shadowColor);

    if (textStyle != -1) {
      builder.setTypeface(Typeface.defaultFromStyle(textStyle));
    } else {
      builder.setTypeface(null);
    }

    if (ellipsize > 0 && ellipsize < 4) {
      // TruncateAt doesn't have a value for NONE.
      // NULLSAFE_FIXME[Not Vetted Third-Party]
      builder.setEllipsize(TextUtils.TruncateAt.values()[ellipsize - 1]);
    } else {
      builder.setEllipsize(null);
    }

    builder.setSingleLine(singleLine);
    builder.setMaxLines(maxLines);

    if (breakStrategy > -1) {
      builder.setBreakStrategy(breakStrategy);
    }

    if (hyphenationFrequency > -1) {
      builder.setHyphenationFrequency(hyphenationFrequency);
    }
  }
Sets the values for a TextLayoutBuilder from a style resource or a themed attribute.

@param builder The TextLayoutBuilder
@param context The Context to use for resolving the attributes
@param attrs The {@link AttributeSet} used during inflation
@param styleAttr The themed style attribute
@param styleRes The style resource identifier
library/src/main/java/com/facebook/fbui/textlayoutbuilder/ResourceTextLayoutHelper.java