diff options
author | Joey <joey@lineageos.org> | 2020-06-05 11:00:21 +0200 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2022-02-10 20:53:39 +0000 |
commit | 9edea6468c2ce36f8f2ef14dc6c68bde668230e8 (patch) | |
tree | 2055a418b420b2aa9aa772bc3e7bb49210bb0f01 | |
parent | d54176ccf7a21676a4de7096e2864a66760f7f39 (diff) |
Updater: use consistent format for file sizes
Change-Id: I9a17cf2df69e2e39e90de169ca108511c71d4e31
Signed-off-by: Joey <joey@lineageos.org>
-rw-r--r-- | src/org/lineageos/updater/UpdatesListAdapter.java | 4 | ||||
-rw-r--r-- | src/org/lineageos/updater/misc/StringGenerator.java | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/org/lineageos/updater/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java index 23d50d1..3b75a54 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -157,7 +157,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. final String downloadId = update.getDownloadId(); if (mUpdaterController.isDownloading(downloadId)) { canDelete = true; - String downloaded = StringGenerator.bytesToMegabytes(mActivity, + String downloaded = Formatter.formatShortFileSize(mActivity, update.getFile().length()); String total = Formatter.formatShortFileSize(mActivity, update.getFileSize()); String percentage = NumberFormat.getPercentInstance().format( @@ -191,7 +191,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. } else { canDelete = true; setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, !isBusy()); - String downloaded = StringGenerator.bytesToMegabytes(mActivity, + String downloaded = Formatter.formatShortFileSize(mActivity, update.getFile().length()); String total = Formatter.formatShortFileSize(mActivity, update.getFileSize()); String percentage = NumberFormat.getPercentInstance().format( diff --git a/src/org/lineageos/updater/misc/StringGenerator.java b/src/org/lineageos/updater/misc/StringGenerator.java index 876542c..fec5bfe 100644 --- a/src/org/lineageos/updater/misc/StringGenerator.java +++ b/src/org/lineageos/updater/misc/StringGenerator.java @@ -49,10 +49,6 @@ public final class StringGenerator { return f.format(date); } - public static String bytesToMegabytes(Context context, long bytes) { - return String.format(getCurrentLocale(context), "%.0f", bytes / 1024.f / 1024.f); - } - public static String formatETA(Context context, long millis) { final long SECOND_IN_MILLIS = 1000; final long MINUTE_IN_MILLIS = SECOND_IN_MILLIS * 60; |