Repository: cordova-plugin-inappbrowser Updated Branches: refs/heads/master 15a57485c -> 8da5e25ee
CB-10407: Re-adding onPageStarted to re-add LOAD_START, even though it's in the wrong place Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/8da5e25e Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/8da5e25e Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/8da5e25e Branch: refs/heads/master Commit: 8da5e25eeee892590f3ddb781a4fde8e9f8ef512 Parents: 15a5748 Author: Joe Bowser <[email protected]> Authored: Fri Jan 22 14:22:53 2016 -0800 Committer: Joe Bowser <[email protected]> Committed: Fri Jan 22 14:22:58 2016 -0800 ---------------------------------------------------------------------- src/android/InAppBrowser.java | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/8da5e25e/src/android/InAppBrowser.java ---------------------------------------------------------------------- diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index b912439..256c064 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -820,6 +820,45 @@ public class InAppBrowser extends CordovaPlugin { } + /* + * onPageStarted fires the LOAD_START_EVENT + * + * @param view + * @param url + * @param favicon + */ + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + super.onPageStarted(view, url, favicon); + String newloc = ""; + if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) { + newloc = url; + } + else + { + // Assume that everything is HTTP at this point, because if we don't specify, + // it really should be. Complain loudly about this!!! + LOG.e(LOG_TAG, "Possible Uncaught/Unknown URI"); + newloc = "http://" + url; + } + + // Update the UI if we haven't already + if (!newloc.equals(edittext.getText().toString())) { + edittext.setText(newloc); + } + + try { + JSONObject obj = new JSONObject(); + obj.put("type", LOAD_START_EVENT); + obj.put("url", newloc); + sendUpdate(obj, true); + } catch (JSONException ex) { + LOG.e(LOG_TAG, "URI passed in has caused a JSON error."); + } + } + + + public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
