diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
commit | 754de6bb0449a577d2bb9c28cca6adf0ef9554f6 (patch) | |
tree | 279b405d94e0d86d10ed94bd34d919457944ead6 /src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java | |
parent | cd633f13b8d7327e47994bb5a000f0c0b7089e7f (diff) |
relates FS#241: Implementation of http download based on okhttp
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java index e1b40fa6..06e697db 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java @@ -49,10 +49,16 @@ public class FileTransferEntity implements Transferable { * This initialization includes loading the file and associating this transferable to the message. * @param message the message in which the file to transfer is contained. */ - public FileTransferEntity(Message message) { + public FileTransferEntity(Message message, boolean initFile) { this.message = message; this.message.setTransferable(this); - this.file = FileBackend.getFile(message, false); + if (initFile) { + this.initFile(); + } + } + + protected final void initFile() { + this.file = FileBackend.getFile(this.message, false); } /** @@ -68,11 +74,11 @@ public class FileTransferEntity implements Transferable { /** * Returns the global transferable status. * - * @return {@value STATUS_FAILED} if #isFailed returns <code>true</code>, {@value STATUS_UPLOADING} otherwise + * @return {@value STATUS_FAILED} if #isFailed returns <code>true</code>, {@value STATUS_UNKNOWN} otherwise */ @Override public int getStatus() { - int status = (isFailed()) ? STATUS_FAILED : STATUS_UPLOADING; + int status = (isFailed()) ? STATUS_FAILED : STATUS_UNKNOWN; return status; } @@ -80,7 +86,6 @@ public class FileTransferEntity implements Transferable { * Returns the expected file size of the underlying file. * @return the expected file size or 0 if no file is associated. */ - @Override public long getFileSize() { return file == null ? 0 : file.getExpectedSize(); } |