Removed custom rendering as experiment

pull/178/head
M66B 5 years ago
parent 86e589a904
commit 602621f36e

@ -2540,7 +2540,7 @@ Reformatting and displaying such messages will take too long. You can try to use
<a name="faq125"></a> <a name="faq125"></a>
**(125) What are the current experimental features?** **(125) What are the current experimental features?**
* Custom rendering of reformatted messages * ~~Custom rendering of reformatted messages~~
<br /> <br />

@ -245,7 +245,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean authentication; private boolean authentication;
private boolean language_detection; private boolean language_detection;
private static boolean debug; private static boolean debug;
private boolean experiments;
private boolean gotoTop = false; private boolean gotoTop = false;
private boolean firstClick = false; private boolean firstClick = false;
@ -1913,17 +1912,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
quote.html("&#8230;"); quote.html("&#8230;");
} }
// Add debug info
if (debug && !experiments) {
document.outputSettings().prettyPrint(true).outline(true).indentAmount(1);
String[] lines = document.html().split("\\r?\\n");
for (int i = 0; i < lines.length; i++)
lines[i] = Html.escapeHtml(lines[i]);
Element pre = document.createElement("pre");
pre.html(TextUtils.join("<br>", lines));
document.body().appendChild(pre);
}
// Draw images // Draw images
Spanned spanned = HtmlHelper.fromDocument(context, document, new Html.ImageGetter() { Spanned spanned = HtmlHelper.fromDocument(context, document, new Html.ImageGetter() {
@Override @Override
@ -4647,7 +4635,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.language_detection = prefs.getBoolean("language_detection", false); this.language_detection = prefs.getBoolean("language_detection", false);
debug = prefs.getBoolean("debug", false); debug = prefs.getBoolean("debug", false);
this.experiments = prefs.getBoolean("experiments", false);
DiffUtil.ItemCallback<TupleMessageEx> callback = new DiffUtil.ItemCallback<TupleMessageEx>() { DiffUtil.ItemCallback<TupleMessageEx> callback = new DiffUtil.ItemCallback<TupleMessageEx>() {
@Override @Override

@ -272,6 +272,8 @@ public class ApplicationEx extends Application {
} else if (version < 1121) { } else if (version < 1121) {
if (!Helper.isPlayStoreInstall()) if (!Helper.isPlayStoreInstall())
editor.putBoolean("experiments", true); editor.putBoolean("experiments", true);
} else if (version < 1124) {
editor.remove("experiments");
} }
if (version < BuildConfig.VERSION_CODE) if (version < BuildConfig.VERSION_CODE)

@ -314,8 +314,6 @@ public class HtmlHelper {
boolean display_hidden = prefs.getBoolean("display_hidden", false); boolean display_hidden = prefs.getBoolean("display_hidden", false);
boolean disable_tracking = prefs.getBoolean("disable_tracking", true); boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
boolean parse_classes = prefs.getBoolean("parse_classes", false); boolean parse_classes = prefs.getBoolean("parse_classes", false);
boolean experiments = prefs.getBoolean("experiments", false);
// https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css // https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css
@ -754,13 +752,13 @@ public class HtmlHelper {
// Subscript/Superscript // Subscript/Superscript
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
if (!experiments || !view) if (!view)
for (Element subp : document.select("sub,sup")) for (Element subp : document.select("sub,sup"))
subp.tagName("small"); subp.tagName("small");
// Lists // Lists
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
if (!experiments || !view) { if (!view) {
for (Element li : document.select("li")) { for (Element li : document.select("li")) {
li.tagName("span"); li.tagName("span");
Element parent = li.parent(); Element parent = li.parent();
@ -1779,14 +1777,12 @@ public class HtmlHelper {
static Spanned fromDocument(Context context, @NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) { static Spanned fromDocument(Context context, @NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean experiments = prefs.getBoolean("experiments", false);
boolean debug = prefs.getBoolean("debug", false); boolean debug = prefs.getBoolean("debug", false);
int colorAccent = Helper.resolveColor(context, R.attr.colorAccent); int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
int dp3 = Helper.dp2pixels(context, 3); int dp3 = Helper.dp2pixels(context, 3);
int dp6 = Helper.dp2pixels(context, 6); int dp6 = Helper.dp2pixels(context, 6);
int dp24 = Helper.dp2pixels(context, 24); int dp24 = Helper.dp2pixels(context, 24);
if (experiments) {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
NodeTraversor.traverse(new NodeVisitor() { NodeTraversor.traverse(new NodeVisitor() {
private int pre = 0; private int pre = 0;
@ -2066,8 +2062,6 @@ public class HtmlHelper {
ssb.insert(i, "|"); ssb.insert(i, "|");
return reverseSpans(ssb); return reverseSpans(ssb);
} else
return fromHtml(document.html(), imageGetter, null);
} }
static Spanned fromHtml(@NonNull String html) { static Spanned fromHtml(@NonNull String html) {

Loading…
Cancel
Save