@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } // Needed when prefs are not passed by the constructor if (preferences == null) { preferences = parentWebView.getPreferences(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; webView.init(this, cordova); initWebViewSettings(); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { webView.setNetworkAvailable(value); } @Override public void runOnUiThread(Runnable r) { SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } // Needed when prefs are not passed by the constructor if (preferences == null) { preferences = parentWebView.getPreferences(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; webView.init(this, cordova); initWebViewSettings(); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { //sometimes this can be called after calling webview.destroy() on destroy() //thus resulting in a NullPointerException if(webView!=null) { webView.setNetworkAvailable(value); } } @Override public void runOnUiThread(Runnable r) { SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } // Needed when prefs are not passed by the constructor if (preferences == null) { preferences = parentWebView.getPreferences(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; webView.init(this, cordova); initWebViewSettings(); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { webView.setNetworkAvailable(value); } @Override public void runOnUiThread(Runnable r) { SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; CordovaPlugin activityDelegatePlugin = new CordovaPlugin() { @Override public void onResume(boolean multitasking) { activityDelegate.onResume(); } }; pluginManager.addService(new PluginEntry("XWalkActivityDelegate", activityDelegatePlugin)); webView.init(this); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode( new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { webView.setNetworkAvailable(value); } @Override public void runOnUiThread(Runnable r) { XWalkWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); }
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; webView.init(this); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode( new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { webView.setNetworkAvailable(value); } @Override public void runOnUiThread(Runnable r) { XWalkWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); }
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client, CordovaResourceApi resourceApi, PluginManager pluginManager, NativeToJsMessageQueue nativeToJsMessageQueue) { if (this.cordova != null) { throw new IllegalStateException(); } this.parentWebView = parentWebView; this.cordova = cordova; this.client = client; this.resourceApi = resourceApi; this.pluginManager = pluginManager; this.nativeToJsMessageQueue = nativeToJsMessageQueue; webView.init(this, cordova); initWebViewSettings(); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @Override public void setNetworkAvailable(boolean value) { webView.setNetworkAvailable(value); } @Override public void runOnUiThread(Runnable r) { SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }