fix delete file securely method and use for delete original file
This commit is contained in:
@@ -800,33 +800,18 @@ public class DecryptListFragment
|
||||
// we can only ever delete a file once, if we got this far either it's gone or it will never work
|
||||
mCanDelete = false;
|
||||
|
||||
if ("file".equals(uri.getScheme())) {
|
||||
File file = new File(uri.getPath());
|
||||
if (file.delete()) {
|
||||
try {
|
||||
int deleted = FileHelper.deleteFileSecurely(activity, uri);
|
||||
if (deleted > 0) {
|
||||
Notify.create(activity, R.string.file_delete_ok, Style.OK).show();
|
||||
} else {
|
||||
Notify.create(activity, R.string.file_delete_none, Style.WARN).show();
|
||||
}
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Log.e(Constants.TAG, "exception deleting file", e);
|
||||
Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show();
|
||||
}
|
||||
|
||||
if ("content".equals(uri.getScheme())) {
|
||||
try {
|
||||
int deleted = activity.getContentResolver().delete(uri, null, null);
|
||||
if (deleted > 0) {
|
||||
Notify.create(activity, R.string.file_delete_ok, Style.OK).show();
|
||||
} else {
|
||||
Notify.create(activity, R.string.file_delete_none, Style.WARN).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(Constants.TAG, "exception deleting file", e);
|
||||
Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show();
|
||||
|
||||
}
|
||||
|
||||
public class DecryptFilesAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
|
||||
Reference in New Issue
Block a user