diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-20 16:57:58 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-20 16:57:58 +0200 |
commit | 29c41ec7286b66d813b8c4ff04098b675c3d8718 (patch) | |
tree | b4641070e9230888c3223c82cceef47a877a8d4f /src/main/java/de | |
parent | c6d6b3e3f25a1c79508a45325a88f538770ac2b5 (diff) |
add confirmation dialog for deleting files
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index eddf5abdc..c38072dbe 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1719,7 +1719,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), null); - builder.setPositiveButton(getString(R.string.delete_messages), (dialog, which) -> { + builder.setPositiveButton(getString(R.string.confirm), (dialog, which) -> { this.activity.xmppConnectionService.clearConversationHistory(conversation); if (endConversationCheckBox.isChecked()) { this.activity.xmppConnectionService.archiveConversation(conversation); @@ -1882,12 +1882,19 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke refresh(); } - private void deleteFile(Message message) { - if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) { - message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED)); - activity.onConversationsListItemUpdated(); - refresh(); - } + private void deleteFile(final Message message) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setNegativeButton(R.string.cancel, null); + builder.setTitle(R.string.delete_file_dialog); + builder.setMessage(R.string.delete_file_dialog_msg); + builder.setPositiveButton(R.string.confirm, (dialog, which) -> { + if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) { + message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED)); + activity.onConversationsListItemUpdated(); + refresh(); + } + }); + builder.create().show(); } public void resendMessage(final Message message) { |