List of usage examples for org.apache.cordova PluginEntry PluginEntry
public PluginEntry(String service, CordovaPlugin plugin)
From source file:com.keemob.MainActivity.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // enable Cordova apps to be started in the background Bundle extras = getIntent().getExtras(); if (extras != null && extras.getBoolean("cdvStartInBackground", false)) { moveTaskToBack(true);/*from www.j a v a 2 s. c o m*/ } pluginEntries.add(new PluginEntry(FileChooser.class.getSimpleName(), new FileChooser())); // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); }
From source file:com.polyvi.xface.ams.XAMSComponent.java
License:Open Source License
/** * ams?app//www .j a v a2 s. c o m * * @param app */ private void registerAMSPluginTo(XApplication app) { XAmsExt amsExt = new XAmsExt(); amsExt.init(new XAmsImpl(mAms), mCtx.getCordovaInterface(), app.getView()); PluginEntry entry = new PluginEntry("AMS", amsExt); app.getView().pluginManager.addService(entry); }
From source file:org.apache.appharness.AppHarnessUI.java
License:Apache License
private void setPluginEntries(Set<String> pluginIdWhitelist, Uri configXmlUri) { CordovaActivity activity = (CordovaActivity) cordova.getActivity(); // Extract the <feature> from CADT's config.xml, and filter out unwanted plugins. ConfigXmlParser parser = new ConfigXmlParser(); parser.parse(activity);/* w w w . ja v a2 s . c om*/ ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(parser.getPluginEntries()); for (int i = 0; i < pluginEntries.size();) { PluginEntry p = pluginEntries.get(i); if (!pluginIdWhitelist.contains(p.service)) { pluginEntries.remove(p); continue; } else if (WhitelistPlugin.class.getCanonicalName().equals(p.pluginClass)) { pluginEntries.set(i, new PluginEntry(p.service, createWhitelistPlugin(configXmlUri))); } ++i; } slaveWebView.getPluginManager().setPluginEntries(pluginEntries); // This is added by cordova-android in code, so we need to re-add it likewise. // Note that we re-route navigator.app.exitApp() in JS to close the webview rather than close the Activity. slaveWebView.getPluginManager().addService("CoreAndroid", "org.apache.cordova.CoreAndroid"); }
From source file:org.crosswalk.engine.XWalkWebViewEngine.java
License:Apache License
@Override public void loadUrl(String url, boolean clearNavigationStack) { if (!activityDelegate.isXWalkReady()) { startUrl = url;//from w w w.j av a 2 s .c om CordovaPlugin initPlugin = new CordovaPlugin() { @Override public void onResume(boolean multitasking) { activityDelegate.onResume(); } }; pluginManager.addService(new PluginEntry("XWalkInit", initPlugin)); return; } webView.load(url, null); }
From source file:plugin.google.maps.CordovaGoogleMaps.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void getMap(final JSONArray args, final CallbackContext callbackContext) throws JSONException { //------------------------------------------ // Create an instance of PluginMap class. //------------------------------------------ String mapId = args.getString(0); PluginMap pluginMap = new PluginMap(); pluginMap.privateInitialize(mapId, cordova, webView, null); pluginMap.initialize(cordova, webView); pluginMap.mapCtrl = CordovaGoogleMaps.this; pluginMap.self = pluginMap;//w w w . j a va 2 s . c o m ((MyPlugin) pluginMap).CURRENT_PAGE_URL = CURRENT_URL; PluginEntry pluginEntry = new PluginEntry(mapId, pluginMap); pluginManager.addService(pluginEntry); if (mPluginLayout.isSuspended) { mPluginLayout.isSuspended = false; synchronized (mPluginLayout.timerLock) { mPluginLayout.timerLock.notify(); } } pluginMap.getMap(args, callbackContext); }
From source file:plugin.google.maps.GoogleMaps.java
@SuppressWarnings("rawtypes") private void loadPlugin(String serviceName) { if (plugins.containsKey(serviceName)) { return;/*from w w w. j a v a 2 s. c om*/ } try { String className = "plugin.google.maps.Plugin" + serviceName; Class pluginCls = Class.forName(className); CordovaPlugin plugin = (CordovaPlugin) pluginCls.newInstance(); PluginEntry pluginEntry = new PluginEntry("GoogleMaps", plugin); this.plugins.put(serviceName, pluginEntry); plugin.privateInitialize(className, this.cordova, webView, null); plugin.initialize(this.cordova, webView); ((MyPluginInterface) plugin).setMapCtrl(this); if (map == null) { Log.e(TAG, "map is null!"); } } catch (Exception e) { e.printStackTrace(); } }