Added option to separate replies with a line

pull/187/head
M66B 4 years ago
parent da88b1f7d6
commit a7d57aadf1

@ -2072,7 +2072,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
div.appendChild(h);
Element p = embedded.getReplyHeader(context, document, true);
Element p = embedded.getReplyHeader(context, document, false, true);
div.appendChild(p);
div.appendChild(d.body().tagName("p"));

@ -263,7 +263,7 @@ public class EntityMessage implements Serializable {
return false;
}
Element getReplyHeader(Context context, Document document, boolean extended) {
Element getReplyHeader(Context context, Document document, boolean separate, boolean extended) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean language_detection = prefs.getBoolean("language_detection", false);
String l = (language_detection ? language : null);
@ -315,7 +315,13 @@ public class EntityMessage implements Serializable {
} else
p.text(DF.format(new Date(received)) + " " + MessageHelper.formatAddresses(from) + ":");
return p;
if (separate) {
Element div = document.createElement("div");
div.appendElement("hr");
div.appendChild(p);
return div;
} else
return p;
}
String getNotificationChannelId() {

@ -495,6 +495,7 @@ public class EntityRule {
reply.id = db.message().insertMessage(reply);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean separate_reply = prefs.getBoolean("separate_reply", false);
boolean extended_reply = prefs.getBoolean("extended_reply", false);
boolean quote_reply = prefs.getBoolean("quote_reply", true);
boolean quote = (quote_reply && TextUtils.isEmpty(to));
@ -504,7 +505,7 @@ public class EntityRule {
Element div = msg.createElement("div");
Element p = message.getReplyHeader(context, msg, extended_reply);
Element p = message.getReplyHeader(context, msg, separate_reply, extended_reply);
div.appendChild(p);
Document answering = JsoupEx.parse(message.getFile(context));

@ -3712,8 +3712,9 @@ public class FragmentCompose extends FragmentBase {
reply.appendElement("br");
// Build reply header
boolean separate_reply = prefs.getBoolean("separate_reply", false);
boolean extended_reply = prefs.getBoolean("extended_reply", false);
Element p = ref.getReplyHeader(context, document, extended_reply);
Element p = ref.getReplyHeader(context, document, separate_reply, extended_reply);
reply.appendChild(p);
Document d;

@ -52,6 +52,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Spinner spComposeFont;
private SwitchCompat swPrefixOnce;
private SwitchCompat swSeparateReply;
private SwitchCompat swExtendedReply;
private SwitchCompat swQuoteReply;
private SwitchCompat swResizeReply;
@ -71,7 +72,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", "prefix_once", "extended_reply", "quote_reply", "resize_reply",
"compose_font", "prefix_once", "separate_reply", "extended_reply", "quote_reply", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
"discard_delete",
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
@ -98,6 +99,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
spComposeFont = view.findViewById(R.id.spComposeFont);
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
swSeparateReply = view.findViewById(R.id.swSeparateReply);
swExtendedReply = view.findViewById(R.id.swExtendedReply);
swQuoteReply = view.findViewById(R.id.swQuoteReply);
swResizeReply = view.findViewById(R.id.swResizeReply);
@ -203,6 +205,20 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swSeparateReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("separate_reply", checked).apply();
}
});
swSeparateReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("separate_reply", checked).apply();
}
});
swExtendedReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -382,6 +398,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
swSeparateReply.setChecked(prefs.getBoolean("separate_reply", false));
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
swQuoteReply.setChecked(prefs.getBoolean("quote_reply", true));
swResizeReply.setChecked(prefs.getBoolean("resize_reply", true));

@ -203,6 +203,17 @@
app:layout_constraintTop_toBottomOf="@id/spComposeFont"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSeparateReply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_separate_reply"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swExtendedReply"
android:layout_width="0dp"
@ -211,7 +222,7 @@
android:text="@string/title_advanced_extended_reply"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
app:layout_constraintTop_toBottomOf="@id/swSeparateReply"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -305,6 +305,7 @@
<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_prefix_once">Prefix subject only once on replying or forwarding</string>
<string name="title_advanced_separate_reply">Insert a horizontal line before a reply/forward header</string>
<string name="title_advanced_extended_reply">Use extended reply/forward header</string>
<string name="title_advanced_quote_reply">Quote replied text</string>
<string name="title_advanced_resize_reply">Resize images in replied text</string>

Loading…
Cancel
Save