diff --git a/CHANGELOG b/CHANGELOG index b683db686..6e6505355 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ * using a configuration wizard * saving tunnel settings * installing a browser without a market app + * rotating the screen while using the built-in browser * Update Firefox browser config instructions for Firefox Quantum * Translation updates diff --git a/app/src/main/java/net/i2p/android/router/web/I2PWebViewClient.java b/app/src/main/java/net/i2p/android/router/web/I2PWebViewClient.java index 6dd5f19ce..ef62a2baa 100644 --- a/app/src/main/java/net/i2p/android/router/web/I2PWebViewClient.java +++ b/app/src/main/java/net/i2p/android/router/web/I2PWebViewClient.java @@ -406,30 +406,35 @@ public class I2PWebViewClient extends WebViewClient { protected void onProgressUpdate(Integer... progress) { if (isCancelled()) return; - int prog = progress[0]; - if (prog < 0) { - _dialog.setTitle("Contacting..."); - _dialog.setMessage(_host); - _dialog.setIndeterminate(true); - _dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); - _dialog.setOnCancelListener(this); - _dialog.show(); - } else if (prog == 0 && _total > 0) { - _dialog.setTitle("Downloading..."); - _dialog.setMessage("...from " + _host); - _dialog.setIndeterminate(false); - _dialog.setMax(_total); - _dialog.setProgress(0); - } else if (_total > 0) { - // so it isn't at 100% while loading images and CSS - _dialog.setProgress(Math.min(prog, _total * 99 / 100)); - } else if (prog > 0) { - // ugly, need custom - _dialog.setTitle("Downloading..."); - _dialog.setMessage("...from " + _host + ": " + DataHelper.formatSize(prog) + 'B'); - //_dialog.setProgress(prog); - } else { - // nothing + try { + int prog = progress[0]; + if (prog < 0) { + _dialog.setTitle("Contacting..."); + _dialog.setMessage(_host); + _dialog.setIndeterminate(true); + _dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + _dialog.setOnCancelListener(this); + _dialog.show(); + } else if (prog == 0 && _total > 0) { + _dialog.setTitle("Downloading..."); + _dialog.setMessage("...from " + _host); + _dialog.setIndeterminate(false); + _dialog.setMax(_total); + _dialog.setProgress(0); + } else if (_total > 0) { + // so it isn't at 100% while loading images and CSS + _dialog.setProgress(Math.min(prog, _total * 99 / 100)); + } else if (prog > 0) { + // ugly, need custom + _dialog.setTitle("Downloading..."); + _dialog.setMessage("...from " + _host + ": " + DataHelper.formatSize(prog) + 'B'); + //_dialog.setProgress(prog); + } 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); } }