Added settings to disable monospaced typeface

pull/153/head
M66B 6 years ago
parent 681e0c87ef
commit cd1763f52a

@ -248,6 +248,7 @@ In the display section of the advanced options you can enable or disable:
* *Show stars*: to hide stars (favorites)
* *Show message preview*: to show two lines of the message text
* *Show address details by default*: to collapse the addresses section by default
* *Use monospaced font for message text*: to change the typeface of the message text
* *Conversation action bar*: to disable the bottom navigation bar
* *Automatically show original message for known contacts*: to automatically show original messages for contacts on your device, please read [this FAQ](#user-content-faq35)
* *Automatically show images for known contacts*: to automatically show images for contacts on your device, please read [this FAQ](#user-content-faq35)

@ -141,6 +141,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean compact;
private boolean name_email;
private boolean subject_italic;
private boolean monospaced;
private int zoom;
private String sort;
private boolean duplicates;
@ -796,6 +797,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
btnHtml.setVisibility(!show_html ? View.INVISIBLE : View.GONE);
ibQuotes.setVisibility(!show_html ? View.INVISIBLE : View.GONE);
ibImages.setVisibility(!show_html ? View.INVISIBLE : View.GONE);
tvBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
tvBody.setVisibility(!show_html ? View.INVISIBLE : View.GONE);
vwBody.setVisibility(show_html ? View.INVISIBLE : View.GONE);
@ -2937,6 +2940,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.compact = compact;
this.name_email = prefs.getBoolean("name_email", !compact);
this.subject_italic = prefs.getBoolean("subject_italic", true);
this.monospaced = prefs.getBoolean("monospaced", true);
this.zoom = zoom;
this.sort = sort;
this.duplicates = duplicates;

@ -82,6 +82,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private SwitchCompat swFlags;
private SwitchCompat swPreview;
private SwitchCompat swAddresses;
private SwitchCompat swMonospaced;
private SwitchCompat swHtml;
private SwitchCompat swTracking;
private SwitchCompat swImages;
@ -112,7 +113,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
"addresses", "autohtml", "autoimages", "actionbar",
"addresses", "monospaced", "autohtml", "autoimages", "actionbar",
"pull", "swipenav", "autoexpand", "autoclose", "autonext",
"debug"
};
@ -121,7 +122,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
"enabled", "schedule_start", "schedule_end",
"metered", "download",
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
"addresses", "autohtml", "remove_tracking", "autoimages", "actionbar",
"addresses", "monospaced", "autohtml", "remove_tracking", "autoimages", "actionbar",
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove",
"autoresize", "sender", "autosend",
"notify_preview", "search_local", "light", "sound",
@ -158,6 +159,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swFlags = view.findViewById(R.id.swFlags);
swPreview = view.findViewById(R.id.swPreview);
swAddresses = view.findViewById(R.id.swAddresses);
swMonospaced = view.findViewById(R.id.swMonospaced);
swHtml = view.findViewById(R.id.swHtml);
swTracking = view.findViewById(R.id.swTracking);
swImages = view.findViewById(R.id.swImages);
@ -356,6 +358,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("monospaced", checked).apply();
}
});
swHtml.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -601,6 +610,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swFlags.setChecked(prefs.getBoolean("flags", true));
swPreview.setChecked(prefs.getBoolean("preview", false));
swAddresses.setChecked(prefs.getBoolean("addresses", true));
swMonospaced.setChecked(prefs.getBoolean("monospaced", true));
swHtml.setChecked(prefs.getBoolean("autohtml", false));
swTracking.setChecked(prefs.getBoolean("remove_tracking", true));
swImages.setChecked(prefs.getBoolean("autoimages", false));

@ -402,6 +402,18 @@
app:layout_constraintTop_toBottomOf="@id/tvPreviewHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swMonospaced"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_monospaced"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtml"
android:layout_width="match_parent"
@ -411,7 +423,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_html"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:layout_constraintTop_toBottomOf="@id/swMonospaced"
app:switchPadding="12dp" />
<TextView

@ -166,6 +166,7 @@
<string name="title_advanced_flags">Show stars (favorites)</string>
<string name="title_advanced_preview">Show message preview</string>
<string name="title_advanced_addresses">Show address details by default</string>
<string name="title_advanced_monospaced">Use monospaced font for message text</string>
<string name="title_advanced_html">Automatically show original message for known contacts</string>
<string name="title_advanced_tracking">Attempt to remove tracking from original messages</string>
<string name="title_advanced_images">Automatically show images for known contacts</string>

Loading…
Cancel
Save