Show send dialog when more than 10 recipients + warning color

This commit is contained in:
M66B 2019-12-30 13:40:42 +01:00
parent 7a30c90168
commit 986d6eb3bb
1 changed files with 10 additions and 4 deletions

View File

@ -239,6 +239,7 @@ public class FragmentCompose extends FragmentBase {
static final int REDUCED_IMAGE_QUALITY = 90; // percent static final int REDUCED_IMAGE_QUALITY = 90; // percent
private static final int ADDRESS_ELLIPSIZE = 50; private static final int ADDRESS_ELLIPSIZE = 50;
private static final int RECIPIENTS_WARNING = 10;
private static final int REQUEST_CONTACT_TO = 1; private static final int REQUEST_CONTACT_TO = 1;
private static final int REQUEST_CONTACT_CC = 2; private static final int REQUEST_CONTACT_CC = 2;
@ -3695,7 +3696,10 @@ public class FragmentCompose extends FragmentBase {
boolean remind_text = args.getBoolean("remind_text", false); boolean remind_text = args.getBoolean("remind_text", false);
boolean remind_attachment = args.getBoolean("remind_attachment", false); boolean remind_attachment = args.getBoolean("remind_attachment", false);
if (dialog || remind_subject || remind_text || remind_attachment) { int recipients = (draft.to == null ? 0 : draft.to.length) +
(draft.cc == null ? 0 : draft.cc.length) +
(draft.bcc == null ? 0 : draft.bcc.length);
if (dialog || remind_subject || remind_text || remind_attachment || recipients > RECIPIENTS_WARNING) {
setBusy(false); setBusy(false);
FragmentDialogSend fragment = new FragmentDialogSend(); FragmentDialogSend fragment = new FragmentDialogSend();
@ -4300,9 +4304,11 @@ public class FragmentCompose extends FragmentBase {
return; return;
} }
int plus = (draft.cc == null ? 0 : draft.cc.length) + int to = (draft.to == null ? 0 : draft.to.length);
(draft.bcc == null ? 0 : draft.bcc.length); int cc = (draft.cc == null ? 0 : draft.cc.length) + (draft.bcc == null ? 0 : draft.bcc.length);
tvTo.setText(MessageHelper.formatAddressesShort(draft.to) + (plus > 0 ? " +" + plus : "")); tvTo.setText(MessageHelper.formatAddressesShort(draft.to) + (cc > 0 ? " +" + cc : ""));
tvTo.setTextColor(Helper.resolveColor(getContext(),
to + cc > RECIPIENTS_WARNING ? R.attr.colorWarning : android.R.attr.textColorPrimary));
tvVia.setText(draft.identityEmail); tvVia.setText(draft.identityEmail);
cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only); cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only);