diff --git a/app/src/main/java/me/ocv/partyup/XferActivity.java b/app/src/main/java/me/ocv/partyup/XferActivity.java index b06a999..9919799 100644 --- a/app/src/main/java/me/ocv/partyup/XferActivity.java +++ b/app/src/main/java/me/ocv/partyup/XferActivity.java @@ -57,7 +57,7 @@ public class XferActivity extends AppCompatActivity { String base_url; boolean upping; String the_msg; - long bytes_done, bytes_total; + long bytes_done, bytes_total, t0; F[] files; @Override @@ -263,6 +263,7 @@ private void do_up2() { if (!base_url.endsWith("/")) base_url += "/"; + t0 = System.currentTimeMillis(); tshow_msg("Sending to " + base_url + " ..."); int nfiles = files == null ? 1 : files.length; @@ -347,14 +348,19 @@ private boolean do_fileput(HttpURLConnection conn, int nfile) throws Exception { tv.post(() -> { double perc = ((double) bytes_done * 1000) / bytes_total; - tv.setText(format("Sending %d of %d to %s ...\n\n%s\n\nbytes done: %,d\nbytes left: %,d\nprogress: %.2f %%", + long td = 1 + System.currentTimeMillis() - t0; + double spd = bytes_done / (td / 1000.0); + long left = (long)((bytes_total - bytes_done) / spd); + tv.setText(format("Sending to %s ...\n\nFile %d of %d:\n%s\n\nbytes done: %,d\nbytes left: %,d\nspeed: %.2f MiB/s\nprogress: %.2f %%\nETA: %d sec", + base_url, nfile + 1, files.length, - base_url, f.desc, bytes_done, bytes_total - bytes_done, - perc / 10 + spd / 1024 / 1024, + perc / 10, + left )); pb.setProgress((int) Math.round(perc)); }); diff --git a/metadata/en-US/changelogs/10600.txt b/metadata/en-US/changelogs/10600.txt index 19f50d7..816ac23 100644 --- a/metadata/en-US/changelogs/10600.txt +++ b/metadata/en-US/changelogs/10600.txt @@ -1,4 +1,5 @@ • new: upload multiple files +• new: show transfer speed and ETA • new: choose what happens when upload succeeds • new: add http:// to the server URL if missing • bugfix: sharing from some apps on android 10+ could crash this app \ No newline at end of file