Reset unused cids, refactoring

This commit is contained in:
M66B
2019-01-06 10:15:06 +00:00
parent 53de71bccb
commit ae1a36b482
7 changed files with 88 additions and 81 deletions

View File

@@ -107,7 +107,7 @@ public class EntityAttachment {
OutputStream os = null;
try {
this.progress = null;
db.attachment().updateAttachment(this);
db.attachment().setProgress(this.id, null);
is = this.part.getInputStream();
os = new BufferedOutputStream(new FileOutputStream(file));
@@ -127,13 +127,13 @@ public class EntityAttachment {
this.size = size;
this.progress = null;
this.available = true;
db.attachment().updateAttachment(this);
db.attachment().setDownloaded(this.id, size);
Log.i("Downloaded attachment size=" + this.size);
} catch (IOException ex) {
// Reset progress on failure
this.progress = null;
db.attachment().updateAttachment(this);
db.attachment().setProgress(this.id, null);
throw ex;
} finally {
try {