This commit is contained in:
str4d
2017-11-25 16:00:46 +00:00
parent c2b6cee9a2
commit cae565761d
2 changed files with 30 additions and 24 deletions

View File

@ -9,6 +9,7 @@
* using a configuration wizard * using a configuration wizard
* saving tunnel settings * saving tunnel settings
* installing a browser without a market app * installing a browser without a market app
* rotating the screen while using the built-in browser
* Update Firefox browser config instructions for Firefox Quantum * Update Firefox browser config instructions for Firefox Quantum
* Translation updates * Translation updates

View File

@ -406,30 +406,35 @@ public class I2PWebViewClient extends WebViewClient {
protected void onProgressUpdate(Integer... progress) { protected void onProgressUpdate(Integer... progress) {
if (isCancelled()) if (isCancelled())
return; return;
int prog = progress[0]; try {
if (prog < 0) { int prog = progress[0];
_dialog.setTitle("Contacting..."); if (prog < 0) {
_dialog.setMessage(_host); _dialog.setTitle("Contacting...");
_dialog.setIndeterminate(true); _dialog.setMessage(_host);
_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); _dialog.setIndeterminate(true);
_dialog.setOnCancelListener(this); _dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
_dialog.show(); _dialog.setOnCancelListener(this);
} else if (prog == 0 && _total > 0) { _dialog.show();
_dialog.setTitle("Downloading..."); } else if (prog == 0 && _total > 0) {
_dialog.setMessage("...from " + _host); _dialog.setTitle("Downloading...");
_dialog.setIndeterminate(false); _dialog.setMessage("...from " + _host);
_dialog.setMax(_total); _dialog.setIndeterminate(false);
_dialog.setProgress(0); _dialog.setMax(_total);
} else if (_total > 0) { _dialog.setProgress(0);
// so it isn't at 100% while loading images and CSS } else if (_total > 0) {
_dialog.setProgress(Math.min(prog, _total * 99 / 100)); // so it isn't at 100% while loading images and CSS
} else if (prog > 0) { _dialog.setProgress(Math.min(prog, _total * 99 / 100));
// ugly, need custom } else if (prog > 0) {
_dialog.setTitle("Downloading..."); // ugly, need custom
_dialog.setMessage("...from " + _host + ": " + DataHelper.formatSize(prog) + 'B'); _dialog.setTitle("Downloading...");
//_dialog.setProgress(prog); _dialog.setMessage("...from " + _host + ": " + DataHelper.formatSize(prog) + 'B');
} else { //_dialog.setProgress(prog);
// nothing } else {
// nothing
}
} catch (IllegalArgumentException iae) {
// throws IAE - not attached to window manager - perhaps due to screen rotation?
Util.e("Error while updating I2PWebViewClient dialog", iae);
} }
} }