Conditionally more

pull/174/head
M66B 5 years ago
parent c71a263bbc
commit 10ae87d7cd

@ -1753,7 +1753,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return document.html();
} else {
// Cleanup message
document = HtmlHelper.sanitize(context, body, show_images, true);
document = HtmlHelper.sanitize(context, body, show_images, true, true);
// Collapse quotes
if (!show_quotes) {

@ -238,8 +238,12 @@ public class HtmlHelper {
}
static Document sanitize(Context context, String html, boolean show_images, boolean autolink) {
return sanitize(context, html, show_images, autolink, false);
}
static Document sanitize(Context context, String html, boolean show_images, boolean autolink, boolean more) {
try {
return _sanitize(context, html, show_images, autolink);
return _sanitize(context, html, show_images, autolink, more);
} catch (Throwable ex) {
// OutOfMemoryError
Log.e(ex);
@ -251,7 +255,7 @@ public class HtmlHelper {
}
}
private static Document _sanitize(Context context, String html, boolean show_images, boolean autolink) {
private static Document _sanitize(Context context, String html, boolean show_images, boolean autolink, boolean more) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean text_color = prefs.getBoolean("text_color", true);
boolean display_hidden = prefs.getBoolean("display_hidden", false);
@ -339,12 +343,13 @@ public class HtmlHelper {
.appendElement("em")
.text(context.getString(R.string.title_too_large));
parsed.body()
.appendElement("p")
.appendElement("big")
.appendElement("a")
.attr("href", "full:")
.text(context.getString(R.string.title_show_full));
if (more)
parsed.body()
.appendElement("p")
.appendElement("big")
.appendElement("a")
.attr("href", "full:")
.text(context.getString(R.string.title_show_full));
}
Whitelist whitelist = Whitelist.relaxed()

Loading…
Cancel
Save