Calculate percentages for send progress bar

This commit is contained in:
Torsten Grote
2021-06-24 16:15:07 -03:00
parent 1899873da3
commit 7939c8b213

View File

@@ -104,13 +104,14 @@ public class SendFragment extends Fragment {
((TransferDataState.TaskAvailable) state).state;
if (s.getTotal() > 0L && progressBar.getVisibility() != VISIBLE) {
progressBar.setVisibility(VISIBLE);
// FIXME if we ever export more than 2 GB, this won't work
progressBar.setMax((int) s.getTotal());
progressBar.setMax(100);
}
int progress = s.getTotal() == 0 ? 0 : // no div by null
(int) (s.getDone() / s.getTotal()) * 100;
if (SDK_INT >= 24) {
progressBar.setProgress((int) s.getDone(), true);
progressBar.setProgress(progress, true);
} else {
progressBar.setProgress((int) s.getDone());
progressBar.setProgress(progress);
}
}
}