add getCheckedProgressPercentage

This commit is contained in:
Chumva 2018-07-18 13:06:36 +03:00
parent cc7c4e3678
commit cfd37d4dbf

View file

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