use "0 B" instead of 0 for empty files

This commit is contained in:
tibbi 2016-07-14 20:49:19 +02:00
parent 5633bfcbc2
commit 232ffdd7d4
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ public class ItemsAdapter extends BaseAdapter {
private String getFormattedSize(FileDirItem item) {
final long size = item.getSize();
if (size <= 0)
return "0";
return "0 B";
final String[] units = {"B", "kB", "MB", "GB", "TB"};
final int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];