mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
move asking-for-sending to a separate function
This commit is contained in:
parent
73ada05e99
commit
3d55ea931c
1 changed files with 14 additions and 10 deletions
|
@ -665,20 +665,24 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void askSendingFiles(ArrayList<Uri> uriList, Runnable onConfirm) {
|
||||||
|
String message = String.format(getString(R.string.ask_send_files_to_selected_chat), uriList.size());
|
||||||
|
if (SendRelayedMessageUtil.containsVideoType(context, uriList)) {
|
||||||
|
message += "\n\n" + getString(R.string.videos_sent_without_recoding);
|
||||||
|
}
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setMessage(message)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
.setPositiveButton(R.string.menu_send, (dialog, which) -> onConfirm.run())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void handleSharing() {
|
private void handleSharing() {
|
||||||
ArrayList<Uri> uriList = RelayUtil.getSharedUris(this);
|
ArrayList<Uri> uriList = RelayUtil.getSharedUris(this);
|
||||||
int sharedContactId = RelayUtil.getSharedContactId(this);
|
int sharedContactId = RelayUtil.getSharedContactId(this);
|
||||||
if (uriList.size() > 1) {
|
if (uriList.size() > 1) {
|
||||||
String message = String.format(getString(R.string.ask_send_files_to_selected_chat), uriList.size());
|
askSendingFiles(uriList, () -> SendRelayedMessageUtil.immediatelyRelay(this, chatId));
|
||||||
if (SendRelayedMessageUtil.containsVideoType(context, uriList)) {
|
|
||||||
message += "\n\n" + getString(R.string.videos_sent_without_recoding);
|
|
||||||
}
|
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setMessage(message)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setNegativeButton(android.R.string.cancel, ((dialog, which) -> finish()))
|
|
||||||
.setPositiveButton(R.string.menu_send, (dialog, which) -> SendRelayedMessageUtil.immediatelyRelay(this, chatId))
|
|
||||||
.show();
|
|
||||||
} else {
|
} else {
|
||||||
if (sharedContactId != 0) {
|
if (sharedContactId != 0) {
|
||||||
addAttachmentContactInfo(sharedContactId);
|
addAttachmentContactInfo(sharedContactId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue