Added send retry max setting

This commit is contained in:
M66B
2024-03-07 19:58:56 +01:00
parent b0ec6e7489
commit f98dc7a60c
4 changed files with 86 additions and 3 deletions

View File

@@ -127,6 +127,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swLookupMx;
private SwitchCompat swReplyMove;
private SwitchCompat swReplyMoveInbox;
private EditText etSendRetryMax;
private final static List<String> RESET_OPTIONS = Collections.unmodifiableList(Arrays.asList(
"keyboard", "keyboard_no_fullscreen",
@@ -146,7 +147,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
"format_flowed", "usenet_signature", "remove_signatures",
"receipt_default", "receipt_type", "receipt_legacy",
"forward_new",
"lookup_mx", "reply_move", "reply_move_inbox"
"lookup_mx", "reply_move", "reply_move_inbox",
"send_retry_max"
));
@Override
@@ -219,6 +221,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swLookupMx = view.findViewById(R.id.swLookupMx);
swReplyMove = view.findViewById(R.id.swReplyMove);
swReplyMoveInbox = view.findViewById(R.id.swReplyMoveInbox);
etSendRetryMax = view.findViewById(R.id.etSendRetryMax);
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext(), false);
@@ -762,6 +765,27 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
etSendRetryMax.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// Do nothing
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Do nothing
}
@Override
public void afterTextChanged(Editable s) {
Integer count = Helper.parseInt(s.toString());
if (count == null)
prefs.edit().remove("send_retry_max").apply();
else
prefs.edit().putInt("send_retry_max", count).apply();
}
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
@@ -798,6 +822,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
return;
if ("purge_contact_age".equals(key) || "purge_contact_freq".equals(key))
return;
if ("send_retry_max".equals(key))
return;
getMainHandler().removeCallbacks(update);
getMainHandler().postDelayed(update, FragmentOptions.DELAY_SETOPTIONS);
@@ -938,6 +964,10 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swReplyMove.setChecked(prefs.getBoolean("reply_move", false));
swReplyMoveInbox.setChecked(prefs.getBoolean("reply_move_inbox", true));
swReplyMoveInbox.setEnabled(swReplyMove.isChecked());
int send_retry_max = prefs.getInt("send_retry_max", 0);
etSendRetryMax.setText(send_retry_max > 0 ? Integer.toString(send_retry_max) : null);
etSendRetryMax.setHint(Integer.toString(ServiceSend.RETRY_MAX_DEFAULT));
} catch (Throwable ex) {
Log.e(ex);
}