From f5a5d233f29bf7d09d0b02522830b3515e1d4caa Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 24 Apr 2019 22:39:10 +0200 Subject: [PATCH] Two digits on ratio text --- .../java/org/transdroid/core/gui/lists/LocalTorrent.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java b/app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java index 59e33bb8..17a18339 100644 --- a/app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java +++ b/app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java @@ -50,6 +50,7 @@ public class LocalTorrent { } private static final String DECIMAL_FORMATTER = "%.1f"; + private static final String DECIMAL_FORMATTER_2 = "%.2f"; /** * Builds a string showing the upload/download seed ratio. If not downloading, it will base the ratio on the total @@ -63,11 +64,11 @@ public class LocalTorrent { baseSize = t.getDownloadedEver(); } if (baseSize <= 0) { - return String.format(Locale.getDefault(), DECIMAL_FORMATTER, 0d); + return String.format(Locale.getDefault(), DECIMAL_FORMATTER_2, 0d); } else if (t.getRatio() == Double.POSITIVE_INFINITY) { return "\u221E"; } else { - return String.format(Locale.getDefault(), DECIMAL_FORMATTER, t.getRatio()); + return String.format(Locale.getDefault(), DECIMAL_FORMATTER_2, t.getRatio()); } }