mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-19 14:10:38 -04:00
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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user