mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 16:43:26 +02:00
Optional: use monospaced font for plain text messages
This commit is contained in:
@@ -45,6 +45,7 @@ import android.graphics.Color;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.net.ConnectivityManager;
|
||||
@@ -273,6 +274,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
private int compose_color;
|
||||
private String compose_font;
|
||||
private boolean compose_monospaced;
|
||||
private String display_font;
|
||||
private boolean dsn = true;
|
||||
private Integer encrypt = null;
|
||||
@@ -337,6 +339,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
compose_color = prefs.getInt("compose_color", Color.TRANSPARENT);
|
||||
compose_font = prefs.getString("compose_font", "");
|
||||
compose_monospaced = prefs.getBoolean("compose_monospaced", false);
|
||||
display_font = prefs.getString("display_font", "");
|
||||
style = prefs.getBoolean("compose_style", false);
|
||||
media = prefs.getBoolean("compose_media", true);
|
||||
@@ -5953,6 +5956,16 @@ public class FragmentCompose extends FragmentBase {
|
||||
draft.isPlainOnly() && !plain_only
|
||||
? View.VISIBLE : View.GONE);
|
||||
|
||||
if (compose_monospaced) {
|
||||
if (draft.isPlainOnly())
|
||||
etBody.setTypeface(Typeface.MONOSPACE);
|
||||
else {
|
||||
Typeface tf = etBody.getTypeface();
|
||||
if (tf == Typeface.MONOSPACE)
|
||||
etBody.setTypeface(StyleHelper.getTypeface(compose_font, etBody.getContext()));
|
||||
}
|
||||
}
|
||||
|
||||
tvNoInternet.setTag(draft.content);
|
||||
checkInternet();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
|
||||
private ViewButtonColor btnComposeColor;
|
||||
private Spinner spComposeFont;
|
||||
private SwitchCompat swComposeMonospaced;
|
||||
private SwitchCompat swPrefixOnce;
|
||||
private SwitchCompat swPrefixCount;
|
||||
private RadioGroup rgRe;
|
||||
@@ -124,7 +125,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
"send_delayed",
|
||||
"answer_single", "answer_action",
|
||||
"sound_sent",
|
||||
"compose_color", "compose_font",
|
||||
"compose_color", "compose_font", "compose_monospaced",
|
||||
"prefix_once", "prefix_count", "alt_re", "alt_fwd",
|
||||
"separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
||||
"signature_location", "signature_new", "signature_reply", "signature_reply_once", "signature_forward",
|
||||
@@ -167,6 +168,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
|
||||
btnComposeColor = view.findViewById(R.id.btnComposeColor);
|
||||
spComposeFont = view.findViewById(R.id.spComposeFont);
|
||||
swComposeMonospaced = view.findViewById(R.id.swComposeMonospaced);
|
||||
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
||||
swPrefixCount = view.findViewById(R.id.swPrefixCount);
|
||||
rgRe = view.findViewById(R.id.rgRe);
|
||||
@@ -435,6 +437,14 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
}
|
||||
});
|
||||
|
||||
swComposeMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("compose_monospaced", checked).apply();
|
||||
swPrefixCount.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -770,6 +780,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
}
|
||||
}
|
||||
|
||||
swComposeMonospaced.setChecked(prefs.getBoolean("compose_monospaced", false));
|
||||
|
||||
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
||||
swPrefixCount.setChecked(prefs.getBoolean("prefix_count", false));
|
||||
swPrefixCount.setEnabled(swPrefixOnce.isChecked());
|
||||
|
||||
Reference in New Issue
Block a user