Skip to content

Commit

Permalink
fix bug: wrong audio scanner progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfeng committed Apr 24, 2021
1 parent 45a3e61 commit 4f74806
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion player/src/main/java/snow/player/util/AudioScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void subscribe(@io.reactivex.annotations.NonNull SingleEmitter<List<T>> e
}

int progress = 0;
int count = cursor.getCount();

do {
progress++;
Expand All @@ -141,7 +142,7 @@ public void subscribe(@io.reactivex.annotations.NonNull SingleEmitter<List<T>> e
result.add(item);
}

notifyProgressUpdate(Math.round(progress * 1.0F / cursor.getCount()));
notifyProgressUpdate(Math.round((progress * 1.0F / count) * 100));
} while (cursor.moveToNext() && !mCancelled.get());

cursor.close();
Expand Down

0 comments on commit 4f74806

Please sign in to comment.