public class

XWalkUIClient

extends XWalkUIClientInternal
java.lang.Object
   ↳ XWalkUIClientInternal
     ↳ org.xwalk.core.XWalkUIClient

Class Overview

This class notifies the embedder UI events/callbacks.

Summary

Nested Classes
enum XWalkUIClient.JavascriptMessageType The type of JavaScript modal dialog. 
enum XWalkUIClient.LoadStatus The status when a page stopped loading 
Public Constructors
XWalkUIClient(XWalkView view)
Constructor.
Public Methods
void onFullscreenToggled(XWalkView view, boolean enterFullscreen)
Tell the client to toggle fullscreen mode.
void onJavascriptCloseWindow(XWalkView view)
Notify the client to close the given XWalkView.
boolean onJavascriptModalDialog(XWalkView view, XWalkUIClient.JavascriptMessageType type, String url, String message, String defaultValue, XWalkJavascriptResult result)
Tell the client to display a prompt dialog to the user.
void onPageLoadStarted(XWalkView view, String url)
Notify the host application that a page has started loading.
void onPageLoadStopped(XWalkView view, String url, XWalkUIClient.LoadStatus status)
Notify the host application that a page has stopped loading.
void onReceivedTitle(XWalkViewInternal view, String title)
void onReceivedTitle(XWalkView view, String title)
Notify the host application of a change in the document title.
void onRequestFocus(XWalkView view)
Request display and focus for this XWalkView.
void onScaleChanged(XWalkView view, float oldScale, float newScale)
Notify the client that the scale applied to the XWalkView has changed.
void onUnhandledKeyEvent(XWalkView view, KeyEvent event)
Notify the host application that a key was not handled by the XWalkView.
void openFileChooser(XWalkView view, uploadFile, String acceptType, String capture)
Tell the client to open a file chooser.
boolean shouldOverrideKeyEvent(XWalkView view, KeyEvent event)
Give the host application a chance to handle the key event synchronously.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public XWalkUIClient (XWalkView view)

Constructor.

Parameters
view the owner XWalkView instance.

Public Methods

public void onFullscreenToggled (XWalkView view, boolean enterFullscreen)

Tell the client to toggle fullscreen mode.

Parameters
view the owner XWalkView instance.
enterFullscreen true if it has entered fullscreen mode.

public void onJavascriptCloseWindow (XWalkView view)

Notify the client to close the given XWalkView.

Parameters
view the owner XWalkView instance.

public boolean onJavascriptModalDialog (XWalkView view, XWalkUIClient.JavascriptMessageType type, String url, String message, String defaultValue, XWalkJavascriptResult result)

Tell the client to display a prompt dialog to the user.

Parameters
view the owner XWalkView instance.
type the type of JavaScript modal dialog.
url the url of the web page which wants to show this dialog.
message the message to be shown.
defaultValue the default value string. Only valid for Prompt dialog.
result the callback to handle the result from caller.

public void onPageLoadStarted (XWalkView view, String url)

Notify the host application that a page has started loading. This method is called once for each main frame load so a page with iframes or framesets will call onPageLoadStarted one time for the main frame. This also means that onPageLoadStarted will not be called when the contents of an embedded frame changes, i.e. clicking a link whose target is an iframe.

Parameters
view The XWalkView that is initiating the callback.
url The url to be loaded.

public void onPageLoadStopped (XWalkView view, String url, XWalkUIClient.LoadStatus status)

Notify the host application that a page has stopped loading. This method is called only for main frame. When onPageLoadStopped() is called, the rendering picture may not be updated yet. To get the notification for the new Picture, use XWalkView.PictureListener#onNewPicture.

Parameters
view The XWalkView that is initiating the callback.
url The url of the page.
status the status when the page stopped loading.

public void onReceivedTitle (XWalkViewInternal view, String title)

public void onReceivedTitle (XWalkView view, String title)

Notify the host application of a change in the document title.

Parameters
view The XWalkView that initiated the callback.
title A String containing the new title of the document.

public void onRequestFocus (XWalkView view)

Request display and focus for this XWalkView.

Parameters
view the owner XWalkView instance.

public void onScaleChanged (XWalkView view, float oldScale, float newScale)

Notify the client that the scale applied to the XWalkView has changed.

Parameters
view the owner XWalkView instance.
oldScale the old scale before scaling.
newScale the current scale factor after scaling.

public void onUnhandledKeyEvent (XWalkView view, KeyEvent event)

Notify the host application that a key was not handled by the XWalkView. Except system keys, XWalkView always consumes the keys in the normal flow or if shouldOverrideKeyEvent returns true. This is called asynchronously from where the key is dispatched. It gives the host application a chance to handle the unhandled key events.

Parameters
view The XWalkView that is initiating the callback.
event The key event.

public void openFileChooser (XWalkView view, uploadFile, String acceptType, String capture)

Tell the client to open a file chooser.

Parameters
view the owner XWalkView instance.
uploadFile the callback class to handle the result from caller. It MUST be invoked in all cases. Leave it not invoked will block all following requests to open file chooser.
acceptType value of the 'accept' attribute of the input tag associated with this file picker.
capture value of the 'capture' attribute of the input tag associated with this file picker

public boolean shouldOverrideKeyEvent (XWalkView view, KeyEvent event)

Give the host application a chance to handle the key event synchronously. e.g. menu shortcut key events need to be filtered this way. If return true, XWalkView will not handle the key event. If return false, XWalkView will always handle the key event, so none of the super in the view chain will see the key event. The default behavior returns false.

Parameters
view The XWalkView that is initiating the callback.
event The key event.
Returns
  • True if the host application wants to handle the key event itself, otherwise return false