Browse Source

Two digits on ratio text

pull/506/head
Eric Kok 6 years ago
parent
commit
f5a5d233f2
  1. 5
      app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java

5
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 = "%.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 * 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(); baseSize = t.getDownloadedEver();
} }
if (baseSize <= 0) { 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) { } else if (t.getRatio() == Double.POSITIVE_INFINITY) {
return "\u221E"; return "\u221E";
} else { } else {
return String.format(Locale.getDefault(), DECIMAL_FORMATTER, t.getRatio()); return String.format(Locale.getDefault(), DECIMAL_FORMATTER_2, t.getRatio());
} }
} }

Loading…
Cancel
Save