commit
242251e0c2
1 changed files with 12 additions and 2 deletions
|
@ -110,9 +110,9 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
|
|||
|
||||
public int getProgressPercentage() {
|
||||
if (work > 0) {
|
||||
return (progress * 100) / work;
|
||||
return normalizeProgress((progress * 100) / work);
|
||||
}
|
||||
return progress;
|
||||
return normalizeProgress(progress);
|
||||
}
|
||||
|
||||
public void setInterrupted(boolean interrupted) {
|
||||
|
@ -135,4 +135,14 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
|
|||
@Override
|
||||
public void setGeneralProgress(String genProgress) {
|
||||
}
|
||||
|
||||
private int normalizeProgress(int progress) {
|
||||
if (progress < 0) {
|
||||
return 0;
|
||||
} else if (progress <= 100) {
|
||||
return progress;
|
||||
} else {
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue