org.apache.cordova.CordovaWebView Java Examples
The following examples show how to use
org.apache.cordova.CordovaWebView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WizPurchase.java From cordova-plugin-wizpurchase with MIT License | 6 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { Log.d(TAG, "initialising plugin"); /* base64EncodedPublicKey should be YOUR APPLICATION'S PUBLIC KEY * (that you got from the Google Play developer console). This is not your * developer public key, it's the *app-specific* public key. * * Instead of just storing the entire literal string here embedded in the * program, construct the key at runtime from pieces or * use bit manipulation (for example, XOR with some other string) to hide * the actual key. The key itself is not secret information, but we don't * want to make it easy for an attacker to replace the public key with one * of their own and then fake messages from the server. */ // Assign base64 encoded public key int billingKey = cordova.getActivity().getResources().getIdentifier("billing_key", "string", cordova.getActivity().getPackageName()); mBase64EncodedPublicKey = cordova.getActivity().getString(billingKey); super.initialize(cordova, webView); }
Example #2
Source File: HotCodePushPlugin.java From cordova-hot-code-push with MIT License | 6 votes |
@Override public void initialize(final CordovaInterface cordova, final CordovaWebView webView) { super.initialize(cordova, webView); parseCordovaConfigXml(); loadPluginInternalPreferences(); Log.d("CHCP", "Currently running release version " + pluginInternalPrefs.getCurrentReleaseVersionName()); // clean up file system cleanupFileSystemFromOldReleases(); handler = new Handler(); fileStructure = new PluginFilesStructure(cordova.getActivity(), pluginInternalPrefs.getCurrentReleaseVersionName()); appConfigStorage = new ApplicationConfigStorage(); defaultCallbackStoredResults = new ArrayList<PluginResult>(); }
Example #3
Source File: TwilioVoicePlugin.java From cordova-plugin-twiliovoicesdk with MIT License | 6 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Log.d(TAG, "initialize()"); // initialize sound SoundPoolManager SoundPoolManager.getInstance(cordova.getActivity()); Context context = cordova.getActivity().getApplicationContext(); audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); // Handle an incoming call intent if launched from a notification Intent intent = cordova.getActivity().getIntent(); if (intent.getAction().equals(ACTION_INCOMING_CALL)) { mIncomingCallIntent = intent; } }
Example #4
Source File: CordovaPlugin.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); // File Transfer API implementation leverages the android.webkit.CookieManager. // But trying to getinstance() of CookieManager before the webview // instantiated would cause crash. In the cordova with xwalk backend, // there doesn't exist webview. From the android official document // (http://developer.android.com/reference/android/webkit/CookieManager.html), // it requires to call following API first. // TODO: add condition only for xwalk backend when dynamic switch is ready. CookieSyncManager.createInstance(cordova.getActivity()); }
Example #5
Source File: InAppBrowser.java From cordova-plugin-inappbrowser with Apache License 2.0 | 5 votes |
/** * Constructor. * * @param webView * @param mEditText */ public InAppBrowserClient(CordovaWebView webView, EditText mEditText, String beforeload) { this.webView = webView; this.edittext = mEditText; this.beforeload = beforeload; this.waitForBeforeload = beforeload != null; }
Example #6
Source File: BannerExecutor.java From cordova-plugin-admob-free with MIT License | 5 votes |
private View getWebView() { CordovaWebView webView = plugin.webView; try { return (View) webView.getClass().getMethod("getView").invoke(webView); } catch (Exception e) { return (View) webView; } }
Example #7
Source File: CordovaPlugin.java From app-icon with MIT License | 5 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.serviceName = serviceName; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); }
Example #8
Source File: WebSocket.java From IoTgo_Android_App with MIT License | 5 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); _factory = new WebSocketClientFactory(); _conn = new SparseArray<Connection>(); _create = new ConnectionTask(_factory, _conn); _send = new SendingTask(_conn); _close = new DisconnectionTask(_conn); try { start(); } catch (Exception e) { } }
Example #9
Source File: SystemWebViewEngine.java From keemob with MIT License | 5 votes |
@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); } })); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }
Example #10
Source File: X5WebViewEngine.java From cordova-plugin-x5-tbs with Apache License 2.0 | 5 votes |
@Override public void init(CordovaWebView parentWebView, CordovaInterface cordova, 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) { X5WebViewEngine.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); }
Example #11
Source File: CordovaPlugin.java From xmall with MIT License | 5 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.serviceName = serviceName; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); }
Example #12
Source File: CordovaPlugin.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.serviceName = serviceName; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); }
Example #13
Source File: CordovaActivityTest.java From cordova-android-chromeview with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); mInstr = this.getInstrumentation(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); }
Example #14
Source File: StandardActivityTest.java From keemob with MIT License | 5 votes |
@Test public void checkBackgroundIntentCheck() { StandardActivity activity = (StandardActivity) mActivityRule.getActivity(); final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus(); CordovaWebView webInterface = webView.getCordovaWebView(); CordovaPreferences prefs = webInterface.getPreferences(); assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN); }
Example #15
Source File: HtmlNotFoundTest.java From crosswalk-cordova-android with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); }
Example #16
Source File: BackButtonMultipageTest.java From keemob with MIT License | 5 votes |
@Test public void testViaHref() throws Throwable { final CordovaWebView webInterface = mActivity.getWebInterface(); assertEquals(START_URL, mActivity.onPageFinishedUrl.take()); mActivityRule.runOnUiThread(new Runnable() { public void run() { webInterface.sendJavascript("window.location = 'sample2.html';"); } }); assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take()); mActivityRule.runOnUiThread(new Runnable() { public void run() { webInterface.sendJavascript("window.location = 'sample3.html';"); } }); assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", mActivity.onPageFinishedUrl.take()); mActivityRule.runOnUiThread(new Runnable() { public void run() { assertTrue(webInterface.backHistory()); } }); assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take()); mActivityRule.runOnUiThread(new Runnable() { public void run() { assertTrue(webInterface.backHistory()); } }); assertEquals(START_URL, mActivity.onPageFinishedUrl.take()); mActivityRule.runOnUiThread(new Runnable() { public void run() { assertFalse(webInterface.backHistory()); } }); }
Example #17
Source File: UID.java From cordova-plugin-uid with MIT License | 5 votes |
/** * Sets the context of the Command. This can then be used to do things like * get file paths associated with the Activity. * * @param cordova The context of the main Activity. * @param webView The CordovaWebView Cordova is running in. */ @Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Context context = cordova.getActivity().getApplicationContext(); UID.uuid = getUuid(context); UID.imei = getImei(context); UID.imsi = getImsi(context); UID.iccid = getIccid(context); UID.mac = getMac(context); }
Example #18
Source File: PluginManager.java From phonegap-plugin-loading-spinner with Apache License 2.0 | 5 votes |
/** * Constructor. * * @param app * @param ctx */ public PluginManager(CordovaWebView app, CordovaInterface ctx) { this.ctx = ctx; this.app = app; this.firstRun = true; this.numPendingUiExecs = new AtomicInteger(0); }
Example #19
Source File: CordovaPlugin.java From keemob with MIT License | 5 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.serviceName = serviceName; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); }
Example #20
Source File: PluginManager.java From cordova-android-chromeview with Apache License 2.0 | 5 votes |
/** * Constructor. * * @param app * @param ctx */ public PluginManager(CordovaWebView app, CordovaInterface ctx) { this.ctx = ctx; this.app = app; this.firstRun = true; this.numPendingUiExecs = new AtomicInteger(0); }
Example #21
Source File: PluginManager.java From bluemix-parking-meter with MIT License | 5 votes |
PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, List<PluginEntry> pluginEntries) { this.ctx = cordova; this.app = cordovaWebView; if (pluginEntries == null) { ConfigXmlParser parser = new ConfigXmlParser(); parser.parse(ctx.getActivity()); pluginEntries = parser.getPluginEntries(); } setPluginEntries(pluginEntries); }
Example #22
Source File: HtmlNotFoundTest.java From cordova-android-chromeview with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); }
Example #23
Source File: CordovaPlugin.java From reader with MIT License | 5 votes |
/** * Call this after constructing to initialize the plugin. * Final because we want to be able to change args without breaking plugins. */ public final void privateInitialize(CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { assert this.cordova == null; this.cordova = cordova; this.webView = webView; this.preferences = preferences; initialize(cordova, webView); pluginInitialize(); }
Example #24
Source File: PluginManager.java From reader with MIT License | 5 votes |
PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, List<PluginEntry> pluginEntries) { this.ctx = cordova; this.app = cordovaWebView; if (pluginEntries == null) { ConfigXmlParser parser = new ConfigXmlParser(); parser.parse(ctx.getActivity()); pluginEntries = parser.getPluginEntries(); } setPluginEntries(pluginEntries); }
Example #25
Source File: IronSourceAdsPlugin.java From cordova-plugin-ironsource-ads with MIT License | 5 votes |
/** --------------------------------------------------------------- */ public void initialize(CordovaInterface cordova, CordovaWebView webView) { cordovaWebView = webView; bannerLoaded = false; bannerShowing = false; super.initialize(cordova, webView); }
Example #26
Source File: IFrameTest.java From crosswalk-cordova-android with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); mInstr = this.getInstrumentation(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); touch = new TouchUtils(); touchTool = new Purity(testActivity, getInstrumentation()); }
Example #27
Source File: SystemWebViewEngine.java From countly-sdk-cordova with MIT License | 5 votes |
@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); } })); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); }
Example #28
Source File: StatusBar.java From reacteu-app with MIT License | 5 votes |
/** * Sets the context of the Command. This can then be used to do things like * get file paths associated with the Activity. * * @param cordova The context of the main Activity. * @param webView The CordovaWebView Cordova is running in. */ @Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { Log.v(TAG, "StatusBar: initialization"); super.initialize(cordova, webView); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially // by the Cordova. Window window = cordova.getActivity().getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // Read 'StatusBarBackgroundColor' from config.xml, default is #000000. setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000")); } }); }
Example #29
Source File: X5WebView.java From cordova-plugin-x5-tbs with Apache License 2.0 | 4 votes |
@Override public CordovaWebView getCordovaWebView() { return parentEngine != null ? parentEngine.getCordovaWebView() : null; }
Example #30
Source File: SystemWebViewEngine.java From pychat with MIT License | 4 votes |
@Override public CordovaWebView getCordovaWebView() { return parentWebView; }