diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-04 11:18:43 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-04 11:18:43 +0100 |
commit | 032630143a286f886c58f802d3c61c9a4ba3e99f (patch) | |
tree | b3e07e7321dbf2353df033bcd2267d99fb6b0c1d /src/main/java/de/pixart/messenger/ui | |
parent | 072479a9eacbed905e0c63c6c8f026f439ab0b29 (diff) |
show warning if file from MediaViewerActivity is deleted
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java | 13 |
1 files changed, 11 insertions, 2 deletions
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() { |