Fix getPercent to return the floored value instead of the rounded up val

Follow up for !1424

With the previous implementation getPercent(1, 200)` returned 1 and getPercent(199, 200) returned 100. The latter is quite misleading, especially when dealing with bigger numbers where the notification could show 100% although the file is still downloading.
This commit is contained in:
Tobias_Groza
2024-09-13 15:50:02 +02:00
parent 6915e1b615
commit 7076c8dec7

View File

@@ -747,7 +747,7 @@ public final class Utils {
* @param total must never be zero!
*/
public static int getPercent(long current, long total) {
return (int) ((100L * current + total / 2) / total);
return (int) (100L * current / total);
}
@SuppressWarnings("unused")