pull/184/head
M66B 4 years ago
parent 4727598373
commit 5156aeba85

@ -51,7 +51,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Spinner spSendDelayed;
private Spinner spComposeFont;
private SwitchCompat swAutoList;
private SwitchCompat swPrefixOnce;
private SwitchCompat swExtendedReply;
private SwitchCompat swQuoteReply;
@ -72,7 +71,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private final static String[] RESET_OPTIONS = new String[]{
"keyboard", "suggest_sent", "suggested_received", "suggest_frequently",
"send_reminders", "send_delayed",
"compose_font", "autolist", "prefix_once", "extended_reply", "quote_reply", "resize_reply",
"compose_font", "prefix_once", "extended_reply", "quote_reply", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
"discard_delete",
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
@ -98,7 +97,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
spSendDelayed = view.findViewById(R.id.spSendDelayed);
spComposeFont = view.findViewById(R.id.spComposeFont);
swAutoList = view.findViewById(R.id.swAutoList);
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
swExtendedReply = view.findViewById(R.id.swExtendedReply);
swQuoteReply = view.findViewById(R.id.swQuoteReply);
@ -198,13 +196,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swAutoList.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autolist", checked).apply();
}
});
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -390,7 +381,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
break;
}
swAutoList.setChecked(prefs.getBoolean("autolist", true));
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
swQuoteReply.setChecked(prefs.getBoolean("quote_reply", true));

@ -1688,72 +1688,6 @@ public class HtmlHelper {
return ssb.toString();
}
static void convertLists(Document document) {
if (BuildConfig.DEBUG)
return;
for (Element span : document.select("span")) {
// Skip signature and referenced message
boolean body = true;
Element parent = span.parent();
while (parent != null) {
if ("div".equals(parent.tagName()) &&
!TextUtils.isEmpty(parent.attr("fairemail"))) {
body = false;
break;
}
parent = parent.parent();
}
if (!body)
continue;
Element list = null;
for (int i = 0; i < span.childNodeSize(); i++) {
boolean item = false;
Node node = span.childNode(i);
if (node instanceof TextNode) {
String text = ((TextNode) node).text().trim();
Node next = node.nextSibling();
if ((/*text.startsWith("* ") ||*/ text.startsWith("- ")) &&
(next == null || "br".equals(next.nodeName()))) {
item = true;
String type = (text.startsWith("* ") ? "ul" : "ol");
Element li = document.createElement("li");
li.text(text.substring(2));
if (list == null || !list.tagName().equals(type)) {
Node before = node.previousSibling();
if (before != null && "br".equals(before.nodeName())) {
before.remove();
i--;
}
list = document.createElement(type);
list.appendChild(li);
node.replaceWith(list);
} else {
list.appendChild(li);
node.remove();
i--;
}
if (next != null)
next.remove();
}
} else {
if (list != null && "br".equals(node.nodeName())) {
node.remove();
i--;
}
}
if (!item)
list = null;
}
}
}
static Spanned highlightHeaders(Context context, String headers) {
int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
SpannableStringBuilder ssb = new SpannableStringBuilder(headers);

@ -548,7 +548,6 @@ public class MessageHelper {
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autolist = prefs.getBoolean("autolist", true);
boolean format_flowed = prefs.getBoolean("format_flowed", false);
boolean monospaced = prefs.getBoolean("monospaced", false);
String compose_font = prefs.getString("compose_font", monospaced ? "monospace" : "sans-serif");
@ -558,9 +557,6 @@ public class MessageHelper {
// When sending message
if (identity != null) {
if (autolist)
HtmlHelper.convertLists(document);
if (send) {
for (Element child : document.body().children())
if (!TextUtils.isEmpty(child.text()) &&

@ -191,18 +191,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvComposeFont" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoList"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_auto_list"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spComposeFont"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPrefixOnce"
android:layout_width="0dp"
@ -212,7 +200,7 @@
android:text="@string/title_advanced_prefix_once"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoList"
app:layout_constraintTop_toBottomOf="@id/spComposeFont"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -296,7 +296,6 @@
<string name="title_advanced_suggest_received">Suggest addresses found in received messages</string>
<string name="title_advanced_suggest_frequently">Sort suggested addresses on frequency of use</string>
<string name="title_advanced_compose_font">Default font</string>
<string name="title_advanced_auto_list">Automatically create lists</string>
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
<string name="title_advanced_extended_reply">Use extended reply/forward header</string>
<string name="title_advanced_quote_reply">Quote replied text</string>

Loading…
Cancel
Save