mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Calculate percentages for send progress bar
This commit is contained in:
@@ -104,13 +104,14 @@ public class SendFragment extends Fragment {
|
|||||||
((TransferDataState.TaskAvailable) state).state;
|
((TransferDataState.TaskAvailable) state).state;
|
||||||
if (s.getTotal() > 0L && progressBar.getVisibility() != VISIBLE) {
|
if (s.getTotal() > 0L && progressBar.getVisibility() != VISIBLE) {
|
||||||
progressBar.setVisibility(VISIBLE);
|
progressBar.setVisibility(VISIBLE);
|
||||||
// FIXME if we ever export more than 2 GB, this won't work
|
progressBar.setMax(100);
|
||||||
progressBar.setMax((int) s.getTotal());
|
|
||||||
}
|
}
|
||||||
|
int progress = s.getTotal() == 0 ? 0 : // no div by null
|
||||||
|
(int) (s.getDone() / s.getTotal()) * 100;
|
||||||
if (SDK_INT >= 24) {
|
if (SDK_INT >= 24) {
|
||||||
progressBar.setProgress((int) s.getDone(), true);
|
progressBar.setProgress(progress, true);
|
||||||
} else {
|
} else {
|
||||||
progressBar.setProgress((int) s.getDone());
|
progressBar.setProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user