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 | |
parent | c6d6b3e3f25a1c79508a45325a88f538770ac2b5 (diff) |
add confirmation dialog for deleting files
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 21 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 5 |
2 files changed, 18 insertions, 8 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) { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 5b7046752..331737eeb 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -75,7 +75,7 @@ <string name="sharing_files_please_wait">Sharing files. Please wait…</string> <string name="action_clear_history">Clear history</string> <string name="clear_conversation_history">Clear Conversation History</string> - <string name="clear_histor_msg">Do you want to delete all messages within this Conversation?\n\n<b>Warning:</b> This will not influence messages stored on other devices or servers.</string> + <string name="clear_histor_msg">Are you sure you want to delete all messages within this conversation?\n\n<b>Warning:</b> This will not delete copies of those messages that are stored on other devices or servers.</string> <string name="delete_messages">Delete messages</string> <string name="also_end_conversation">End this conversation afterwards</string> <string name="choose_presence">Choose device</string> @@ -830,4 +830,7 @@ <string name="action_open">Open</string> <string name="action_delete">Delete</string> <string name="security_violation_not_attaching_file">File omitted due to security violation.</string> + <string name="delete_file_dialog">Delete file</string> + <string name="delete_file_dialog_msg">Are you sure you want to delete this file?\n\n<b>Warning:</b> This will not delete copies of this file that are stored on other devices or servers. </string> + </resources> |