mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 05:37:07 +00:00
Confirm sending messages
This commit is contained in:
parent
7ad2f81d7d
commit
c60ce9e002
2 changed files with 29 additions and 4 deletions
|
@ -275,15 +275,39 @@ public class FragmentCompose extends FragmentEx {
|
|||
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
int action = item.getItemId();
|
||||
final int action = item.getItemId();
|
||||
|
||||
switch (action) {
|
||||
case R.id.action_delete:
|
||||
onDelete();
|
||||
break;
|
||||
case R.id.action_send:
|
||||
try {
|
||||
String to = etTo.getText().toString();
|
||||
InternetAddress ato[] = (TextUtils.isEmpty(to) ? new InternetAddress[0] : InternetAddress.parse(to));
|
||||
if (ato.length == 0)
|
||||
throw new IllegalArgumentException(getString(R.string.title_to_missing));
|
||||
|
||||
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
||||
.setMessage(getString(R.string.title_ask_send,
|
||||
MessageHelper.getFormattedAddresses(ato, false)))
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onAction(action);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
} catch (Throwable ex) {
|
||||
onAction(action);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
onAction(action);
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1584,9 +1608,9 @@ public class FragmentCompose extends FragmentEx {
|
|||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (TextUtils.isEmpty(etTo.getText()))
|
||||
if (TextUtils.isEmpty(etTo.getText().toString().trim()))
|
||||
etTo.requestFocus();
|
||||
else if (TextUtils.isEmpty(etSubject.getText()))
|
||||
else if (TextUtils.isEmpty(etSubject.getText().toString()))
|
||||
etSubject.requestFocus();
|
||||
else
|
||||
etBody.requestFocus();
|
||||
|
|
|
@ -324,6 +324,7 @@
|
|||
<string name="title_attachments_missing">Attachments still loading</string>
|
||||
<string name="title_draft_deleted">Draft discarded</string>
|
||||
<string name="title_draft_saved">Draft saved</string>
|
||||
<string name="title_ask_send">Send message to %1$s?</string>
|
||||
<string name="title_queued">Sending message</string>
|
||||
|
||||
<string name="title_encrypt">Encrypt</string>
|
||||
|
|
Loading…
Reference in a new issue