Refactoring

pull/199/head
M66B 3 years ago
parent feb3939244
commit 63a49a3fe2

@ -1969,14 +1969,14 @@ public class HtmlHelper {
static Spanned highlightHeaders(Context context, String headers) { static Spanned highlightHeaders(Context context, String headers) {
SpannableStringBuilder ssb = new SpannableStringBuilder(headers); SpannableStringBuilder ssb = new SpannableStringBuilder(headers);
int colorAccent = Helper.resolveColor(context, android.R.attr.textColorLink); int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink);
int index = 0; int index = 0;
for (String line : headers.split("\n")) { for (String line : headers.split("\n")) {
if (line.length() > 0 && !Character.isWhitespace(line.charAt(0))) { if (line.length() > 0 && !Character.isWhitespace(line.charAt(0))) {
int colon = line.indexOf(':'); int colon = line.indexOf(':');
if (colon > 0) if (colon > 0)
ssb.setSpan(new ForegroundColorSpan(colorAccent), index, index + colon, 0); ssb.setSpan(new ForegroundColorSpan(textColorLink), index, index + colon, 0);
} }
index += line.length() + 1; index += line.length() + 1;
} }
@ -2018,7 +2018,7 @@ public class HtmlHelper {
s = ssb.length(); s = ssb.length();
ssb.append(w[j]); ssb.append(w[j]);
if (words.contains(w[j].toLowerCase(Locale.ROOT))) if (words.contains(w[j].toLowerCase(Locale.ROOT)))
ssb.setSpan(new ForegroundColorSpan(colorAccent), s, ssb.length(), 0); ssb.setSpan(new ForegroundColorSpan(textColorLink), s, ssb.length(), 0);
j++; j++;
} }
ssb.append("\n\n"); ssb.append("\n\n");

Loading…
Cancel
Save