Added autosave option

This commit is contained in:
M66B
2022-04-25 12:16:47 +02:00
parent 081d0a2d90
commit 2cb7f6a111
4 changed files with 43 additions and 15 deletions

View File

@@ -75,6 +75,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swSendPending;
private Button btnSound;
private SwitchCompat swAutoSave;
private Spinner spComposeFont;
private SwitchCompat swSeparateReply;
private SwitchCompat swExtendedReply;
@@ -107,7 +108,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
"alt_re", "alt_fwd",
"send_reminders", "send_chips", "send_delayed",
"attach_new", "answer_action", "send_pending", "sound_sent",
"compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"auto_save", "compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"signature_location", "signature_new", "signature_reply", "signature_reply_once", "signature_forward",
"discard_delete", "reply_move",
"auto_link", "plain_only", "format_flowed", "usenet_signature", "remove_signatures",
@@ -145,6 +146,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSendPending = view.findViewById(R.id.swSendPending);
btnSound = view.findViewById(R.id.btnSound);
swAutoSave = view.findViewById(R.id.swAutoSave);
spComposeFont = view.findViewById(R.id.spComposeFont);
swSeparateReply = view.findViewById(R.id.swSeparateReply);
swExtendedReply = view.findViewById(R.id.swExtendedReply);
@@ -359,6 +361,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swAutoSave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auto_save", checked).apply();
}
});
spComposeFont.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@@ -649,6 +658,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSendPending.setChecked(prefs.getBoolean("send_pending", true));
swAutoSave.setChecked(prefs.getBoolean("auto_save", true));
String compose_font = prefs.getString("compose_font", "");
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext());
for (int pos = 0; pos < fonts.size(); pos++) {