From ad673921ebd6221bfbbeee75736f2340b10c66e7 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 1 Sep 2016 14:24:03 +0200 Subject: [PATCH 1/2] fix remote folder size display (seems to have been lost after 1.2.0) --- .../owncloud/android/ui/adapter/FileListListAdapter.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index fc3d0f7db618..63e60bf3add2 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -36,7 +36,6 @@ import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ListAdapter; import android.widget.TextView; import com.owncloud.android.R; @@ -196,11 +195,6 @@ public View getView(int position, View convertView, ViewGroup parent) { fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); - if (file.isFolder()) { - fileSizeSeparatorV.setVisibility(View.GONE); - fileSizeV.setVisibility(View.GONE); - } - case GRID_ITEM: // filename fileName = (TextView) view.findViewById(R.id.Filename); From 70e8f625819d4eabd5c9e8d0327f8febb9c02dc2 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 1 Sep 2016 14:42:55 +0200 Subject: [PATCH 2/2] Added 'Pending' placeholder for still-unknown size of incoming federated folders --- res/values/strings.xml | 1 + .../owncloud/android/utils/DisplayUtils.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 259a93884dd5..628d46340331 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -104,6 +104,7 @@ Loading … unknown Unknown error + Pending About Change password Remove account diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index 6ad06093fd7c..8fb657fcf56b 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/src/com/owncloud/android/utils/DisplayUtils.java @@ -96,19 +96,24 @@ public class DisplayUtils { *
  • rounds the size based on the suffix to 0,1 or 2 decimals
  • * * - * @param bytes Input file size - * @return something readable like "12 MB" + * @param bytes Input file size + * @return something readable like "12 MB", {@link com.owncloud.android.R.string#common_pending} for negative + * byte values */ public static String bytesToHumanReadable(long bytes) { - double result = bytes; - int suffixIndex = 0; - while (result > 1024 && suffixIndex < sizeSuffixes.length) { - result /= 1024.; - suffixIndex++; - } + if (bytes < 0) { + return MainApp.getAppContext().getString(R.string.common_pending); + } else { + double result = bytes; + int suffixIndex = 0; + while (result > 1024 && suffixIndex < sizeSuffixes.length) { + result /= 1024.; + suffixIndex++; + } - return new BigDecimal(result).setScale( - sizeScales[suffixIndex], BigDecimal.ROUND_HALF_UP) + " " + sizeSuffixes[suffixIndex]; + return new BigDecimal(result).setScale( + sizeScales[suffixIndex], BigDecimal.ROUND_HALF_UP) + " " + sizeSuffixes[suffixIndex]; + } } /**