Skip to content

Commit

Permalink
Always emit trailing zero in human-readable download progress
Browse files Browse the repository at this point in the history
The human-readable download progress (e.g. "8.2 MiB") typically changes
rapidly and, especially in the common "MiB" range, is very "jumpy" if
the trailing digit is only shown if it's non-zero.
  • Loading branch information
fmeum committed Dec 7, 2022
1 parent 8f5b626 commit 1bbd2d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,9 @@ public static <V> V refreshIfUnauthenticated(
}

private static final ImmutableList<String> UNITS = ImmutableList.of("KiB", "MiB", "GiB", "TiB");
// Format as single digit decimal number, but skipping the trailing .0.
// Format as single digit decimal number.
private static final DecimalFormat BYTE_COUNT_FORMAT =
new DecimalFormat("0.#", new DecimalFormatSymbols(Locale.US));
new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US));

/**
* Converts the number of bytes to a human readable string, e.g. 1024 -> 1 KiB.
Expand Down

0 comments on commit 1bbd2d0

Please sign in to comment.