List of usage examples for org.apache.cordova CordovaPlugin CordovaPlugin
CordovaPlugin
From source file:com.zsxsoft.cordova.x5.X5WebChromeClient.java
License:Apache License
public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); parentEngine.cordova.startActivityForResult(new CordovaPlugin() { @Override/*from ww w .j a v a2 s . com*/ public void onActivityResult(int requestCode, int resultCode, Intent intent) { Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); Log.d(LOG_TAG, "Receive file chooser URL: " + result); uploadMsg.onReceiveValue(result); } }, intent, FILECHOOSER_RESULTCODE); }
From source file:com.zsxsoft.cordova.x5.X5WebChromeClient.java
License:Apache License
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/* ww w. j a v a2 s. c o m*/ public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]> filePathsCallback, final FileChooserParams fileChooserParams) { Intent intent = fileChooserParams.createIntent(); try { parentEngine.cordova.startActivityForResult(new CordovaPlugin() { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { Uri[] result = FileChooserParams.parseResult(resultCode, intent); Log.d(LOG_TAG, "Receive file chooser URL: " + result); filePathsCallback.onReceiveValue(result); } }, intent, FILECHOOSER_RESULTCODE); } catch (ActivityNotFoundException e) { Log.w(LOG_TAG, "No activity found to handle file chooser intent." + e); filePathsCallback.onReceiveValue(null); } return true; }
From source file:org.crosswalk.engine.XWalkCordovaUiClient.java
License:Apache License
@Override public void openFileChooser(XWalkView view, final ValueCallback<Uri> uploadFile, String acceptType, String capture) {/*w w w .ja v a2 s .c o m*/ uploadFile.onReceiveValue(null); parentEngine.cordova.setActivityResultCallback(new CordovaPlugin() { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { parentEngine.webView.onActivityResult(requestCode, resultCode, intent); } }); }
From source file:org.crosswalk.engine.XWalkWebViewEngine.java
License:Apache License
@Override public void loadUrl(String url, boolean clearNavigationStack) { if (!activityDelegate.isXWalkReady()) { startUrl = url;/* w ww .j av a2 s . c o m*/ 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:org.jeremyup.cordova.x5engine.X5WebChromeClient.java
License:Apache License
public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); parentEngine.cordova.startActivityForResult(new CordovaPlugin() { @Override//from w w w . j a v a 2 s .com public void onActivityResult(int requestCode, int resultCode, Intent intent) { Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); LOG.d(LOG_TAG, "Receive file chooser URL: " + result); uploadMsg.onReceiveValue(result); } }, intent, FILECHOOSER_RESULTCODE); }
From source file:org.jeremyup.cordova.x5engine.X5WebChromeClient.java
License:Apache License
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]> filePathsCallback, final FileChooserParams fileChooserParams) { Intent intent = fileChooserParams.createIntent(); try {/*from w w w . j a v a2 s. c o m*/ parentEngine.cordova.startActivityForResult(new CordovaPlugin() { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { Uri[] result = FileChooserParams.parseResult(resultCode, intent); LOG.d(LOG_TAG, "Receive file chooser URL: " + result); filePathsCallback.onReceiveValue(result); } }, intent, FILECHOOSER_RESULTCODE); } catch (ActivityNotFoundException e) { LOG.w("No activity found to handle file chooser intent.", e); filePathsCallback.onReceiveValue(null); } return true; }