Merge pull request #5692 from osmandapp/Fix_5560

Fix_5560
This commit is contained in:
Alexander Sytnyk 2018-07-18 13:23:49 +03:00 committed by GitHub
commit 242251e0c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,9 +110,9 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
public int getProgressPercentage() { public int getProgressPercentage() {
if (work > 0) { if (work > 0) {
return (progress * 100) / work; return normalizeProgress((progress * 100) / work);
} }
return progress; return normalizeProgress(progress);
} }
public void setInterrupted(boolean interrupted) { public void setInterrupted(boolean interrupted) {
@ -135,4 +135,14 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
@Override @Override
public void setGeneralProgress(String genProgress) { public void setGeneralProgress(String genProgress) {
} }
private int normalizeProgress(int progress) {
if (progress < 0) {
return 0;
} else if (progress <= 100) {
return progress;
} else {
return 99;
}
}
} }