Added option to send plain text by default

pull/156/head
M66B 5 years ago
parent 86c11ad784
commit 56858282b9

@ -1952,6 +1952,9 @@ public class FragmentCompose extends FragmentBase {
File ics = (File) args.getSerializable("ics");
long answer = args.getLong("answer", -1);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean plain_only = prefs.getBoolean("plain_only", false);
Log.i("Load draft action=" + action + " id=" + id + " reference=" + reference);
EntityMessage draft;
@ -2102,6 +2105,9 @@ public class FragmentCompose extends FragmentBase {
EntityOperation.queue(context, ref, EntityOperation.SEEN, true);
}
if (plain_only)
draft.plain_only = true;
// Select identity matching from address
int icount = 0;
EntityIdentity first = null;

@ -39,6 +39,7 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swPrefixOnce;
private SwitchCompat swPlainOnly;
private SwitchCompat swAutoResize;
private Spinner spAutoResize;
private TextView tvAutoResize;
@ -46,7 +47,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Spinner spSendDelayed;
private final static String[] RESET_OPTIONS = new String[]{
"prefix_once", "autoresize", "resize", "autosend", "send_delayed"
"prefix_once", "plain_only", "autoresize", "resize", "autosend", "send_delayed"
};
@Override
@ -60,6 +61,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
// Get controls
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
swPlainOnly = view.findViewById(R.id.swPlainOnly);
swAutoResize = view.findViewById(R.id.swAutoResize);
spAutoResize = view.findViewById(R.id.spAutoResize);
tvAutoResize = view.findViewById(R.id.tvAutoResize);
@ -79,6 +81,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("plain_only", checked).apply();
}
});
swAutoResize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -166,6 +175,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", false));
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
swAutoResize.setChecked(prefs.getBoolean("autoresize", true));

@ -28,14 +28,25 @@
app:layout_constraintTop_toTopOf="parent"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPlainOnly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_plain_only"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoResize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_autoresize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
app:layout_constraintTop_toBottomOf="@id/swPlainOnly"
app:switchPadding="12dp" />
<Spinner
@ -61,6 +72,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_autosend"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAutoResize"

@ -172,6 +172,7 @@
<string name="title_advanced_sync_folders">Synchronize folder list</string>
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
<string name="title_advanced_plain_only">Send plain text only by default</string>
<string name="title_advanced_autoresize">Automatically resize attached and embedded images</string>
<string name="title_advanced_resize_pixels">&lt; %1$d pixels</string>
<string name="title_advanced_autosend">Confirm sending messages</string>

Loading…
Cancel
Save