use of me.ccrama.redditslide.Views.CustomQuoteSpan in project Slide by ccrama.
the class SpoilerRobotoTextView method replaceQuoteSpans.
/**
* Replaces the blue line produced by <blockquote>s with something more visible
*
* @param spannable parsed comment text #fromHtml
*/
private void replaceQuoteSpans(Spannable spannable) {
QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);
for (QuoteSpan quoteSpan : quoteSpans) {
final int start = spannable.getSpanStart(quoteSpan);
final int end = spannable.getSpanEnd(quoteSpan);
final int flags = spannable.getSpanFlags(quoteSpan);
spannable.removeSpan(quoteSpan);
// If the theme is Light or Sepia, use a darker blue; otherwise, use a lighter blue
final int barColor = ContextCompat.getColor(getContext(), SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5 ? R.color.md_blue_600 : R.color.md_blue_400);
final int BAR_WIDTH = 4;
final int GAP = 5;
spannable.setSpan(new CustomQuoteSpan(// bar color
barColor, // bar width
BAR_WIDTH, // bar + text gap
GAP), start, end, flags);
}
}
Aggregations