From 4bfc54e51d83c1e617de81bcab4bae3b4090dfe6 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 31 Mar 2017 09:26:55 +0200 Subject: [PATCH] show file size for files smaller 1024 bytes. fixes #2415 --- .../eu/siacs/conversations/ui/adapter/MessageAdapter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 08ce18204..4abe0ae75 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -159,7 +159,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } - private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground, boolean inValidSession) { + private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground) { String filesize = null; String info = null; boolean error = false; @@ -182,8 +182,10 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie FileParams params = message.getFileParams(); if (params.size > (1.5 * 1024 * 1024)) { filesize = params.size / (1024 * 1024)+ " MiB"; - } else if (params.size > 0) { + } else if (params.size >= 1024) { filesize = params.size / 1024 + " KiB"; + } else { + filesize = params.size + " B"; } if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) { error = true; @@ -803,7 +805,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } - displayStatus(viewHolder, message, type, darkBackground, isInValidSession); + displayStatus(viewHolder, message, type, darkBackground); return view; }