Added text separator option

pull/185/head
M66B 5 years ago
parent f14c2aa36a
commit 7267e33a0f

@ -85,7 +85,8 @@ public class FragmentOptions extends FragmentBase {
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"message_zoom", "overview_mode", "addresses", "attachments_alt", "thumbnails",
"contrast", "monospaced", "text_color", "text_size", "text_font", "text_align",
"contrast", "monospaced",
"text_color", "text_size", "text_font", "text_align", "text_separators",
"inline_images", "collapse_quotes", "seekbar", "actionbar", "actionbar_color", "navbar_colorize",
"autoscroll", "swipenav", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
"language_detection",

@ -117,6 +117,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swTextSize;
private SwitchCompat swTextFont;
private SwitchCompat swTextAlign;
private SwitchCompat swTextSeparators;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swImagesInline;
private SwitchCompat swAttachmentsAlt;
@ -135,7 +136,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"keywords_header", "labels_header", "flags", "flags_background",
"preview", "preview_italic", "preview_lines",
"addresses",
"message_zoom", "overview_mode", "contrast", "monospaced", "text_color", "text_size", "text_font", "text_align",
"message_zoom", "overview_mode", "contrast", "monospaced",
"text_color", "text_size", "text_font", "text_align", "text_separators",
"inline_images", "collapse_quotes", "attachments_alt", "thumbnails",
"parse_classes", "authentication"
};
@ -207,6 +209,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextSize = view.findViewById(R.id.swTextSize);
swTextFont = view.findViewById(R.id.swTextFont);
swTextAlign = view.findViewById(R.id.swTextAlign);
swTextSeparators = view.findViewById(R.id.swTextSeparators);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesInline = view.findViewById(R.id.swImagesInline);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
@ -693,6 +696,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swTextSeparators.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("text_separators", checked).apply();
}
});
swCollapseQuotes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -889,6 +899,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextSize.setChecked(prefs.getBoolean("text_size", true));
swTextFont.setChecked(prefs.getBoolean("text_font", true));
swTextAlign.setChecked(prefs.getBoolean("text_align", true));
swTextSeparators.setChecked(prefs.getBoolean("text_separators", true));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));

@ -329,7 +329,7 @@ public class HtmlHelper {
boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
boolean parse_classes = prefs.getBoolean("parse_classes", false);
boolean inline_images = prefs.getBoolean("inline_images", false);
boolean experiments = prefs.getBoolean("experiments", false);
boolean text_separators = prefs.getBoolean("text_separators", true);
int textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
@ -795,7 +795,7 @@ public class HtmlHelper {
if (hasVisibleContent(row.childNodes())) {
Element next = row.nextElementSibling();
if (next != null && "tr".equals(next.tagName()))
if (experiments)
if (text_separators)
row.appendElement("hr")
.attr("x-dashed", "true");
else
@ -1816,7 +1816,7 @@ public class HtmlHelper {
@Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean debug = prefs.getBoolean("debug", false);
boolean experiments = prefs.getBoolean("experiments", false);
boolean text_separators = prefs.getBoolean("text_separators", true);
final int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
final int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
@ -2107,7 +2107,7 @@ public class HtmlHelper {
newline(ssb.length());
break;
case "hr":
if (experiments) {
if (text_separators) {
int lhr = 0;
for (LineSpan ls : ssb.getSpans(0, ssb.length(), LineSpan.class)) {
int end = ssb.getSpanEnd(ls);

@ -950,6 +950,18 @@
app:layout_constraintTop_toBottomOf="@id/swTextFont"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTextSeparators"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:enabled="true"
android:text="@string/title_advanced_text_separators"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTextAlign"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseQuotes"
android:layout_width="0dp"
@ -958,7 +970,7 @@
android:text="@string/title_advanced_collapse_quotes"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTextAlign"
app:layout_constraintTop_toBottomOf="@id/swTextSeparators"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -381,6 +381,7 @@
<string name="title_advanced_text_size">Use text sizes</string>
<string name="title_advanced_text_font">Use fonts</string>
<string name="title_advanced_text_align">Use text alignment</string>
<string name="title_advanced_text_separators">Use separator lines</string>
<string name="title_advanced_collapse_quotes">Collapse quoted text</string>
<string name="title_advanced_images_inline">Automatically show inline images</string>
<string name="title_advanced_seekbar">Show relative conversation position with a dot</string>

Loading…
Cancel
Save