org.xwalk.core.XWalkUIClient Java Examples

The following examples show how to use org.xwalk.core.XWalkUIClient. 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: XWalkCordovaView.java    From cordova-crosswalk-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void setUIClient(XWalkUIClient client) {
    // XWalk calls this method from its constructor.
    if (client instanceof XWalkCordovaUiClient) {
        this.uiClient = (XWalkCordovaUiClient)client;
    }
    super.setUIClient(client);
}
 
Example #2
Source File: CornUIClient.java    From Cornowser with MIT License 4 votes vote down vote up
@Override
public boolean onJavascriptModalDialog(XWalkView view, XWalkUIClient.JavascriptMessageType type,
                                       String url, String message, String defaultValue, XWalkJavascriptResult result) {
    return super.onJavascriptModalDialog(view, type, url, message, defaultValue, result);
}
 
Example #3
Source File: EmbeddedBrowserActivity.java    From medic-android with GNU Affero General Public License v3.0 4 votes vote down vote up
private void setUpUiClient(XWalkView container) {
	container.setUIClient(new XWalkUIClient(container) {
		/** Not applicable for Crosswalk.  TODO find alternative and remove this
		@Override public boolean onConsoleMessage(ConsoleMessage cm) {
			if(!DEBUG) {
				return super.onConsoleMessage(cm);
			}

			trace(this, "onConsoleMessage() :: %s:%s | %s",
					cm.sourceId(),
					cm.lineNumber(),
					cm.message());
			return true;
		} */

		@Override public void openFileChooser(XWalkView view, ValueCallback<Uri> callback, String acceptType, String shouldCapture) {
			if(DEBUG) trace(this, "openFileChooser() :: %s,%s,%s,%s", view, callback, acceptType, shouldCapture);

			boolean capture = parseBoolean(shouldCapture);

			if(photoGrabber.canHandle(acceptType, capture)) {
				photoGrabber.chooser(callback, capture);
			} else {
				logToJsConsole("No file chooser is currently implemented for \"accept\" value: %s", acceptType);
				warn(this, "openFileChooser() :: No file chooser is currently implemented for \"accept\" value: %s", acceptType);
			}
		}

		/*
		 * TODO Crosswalk: re-enable this if required
		public void onGeolocationPermissionsShowPrompt(
				String origin,
				GeolocationPermissions.Callback callback) {
			// allow all location requests
			// TODO this should be restricted to the domain
			// set in Settings - issue #1603
			trace(this, "onGeolocationPermissionsShowPrompt() :: origin=%s, callback=%s",
					origin, callback);
			callback.invoke(origin, true, true);
		}
		*/
	});
}