sheets =
HtmlHelper.parseStyles(d.head().select("style"));
for (Element element : d.select("*")) {
String computed = HtmlHelper.processStyles(context,
element.tagName(),
element.className(),
element.attr("style"),
sheets);
if (!TextUtils.isEmpty(computed))
element.attr("x-computed", computed);
}
d = HtmlHelper.sanitizeView(context, d, false);
d.outputSettings().prettyPrint(true).outline(true).indentAmount(1);
}
if (selected == null)
return d.html();
else
return d.body().html();
}
@Override
protected void onExecuted(Bundle args, String code) {
getSupportActionBar().setSubtitle(args.getString("subject"));
String clazz = "language-html";
if (lines)
clazz += " line-numbers";
String html = "" +
"" +
"" +
" " +
" " +
(links ? " " : "") +
" " +
"" +
"" +
" " +
(links ? " " : "") +
" " + Html.escapeHtml(code) + "
" +
"" +
"";
wvCode.loadDataWithBaseURL("file:///android_asset/", html, "text/html", StandardCharsets.UTF_8.name(), null);
grpReady.setVisibility(View.VISIBLE);
}
@Override
protected void onException(Bundle args, @NonNull Throwable ex) {
Log.unexpectedError(getSupportFragmentManager(), ex, false);
}
}.execute(this, args, "view:text");
}
}