From dc5d504edd482f1d03e21c2995f3610273f4114c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 27 Oct 2017 11:35:19 +0200 Subject: [PATCH] MessageAdapter: round file sizes --- .../eu/siacs/conversations/ui/adapter/MessageAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 5abd44522..d91f6e1e3 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -198,9 +198,9 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) { FileParams params = message.getFileParams(); if (params.size > (1.5 * 1024 * 1024)) { - filesize = params.size / (1024 * 1024)+ " MiB"; + filesize = Math.round(params.size * 1f/ (1024 * 1024))+ " MiB"; } else if (params.size >= 1024) { - filesize = params.size / 1024 + " KiB"; + filesize = Math.round(params.size * 1f/ 1024) + " KiB"; } else if (params.size > 0){ filesize = params.size + " B"; }