本文整理汇总了Java中org.apache.cordova.PluginEntry类的典型用法代码示例。如果您正苦于以下问题:Java PluginEntry类的具体用法?Java PluginEntry怎么用?Java PluginEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginEntry类属于org.apache.cordova包,在下文中一共展示了PluginEntry类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlugin
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Get the plugin object that implements the service.
* If the plugin object does not already exist, then create it.
* If the service doesn't exist, then return null.
*
* @param service The name of the service.
* @return CordovaPlugin or null
*/
public CordovaPlugin getPlugin(String service) {
CordovaPlugin ret = pluginMap.get(service);
if (ret == null) {
PluginEntry pe = entryMap.get(service);
if (pe == null) {
return null;
}
if (pe.plugin != null) {
ret = pe.plugin;
} else {
ret = instantiatePlugin(pe.pluginClass);
}
ret.privateInitialize(ctx, app, app.getPreferences());
pluginMap.put(service, ret);
}
return ret;
}
示例2: onOverrideUrlLoading
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Called when the URL of the webview changes.
*
* @param url The URL that is being changed to.
* @return Return false to allow the URL to load, return true to prevent the URL from loading.
*/
public boolean onOverrideUrlLoading(String url) {
// Deprecated way to intercept URLs. (process <url-filter> tags).
// Instead, plugins should not include <url-filter> and instead ensure
// that they are loaded before this function is called (either by setting
// the onload <param> or by making an exec() call to them)
for (PluginEntry entry : this.entryMap.values()) {
List<String> urlFilters = urlMap.get(entry.service);
if (urlFilters != null) {
for (String s : urlFilters) {
if (url.startsWith(s)) {
return getPlugin(entry.service).onOverrideUrlLoading(url);
}
}
} else {
CordovaPlugin plugin = pluginMap.get(entry.service);
if (plugin != null && plugin.onOverrideUrlLoading(url)) {
return true;
}
}
}
return false;
}
示例3: loadUrl
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
@Override
public void loadUrl(String url, boolean clearNavigationStack) {
if (!activityDelegate.isXWalkReady()) {
startUrl = url;
CordovaPlugin initPlugin = new CordovaPlugin() {
@Override
public void onResume(boolean multitasking) {
activityDelegate.onResume();
}
};
pluginManager.addService(new PluginEntry("XWalkInit", initPlugin));
return;
}
webView.load(url, null);
}
示例4: onOverrideUrlLoading
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Called when the URL of the webview changes.
*
* @param url The URL that is being changed to.
* @return Return false to allow the URL to load, return true to prevent the URL from loading.
*/
public boolean onOverrideUrlLoading(String url) {
// Deprecated way to intercept URLs. (process <url-filter> tags).
// Instead, plugins should not include <url-filter> and instead ensure
// that they are loaded before this function is called (either by setting
// the onload <param> or by making an exec() call to them)
for (PluginEntry entry : this.entryMap.values()) {
List<String> urlFilters = urlMap.get(entry.service);
if (urlFilters != null) {
for (String s : urlFilters) {
if (url.startsWith(s)) {
Log.d(TAG,"onOverrideUrlLoading()");
return getPlugin(entry.service).onOverrideUrlLoading(url);
}
}
} else {
CordovaPlugin plugin = pluginMap.get(entry.service);
if (plugin != null && plugin.onOverrideUrlLoading(url)) {
return true;
}
}
}
return false;
}
示例5: clear
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Clear all markups
* @param args
* @param callbackContext
* @throws JSONException
*/
@SuppressWarnings("unused")
private void clear(JSONArray args, CallbackContext callbackContext) throws JSONException {
Set<String> pluginNames = plugins.keySet();
Iterator<String> iterator = pluginNames.iterator();
String pluginName;
PluginEntry pluginEntry;
while(iterator.hasNext()) {
pluginName = iterator.next();
if ("Map".equals(pluginName) == false) {
pluginEntry = plugins.get(pluginName);
((MyPlugin) pluginEntry.plugin).clear();
}
}
this.map.clear();
this.sendNoResult(callbackContext);
}
示例6: onMarkerClick
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
this.onMarkerEvent("click", marker);
JSONObject properties = null;
String propertyId = "marker_property_" + marker.getId();
PluginEntry pluginEntry = this.plugins.get("Marker");
PluginMarker pluginMarker = (PluginMarker)pluginEntry.plugin;
if (pluginMarker.objects.containsKey(propertyId)) {
properties = (JSONObject) pluginMarker.objects.get(propertyId);
if (properties.has("disableAutoPan")) {
boolean disableAutoPan = false;
try {
disableAutoPan = properties.getBoolean("disableAutoPan");
} catch (JSONException e) {}
if (disableAutoPan) {
//marker.showInfoWindow();
return true;
}
}
}
//marker.showInfoWindow();
return true;
//return false;
}
示例7: postMessage
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Send a message to all plugins.
*
* @param id The message id
* @param data The message data
* @return Object to stop propagation or null
*/
public Object postMessage(String id, Object data) {
Object obj = this.ctx.onMessage(id, data);
if (obj != null) {
return obj;
}
for (PluginEntry entry : this.entries.values()) {
if (entry.plugin != null) {
obj = entry.plugin.onMessage(id, data);
if (obj != null) {
return obj;
}
}
}
return null;
}
示例8: onOverrideUrlLoading
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Called when the URL of the webview changes.
*
* @param url The URL that is being changed to.
* @return Return false to allow the URL to load, return true to prevent the URL from loading.
*/
public boolean onOverrideUrlLoading(String url) {
// Deprecated way to intercept URLs. (process <url-filter> tags).
// Instead, plugins should not include <url-filter> and instead ensure
// that they are loaded before this function is called (either by setting
// the onload <param> or by making an exec() call to them)
for (PluginEntry entry : this.entries.values()) {
List<String> urlFilters = urlMap.get(entry.service);
if (urlFilters != null) {
for (String s : urlFilters) {
if (url.startsWith(s)) {
return getPlugin(entry.service).onOverrideUrlLoading(url);
}
}
} else if (entry.plugin != null) {
if (entry.plugin.onOverrideUrlLoading(url)) {
return true;
}
}
}
return false;
}
示例9: init
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
/**
* Init when loading a new HTML page into webview.
*/
public void init() {
LOG.d(TAG, "init()");
// If first time, then load plugins from config.xml file
if (this.firstRun) {
this.loadPlugins();
this.firstRun = false;
}
// Stop plugins on current HTML page and discard plugin objects
else {
this.onPause(false);
this.onDestroy();
this.clearPluginObjects();
}
// Insert PluginManager service
this.addService(new PluginEntry("PluginManager", new PluginManagerService()));
// Start up all plugins that have onload specified
this.startupPlugins();
}
示例10: init
import org.apache.cordova.PluginEntry; //导入依赖的package包/类
@Override
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries,
Whitelist whitelist, CordovaPreferences preferences) {
if (this.cordova != null) {
throw new IllegalStateException();
}
this.cordova = cordova;
this.whitelist = whitelist;
this.preferences = preferences;
pluginManager = new PluginManager(this, this.cordova, pluginEntries);
resourceApi = new CordovaResourceApi(webview.getContext(), pluginManager);
bridge = new CordovaBridge(pluginManager, new NativeToJsMessageQueue(this, cordova));
pluginManager.addService("App", "org.apache.cordova.CoreAndroid");
initWebViewSettings();
webview.init(this);
exposeJsInterface();
}