From 754de6bb0449a577d2bb9c28cca6adf0ef9554f6 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 6 Feb 2017 10:01:13 +0100 Subject: relates FS#241: Implementation of http download based on okhttp --- .../services/filetransfer/FileTransferEntity.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java') 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 true, {@value STATUS_UPLOADING} otherwise + * @return {@value STATUS_FAILED} if #isFailed returns true, {@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(); } -- cgit v1.2.3