Size displays now as GB/MB/kB

This commit is contained in:
Dmitry Isaenko 2019-03-15 00:58:04 +03:00
parent 4cfd651667
commit dc5ba1425b
5 changed files with 10 additions and 6 deletions
src/main/java/nsusbloader/Controllers

View file

@ -16,7 +16,12 @@ public class NSLRowModel {
this.nspFile = nspFile;
this.markForUpload = checkBoxValue;
this.nspFileName = nspFile.getName();
this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0);
if (nspFile.length()/1024.0/1024.0/1024.0 > 1)
this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0/1024.0)+" GB";
else if (nspFile.length()/1024.0/1024.0 > 1)
this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0)+" MB";
else
this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0)+" kB";
this.status = "";
}
// Model methods start