@NonNull public SpannableTheme build() { return new SpannableTheme(this); } }
private void apply(TextPaint p) { theme.applyCodeTextStyle(p, multiline); }
private void apply(TextPaint paint) { theme.applyHeadingTextStyle(paint, level); }
theme.applyListItemStyle(paint); final int width = theme.getBlockMargin(); final int side = theme.getBulletWidth(textLineHeight);
/** * Factory method to obtain an instance of {@link SpannableTheme} with all values as defaults * * @param context Context in order to resolve defaults * @return {@link SpannableTheme} instance * @see #builderWithDefaults(Context) * @since 1.0.0 */ @NonNull public static SpannableTheme create(@NonNull Context context) { return builderWithDefaults(context).build(); }
Layout layout) { final int width = theme.getBlockQuoteWidth(); theme.applyBlockQuoteStyle(paint);
theme.applyListItemStyle(paint); int width = theme.getBlockMargin(); if (numberWidth > width) {
@Override public void updateDrawState(TextPaint ds) { theme.applyLinkStyle(ds); } }
private void apply(TextPaint paint) { theme.applySubScriptStyle(paint); } }
private void apply(TextPaint paint) { theme.applySuperScriptStyle(paint); } }
theme.applyHeadingBreakStyle(paint);
.urlProcessor(urlProcessor) .syntaxHighlight(Prism4jSyntaxHighlight.create(prism4j, prism4jTheme)) .theme(SpannableTheme.builderWithDefaults(context) .codeBackgroundColor(background) .codeTextColor(prism4jTheme.textColor())
@Override public int getSize( @NonNull Paint paint, CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, @Nullable Paint.FontMetricsInt fm) { // if we have no async drawable result - we will just render text final int size; if (drawable.hasResult()) { final Rect rect = drawable.getBounds(); if (fm != null) { fm.ascent = -rect.bottom; fm.descent = 0; fm.top = fm.ascent; fm.bottom = 0; } size = rect.right; } else { // we will apply style here in case if theme modifies textSize or style (affects metrics) if (replacementTextIsLink) { theme.applyLinkStyle(paint); } // NB, no specific text handling (no new lines, etc) size = (int) (paint.measureText(text, start, end) + .5F); } return size; }
theme.applyLinkStyle(paint);