Skip to content

Commit

Permalink
fix reporting cached percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
danikula committed Apr 22, 2017
1 parent f5dd92e commit ba6ba4e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void notifyNewCacheDataAvailable(long cacheAvailable, long sourceAvailab

protected void onCacheAvailable(long cacheAvailable, long sourceLength) {
boolean zeroLengthSource = sourceLength == 0;
int percents = zeroLengthSource ? 100 : (int) (cacheAvailable / sourceLength * 100);
int percents = zeroLengthSource ? 100 : (int) ((float) cacheAvailable / sourceLength * 100);
boolean percentsChanged = percents != percentsAvailable;
boolean sourceLengthKnown = sourceLength >= 0;
if (sourceLengthKnown && percentsChanged) {
Expand Down

0 comments on commit ba6ba4e

Please sign in to comment.