mirror of https://github.com/M66B/FairEmail.git
Optional: use monospaced font for plain text messages
This commit is contained in:
parent
fc1d1f8c3f
commit
8d90b2d471
|
@ -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());
|
||||
|
|
|
@ -457,6 +457,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvComposeFont" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swComposeMonospaced"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_compose_monospaced"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spComposeFont"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swPrefixOnce"
|
||||
android:layout_width="0dp"
|
||||
|
@ -466,7 +478,7 @@
|
|||
android:text="@string/title_advanced_prefix_once"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spComposeFont"
|
||||
app:layout_constraintTop_toBottomOf="@id/swComposeMonospaced"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -452,6 +452,7 @@
|
|||
<string name="title_advanced_auto_save_dot">Automatically save a draft after every sentence</string>
|
||||
<string name="title_advanced_compose_color">Default text color</string>
|
||||
<string name="title_advanced_compose_font">Default font</string>
|
||||
<string name="title_advanced_compose_monospaced">Use monospaced font for plain text messages</string>
|
||||
<string name="title_advanced_auto_identity">Automatically select identities for new messages</string>
|
||||
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
|
||||
<string name="title_advanced_prefix_count">Add count to reply prefix</string>
|
||||
|
|
Loading…
Reference in New Issue