mirror of https://github.com/M66B/FairEmail.git
Added setting for send / auto link
This commit is contained in:
parent
d2cd2faf29
commit
cce1875c0f
|
@ -65,6 +65,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private Button btnEditSignature;
|
||||
private SwitchCompat swDiscardDelete;
|
||||
|
||||
private SwitchCompat swAutoLink;
|
||||
private SwitchCompat swPlainOnly;
|
||||
private SwitchCompat swFormatFlowed;
|
||||
private SwitchCompat swUsenetSignature;
|
||||
|
@ -80,7 +81,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
||||
"signature_location", "signature_reply", "signature_forward",
|
||||
"discard_delete",
|
||||
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
||||
"auto_link", "plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
||||
"receipt_default", "receipt_type", "lookup_mx"
|
||||
};
|
||||
|
||||
|
@ -118,6 +119,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
btnEditSignature = view.findViewById(R.id.btnEditSignature);
|
||||
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
|
||||
|
||||
swAutoLink = view.findViewById(R.id.swAutoLink);
|
||||
swPlainOnly = view.findViewById(R.id.swPlainOnly);
|
||||
swFormatFlowed = view.findViewById(R.id.swFormatFlowed);
|
||||
swUsenetSignature = view.findViewById(R.id.swUsenetSignature);
|
||||
|
@ -319,6 +321,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swAutoLink.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("auto_link", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -449,6 +458,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
swSignatureForward.setChecked(prefs.getBoolean("signature_forward", true));
|
||||
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
|
||||
|
||||
swAutoLink.setChecked(prefs.getBoolean("auto_link", false));
|
||||
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
|
||||
swFormatFlowed.setChecked(prefs.getBoolean("format_flowed", false));
|
||||
swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false));
|
||||
|
|
|
@ -617,13 +617,15 @@ public class MessageHelper {
|
|||
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");
|
||||
boolean auto_link = prefs.getBoolean("auto_link", false);
|
||||
|
||||
// Build html body
|
||||
Document document = JsoupEx.parse(message.getFile(context));
|
||||
|
||||
// When sending message
|
||||
if (identity != null && send) {
|
||||
HtmlHelper.autoLink(document);
|
||||
if (auto_link)
|
||||
HtmlHelper.autoLink(document);
|
||||
|
||||
for (Element child : document.body().children())
|
||||
if (!TextUtils.isEmpty(child.text()) &&
|
||||
|
|
|
@ -402,6 +402,17 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/swDiscardDelete" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoLink"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_auto_link"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swPlainOnly"
|
||||
android:layout_width="0dp"
|
||||
|
@ -410,7 +421,7 @@
|
|||
android:text="@string/title_advanced_plain_only"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoLink"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -324,6 +324,7 @@
|
|||
<string name="title_advanced_signature_location">Signature position</string>
|
||||
<string name="title_advanced_signature_reply">Use signature when replying</string>
|
||||
<string name="title_advanced_signature_forward">Use signature when forwarding</string>
|
||||
<string name="title_advanced_auto_link">Automatically create links</string>
|
||||
<string name="title_advanced_plain_only">Send plain text only by default</string>
|
||||
<string name="title_advanced_flow">\'format flowed\' for plain text</string>
|
||||
<string name="title_advanced_receipt">When requesting a receipt</string>
|
||||
|
|
Loading…
Reference in New Issue