Refactoring

This commit is contained in:
M66B
2018-08-21 14:25:42 +00:00
parent 36bdc2cce7
commit 3ef26e5e46
7 changed files with 26 additions and 26 deletions

View File

@@ -132,10 +132,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
@Override
protected Void onLoad(Context context, Bundle args) {
DB.getInstance(context).attachment().deleteAttachment(attachment.id);
File dir = new File(context.getFilesDir(), "attachments");
File file = new File(dir, attachment.id.toString());
file.delete();
EntityAttachment.getFile(context, attachment.id).delete();
return null;
}
}.load(context, owner, args);
@@ -143,8 +140,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
} else {
if (attachment.available) {
// Build file name
File dir = new File(context.getFilesDir(), "attachments");
File file = new File(dir, attachment.id.toString());
File file = EntityAttachment.getFile(context, attachment.id);
// https://developer.android.com/reference/android/support/v4/content/FileProvider
Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);