/** * Notify the host application that a page has finished loading. This method is called only for * main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(XWalkView view, String url) { super.onPageFinished(view, url); LOG.d(XWalkCordovaResourceClient.TAG, "onPageFinished(" + url + ")"); // Clear timeout flag appView.loadUrlTimeout++; // Broadcast message that page has loaded appView.getPluginManager().postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized // correctly if (appView.getView().getVisibility() == View.INVISIBLE) { Thread t = new Thread( new Runnable() { public void run() { try { Thread.sleep(2000); appView .cordova .getActivity() .runOnUiThread( new Runnable() { public void run() { appView.getPluginManager().postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.getPluginManager().postMessage("exit", null); } }
public XWalkCordovaClient(XWalkCordovaWebView webView) { super(webView.getView()); appView = webView; helper = new CordovaUriHelper(appView.cordova, appView); }