Skip to content

Commit

Permalink
Improve progress update logic
Browse files Browse the repository at this point in the history
vogti committed Apr 21, 2020

Verified

This commit was signed with the committer’s verified signature.
vogti Marco Vogt
1 parent b570bb4 commit 3c288f5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -56,10 +56,12 @@ public void updateProgress() {


protected void update( int done, int totalNumber ) {
if ( totalNumber < 100 ) { // Avoid / by zero
if ( totalNumber == 0 ) { // Avoid / by zero
update( 0 );
} else {
update( (done / (totalNumber / 100)) );
float denominator = totalNumber / 100.0f;
float progress = done / denominator;
update( Math.round( progress ) );
}
}

0 comments on commit 3c288f5

Please sign in to comment.