add getCheckedProgressPercentage
This commit is contained in:
parent
cc7c4e3678
commit
cfd37d4dbf
1 changed files with 10 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue