- * Starts a the removal of the previewed file.
- *
- * Shows a confirmation dialog. The action continues in {@link #onConfirmation(String)} , {@link #onNeutral(String)} or {@link #onCancel(String)},
- * depending upon the user selection in the dialog.
- */
- private void removeFile() {
- ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(
- R.string.confirmation_remove_alert,
- new String[]{getFile().getFileName()},
- R.string.confirmation_remove_remote_and_local,
- R.string.confirmation_remove_local,
- R.string.common_cancel);
- confDialog.setOnConfirmationListener(this);
- confDialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
- }
-
-
- /**
- * Performs the removal of the previewed file, both locally and in the server.
- */
- @Override
- public void onConfirmation(String callerTag) {
- OCFile file = getFile();
- FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
- if (storageManager.getFileById(file.getFileId()) != null) { // check that the file is still there;
- stopPreview(true);
- mContainerActivity.getFileOperationsHelper().removeFile(file, true);
- }
- }
-
-
- /**
- * Removes the file from local storage
- */
- @Override
- public void onNeutral(String callerTag) {
- OCFile file = getFile();
- stopPreview(true);
- mContainerActivity.getStorageManager().removeFile(file, false, true); // TODO perform in background task / new thread
- finish();
- }
-
- /**
- * User cancelled the removal action.
- */
- @Override
- public void onCancel(String callerTag) {
- // nothing to do here
- }
-
-
- /**
- * Helper method to test if an {@link OCFile} can be passed to a {@link PreviewMediaFragment} to be previewed.