From 032630143a286f886c58f802d3c61c9a4ba3e99f Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 4 Jan 2019 11:18:43 +0100 Subject: show warning if file from MediaViewerActivity is deleted --- .../java/de/pixart/messenger/ui/MediaViewerActivity.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java index a0464956d..d8659709b 100644 --- a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java @@ -15,6 +15,7 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; import android.support.v7.view.menu.MenuBuilder; import android.support.v7.view.menu.MenuPopupHelper; import android.support.v7.widget.PopupMenu; @@ -162,8 +163,16 @@ public class MediaViewerActivity extends XmppActivity { } private void deleteFile() { - this.xmppConnectionService.getFileBackend().deleteFile(mFile); - finish(); + AlertDialog.Builder builder = new AlertDialog.Builder(this); + 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 (this.xmppConnectionService.getFileBackend().deleteFile(mFile)) { + finish(); + } + }); + builder.create().show(); } private void open() { -- cgit v1.2.3