diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-13 22:59:00 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-15 15:34:11 +0100 |
commit | 02cbda68a7af5c500f2044cb97507c680ef2bc41 (patch) | |
tree | 0b60e96d3b2e50e7c7483d407b8110e677ecbbb3 /src/main/java/eu/siacs/conversations/ui/adapter | |
parent | 7a90ca429bb46fae4cbd600bd4c2274f4a731a16 (diff) |
bug fixes and various improvements for file transfer
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 6449a6f9..4d46f90e 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -103,10 +103,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { } boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI && message.getMergedStatus() <= Message.STATUS_RECEIVED; - if (message.getType() == Message.TYPE_IMAGE - || message.getDownloadable() != null) { + if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getDownloadable() != null) { ImageParams params = message.getImageParams(); - if (params.size != 0) { + if (params.size > (1.5 * 1024 * 1024)) { + filesize = params.size / (1024 * 1024)+ " MB"; + } else if (params.size > 0) { filesize = params.size / 1024 + " KB"; } if (message.getDownloadable() != null && message.getDownloadable().getStatus() == Downloadable.STATUS_FAILED) { @@ -509,7 +510,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { displayImageMessage(viewHolder, item); } } else if (item.getType() == Message.TYPE_FILE) { - displayOpenableMessage(viewHolder,item); + if (item.getImageParams().width > 0) { + displayImageMessage(viewHolder,item); + } else { + displayOpenableMessage(viewHolder, item); + } } else { if (item.getEncryption() == Message.ENCRYPTION_PGP) { if (activity.hasPgp()) { |