diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-07-31 08:44:32 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-07-31 08:44:32 +0200 |
commit | 11e2b1accd933eb9fcb4477a60dd0864d9f72a67 (patch) | |
tree | e1d27c488d5a697557095add001dca868f523ef4 /src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java | |
parent | 2d41916750e2c31b57cf6325441ff37a8639fe93 (diff) |
Implements FS#245: Implement FiletransferHttp (upload and delete), some minor bug fixes including to fail a JingleTransfer in case criterias are not met
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java index e49575f6..9a501b89 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java @@ -496,14 +496,31 @@ public class MessageAdapter extends ArrayAdapter<Message> { private void displayFileMessage(final Message message, ViewHolder viewHolder) { Transferable transferable = message.getTransferable(); - if (null != transferable) { + if (FileStatus.CHECKING_FILE_SIZE == message.getFileParams().getFileStatus()) { + displayInfoMessage(viewHolder, activity.getString(R.string.checking_remote_filesize)); + } else if (MessageUtil.isAttachedFileAnImage(message) + && (FileStatus.DOWNLOADED == message.getFileParams().getFileStatus()) + || FileStatus.DELETED == message.getFileParams().getFileStatus() + || FileStatus.DELETING == message.getFileParams().getFileStatus() + || FileStatus.DELETE_FAILED == message.getFileParams().getFileStatus() + || FileStatus.UPLOADED == message.getFileParams().getFileStatus()) { + displayImageMessage(viewHolder, message); + } else if ((MessageUtil.isTypeFileAndDecrypted(message) || FileStatus.DOWNLOADED == message.getFileParams().getFileStatus()) + && !MessageUtil.needsDownload(message)) { + displayOpenableMessage(viewHolder, message); + } else if (Message.Decision.NEVER == message.treatAsDownloadable() || !MessageUtil.mayFileRemoteAvailable(message)) { + displayTextMessage(viewHolder, message); + } else if (FileStatus.UPLOAD_FAILED == message.getFileParams().getFileStatus()) { + displayImageMessage(viewHolder, message); // TODO Show failed status + } else if (null != transferable) { switch (transferable.getStatus()) { case Transferable.STATUS_OFFER: case Transferable.STATUS_OFFER_CHECK_FILESIZE: displayDownloadableMessage(viewHolder, message); break; case Transferable.STATUS_UPLOADING: - displayFileMessage(message, viewHolder); + // Should not happen, since this is now covered by the other if-statements + // TODO Maybe in Jingle File Transfer?? Needs to be checked! break; case Transferable.STATUS_DELETED: case Transferable.STATUS_CHECKING: @@ -513,15 +530,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first); break; } - } else if (FileStatus.CHECKING_FILE_SIZE == message.getFileParams().getFileStatus()) { - displayInfoMessage(viewHolder, activity.getString(R.string.checking_remote_filesize)); - } else if (MessageUtil.isAttachedFileAnImage(message) && FileStatus.DOWNLOADED == message.getFileParams().getFileStatus()) { - displayImageMessage(viewHolder, message); - } else if ((MessageUtil.isTypeFileAndDecrypted(message) || FileStatus.DOWNLOADED == message.getFileParams().getFileStatus()) - && !MessageUtil.needsDownload(message)) { - displayOpenableMessage(viewHolder, message); - } else if (Message.Decision.NEVER == message.treatAsDownloadable() || !MessageUtil.mayFileRemoteAvailable(message)) { - displayTextMessage(viewHolder, message); } else { displayDownloadableMessage(viewHolder, message); } |