Updater: use consistent format for file sizes

Change-Id: I9a17cf2df69e2e39e90de169ca108511c71d4e31
Signed-off-by: Joey <joey@lineageos.org>
This commit is contained in:
Joey
2020-06-05 11:00:21 +02:00
committed by Bruno Martins
parent d54176ccf7
commit 9edea6468c
2 changed files with 2 additions and 6 deletions

View File

@@ -157,7 +157,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
final String downloadId = update.getDownloadId(); final String downloadId = update.getDownloadId();
if (mUpdaterController.isDownloading(downloadId)) { if (mUpdaterController.isDownloading(downloadId)) {
canDelete = true; canDelete = true;
String downloaded = StringGenerator.bytesToMegabytes(mActivity, String downloaded = Formatter.formatShortFileSize(mActivity,
update.getFile().length()); update.getFile().length());
String total = Formatter.formatShortFileSize(mActivity, update.getFileSize()); String total = Formatter.formatShortFileSize(mActivity, update.getFileSize());
String percentage = NumberFormat.getPercentInstance().format( String percentage = NumberFormat.getPercentInstance().format(
@@ -191,7 +191,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
} else { } else {
canDelete = true; canDelete = true;
setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, !isBusy()); setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, !isBusy());
String downloaded = StringGenerator.bytesToMegabytes(mActivity, String downloaded = Formatter.formatShortFileSize(mActivity,
update.getFile().length()); update.getFile().length());
String total = Formatter.formatShortFileSize(mActivity, update.getFileSize()); String total = Formatter.formatShortFileSize(mActivity, update.getFileSize());
String percentage = NumberFormat.getPercentInstance().format( String percentage = NumberFormat.getPercentInstance().format(

View File

@@ -49,10 +49,6 @@ public final class StringGenerator {
return f.format(date); 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) { public static String formatETA(Context context, long millis) {
final long SECOND_IN_MILLIS = 1000; final long SECOND_IN_MILLIS = 1000;
final long MINUTE_IN_MILLIS = SECOND_IN_MILLIS * 60; final long MINUTE_IN_MILLIS = SECOND_IN_MILLIS * 60;