mirror of https://github.com/M66B/FairEmail.git
Added bottom posting
This commit is contained in:
parent
abccf43344
commit
e446dcedad
|
@ -3358,6 +3358,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
boolean sign_default = prefs.getBoolean("sign_default", false);
|
boolean sign_default = prefs.getBoolean("sign_default", false);
|
||||||
boolean encrypt_default = prefs.getBoolean("encrypt_default", false);
|
boolean encrypt_default = prefs.getBoolean("encrypt_default", false);
|
||||||
boolean receipt_default = prefs.getBoolean("receipt_default", false);
|
boolean receipt_default = prefs.getBoolean("receipt_default", false);
|
||||||
|
boolean write_below = prefs.getBoolean("write_below", false);
|
||||||
|
|
||||||
Log.i("Load draft action=" + action + " id=" + id + " reference=" + reference);
|
Log.i("Load draft action=" + action + " id=" + id + " reference=" + reference);
|
||||||
|
|
||||||
|
@ -3834,7 +3835,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
e.tagName(quote ? "blockquote" : "p");
|
e.tagName(quote ? "blockquote" : "p");
|
||||||
reply.appendChild(e);
|
reply.appendChild(e);
|
||||||
|
|
||||||
document.body().appendChild(reply);
|
if (write_below)
|
||||||
|
document.body().prependChild(reply);
|
||||||
|
else
|
||||||
|
document.body().appendChild(reply);
|
||||||
|
|
||||||
addSignature(context, document, data.draft, selected);
|
addSignature(context, document, data.draft, selected);
|
||||||
}
|
}
|
||||||
|
@ -4003,7 +4007,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
Document document = HtmlHelper.sanitizeCompose(context, doc.html(), true);
|
Document document = HtmlHelper.sanitizeCompose(context, doc.html(), true);
|
||||||
|
|
||||||
for (Element e : ref)
|
for (Element e : ref)
|
||||||
document.body().appendChild(e);
|
if (write_below)
|
||||||
|
document.body().prependChild(e);
|
||||||
|
else
|
||||||
|
document.body().appendChild(e);
|
||||||
|
|
||||||
EntityIdentity identity = null;
|
EntityIdentity identity = null;
|
||||||
if (data.draft.identity != null)
|
if (data.draft.identity != null)
|
||||||
|
@ -4451,12 +4458,16 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
// Get saved body
|
// Get saved body
|
||||||
Document d;
|
Document d;
|
||||||
|
boolean write_below = prefs.getBoolean("write_below", false);
|
||||||
if (extras != null && extras.containsKey("html")) {
|
if (extras != null && extras.containsKey("html")) {
|
||||||
// Save current revision
|
// Save current revision
|
||||||
Document c = JsoupEx.parse(body);
|
Document c = JsoupEx.parse(body);
|
||||||
|
|
||||||
for (Element e : ref)
|
for (Element e : ref)
|
||||||
c.body().appendChild(e);
|
if (write_below)
|
||||||
|
c.body().prependChild(e);
|
||||||
|
else
|
||||||
|
c.body().appendChild(e);
|
||||||
|
|
||||||
addSignature(context, c, draft, identity);
|
addSignature(context, c, draft, identity);
|
||||||
|
|
||||||
|
@ -4467,7 +4478,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
d = HtmlHelper.sanitizeCompose(context, body, true);
|
d = HtmlHelper.sanitizeCompose(context, body, true);
|
||||||
|
|
||||||
for (Element e : ref)
|
for (Element e : ref)
|
||||||
d.body().appendChild(e);
|
if (write_below)
|
||||||
|
d.body().prependChild(e);
|
||||||
|
else
|
||||||
|
d.body().appendChild(e);
|
||||||
|
|
||||||
addSignature(context, d, draft, identity);
|
addSignature(context, d, draft, identity);
|
||||||
}
|
}
|
||||||
|
@ -4977,6 +4991,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
int signature_location = prefs.getInt("signature_location", 1);
|
int signature_location = prefs.getInt("signature_location", 1);
|
||||||
boolean usenet = prefs.getBoolean("usenet_signature", false);
|
boolean usenet = prefs.getBoolean("usenet_signature", false);
|
||||||
|
boolean write_below = prefs.getBoolean("write_below", false);
|
||||||
|
|
||||||
Element div = document.createElement("div");
|
Element div = document.createElement("div");
|
||||||
div.attr("fairemail", "signature");
|
div.attr("fairemail", "signature");
|
||||||
|
@ -4992,12 +5007,15 @@ public class FragmentCompose extends FragmentBase {
|
||||||
div.append(identity.signature);
|
div.append(identity.signature);
|
||||||
|
|
||||||
Elements ref = document.select("div[fairemail=reference]");
|
Elements ref = document.select("div[fairemail=reference]");
|
||||||
if (signature_location == 0)
|
if (signature_location == 0) // top
|
||||||
document.body().prependChild(div);
|
document.body().prependChild(div);
|
||||||
else if (ref.size() == 0 || signature_location == 2)
|
else if (ref.size() == 0 || signature_location == 2) // bottom
|
||||||
document.body().appendChild(div);
|
document.body().appendChild(div);
|
||||||
else if (signature_location == 1)
|
else if (signature_location == 1) // between
|
||||||
ref.first().before(div);
|
if (write_below)
|
||||||
|
ref.last().after(div);
|
||||||
|
else
|
||||||
|
ref.first().before(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDraft(final EntityMessage draft, final boolean scroll) {
|
private void showDraft(final EntityMessage draft, final boolean scroll) {
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
private SwitchCompat swPrefixOnce;
|
private SwitchCompat swPrefixOnce;
|
||||||
private SwitchCompat swSeparateReply;
|
private SwitchCompat swSeparateReply;
|
||||||
private SwitchCompat swExtendedReply;
|
private SwitchCompat swExtendedReply;
|
||||||
|
private SwitchCompat swWriteBelow;
|
||||||
private SwitchCompat swQuoteReply;
|
private SwitchCompat swQuoteReply;
|
||||||
private SwitchCompat swQuoteLimit;
|
private SwitchCompat swQuoteLimit;
|
||||||
private SwitchCompat swResizeReply;
|
private SwitchCompat swResizeReply;
|
||||||
|
@ -73,7 +74,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
private final static String[] RESET_OPTIONS = new String[]{
|
private final static String[] RESET_OPTIONS = new String[]{
|
||||||
"keyboard", "suggest_sent", "suggested_received", "suggest_frequently",
|
"keyboard", "suggest_sent", "suggested_received", "suggest_frequently",
|
||||||
"send_reminders", "send_delayed",
|
"send_reminders", "send_delayed",
|
||||||
"compose_font", "prefix_once", "separate_reply", "extended_reply", "quote_reply", "quote_limit", "resize_reply",
|
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
||||||
"signature_location", "signature_reply", "signature_forward",
|
"signature_location", "signature_reply", "signature_forward",
|
||||||
"discard_delete",
|
"discard_delete",
|
||||||
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
||||||
|
@ -102,6 +103,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
||||||
swSeparateReply = view.findViewById(R.id.swSeparateReply);
|
swSeparateReply = view.findViewById(R.id.swSeparateReply);
|
||||||
swExtendedReply = view.findViewById(R.id.swExtendedReply);
|
swExtendedReply = view.findViewById(R.id.swExtendedReply);
|
||||||
|
swWriteBelow = view.findViewById(R.id.swWriteBelow);
|
||||||
swQuoteReply = view.findViewById(R.id.swQuoteReply);
|
swQuoteReply = view.findViewById(R.id.swQuoteReply);
|
||||||
swQuoteLimit = view.findViewById(R.id.swQuoteLimit);
|
swQuoteLimit = view.findViewById(R.id.swQuoteLimit);
|
||||||
swResizeReply = view.findViewById(R.id.swResizeReply);
|
swResizeReply = view.findViewById(R.id.swResizeReply);
|
||||||
|
@ -228,6 +230,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
swWriteBelow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
prefs.edit().putBoolean("write_below", checked).apply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
swQuoteReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swQuoteReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
@ -409,6 +418,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
||||||
swSeparateReply.setChecked(prefs.getBoolean("separate_reply", false));
|
swSeparateReply.setChecked(prefs.getBoolean("separate_reply", false));
|
||||||
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
|
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
|
||||||
|
swWriteBelow.setChecked(prefs.getBoolean("write_below", false));
|
||||||
swQuoteReply.setChecked(prefs.getBoolean("quote_reply", true));
|
swQuoteReply.setChecked(prefs.getBoolean("quote_reply", true));
|
||||||
swQuoteLimit.setChecked(prefs.getBoolean("quote_limit", true));
|
swQuoteLimit.setChecked(prefs.getBoolean("quote_limit", true));
|
||||||
swResizeReply.setChecked(prefs.getBoolean("resize_reply", true));
|
swResizeReply.setChecked(prefs.getBoolean("resize_reply", true));
|
||||||
|
|
|
@ -225,6 +225,18 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/swSeparateReply"
|
app:layout_constraintTop_toBottomOf="@id/swSeparateReply"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swWriteBelow"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:checked="true"
|
||||||
|
android:text="@string/title_advanced_write_below"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/swExtendedReply"
|
||||||
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swQuoteReply"
|
android:id="@+id/swQuoteReply"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -234,7 +246,7 @@
|
||||||
android:text="@string/title_advanced_quote_reply"
|
android:text="@string/title_advanced_quote_reply"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/swExtendedReply"
|
app:layout_constraintTop_toBottomOf="@id/swWriteBelow"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
|
Loading…
Reference in New Issue