/**
* This class notifies the embedder UI events/callbacks.
*/
+@XWalkAPI(createExternally = true)
public class XWalkUIClientInternal {
// Strings for displaying Dialog.
private View mDecorView;
private XWalkViewInternal mXWalkView;
private boolean mOriginalFullscreen;
+ private boolean mOriginalForceNotFullscreen;
/**
* Constructor.
* @param view the owner XWalkViewInternal instance.
* @since 1.0
*/
+ @XWalkAPI
public XWalkUIClientInternal(XWalkViewInternal view) {
mContext = view.getContext();
mDecorView = view.getActivity().getWindow().getDecorView();
* @param view the owner XWalkViewInternal instance.
* @since 1.0
*/
+ @XWalkAPI
public void onRequestFocus(XWalkViewInternal view) {
}
* @param view the owner XWalkViewInternal instance.
* @since 1.0
*/
+ @XWalkAPI
public void onJavascriptCloseWindow(XWalkViewInternal view) {
if (view != null && view.getActivity() != null) {
view.getActivity().finish();
* The type of JavaScript modal dialog.
* @since 1.0
*/
+ @XWalkAPI
public enum JavascriptMessageTypeInternal {
/** JavaScript alert dialog. */
JAVASCRIPT_ALERT,
* @param result the callback to handle the result from caller.
* @since 1.0
*/
+ @XWalkAPI
public boolean onJavascriptModalDialog(XWalkViewInternal view, JavascriptMessageTypeInternal type,
String url, String message, String defaultValue, XWalkJavascriptResultInternal result) {
switch(type) {
* @param enterFullscreen true if it has entered fullscreen mode.
* @since 1.0
*/
+ @XWalkAPI
public void onFullscreenToggled(XWalkViewInternal view, boolean enterFullscreen) {
Activity activity = view.getActivity();
if (enterFullscreen) {
+ if ((activity.getWindow().getAttributes().flags &
+ WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) != 0) {
+ mOriginalForceNotFullscreen = true;
+ activity.getWindow().clearFlags(
+ WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ } else {
+ mOriginalForceNotFullscreen = false;
+ }
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
mSystemUiFlag = mDecorView.getSystemUiVisibility();
mDecorView.setSystemUiVisibility(
mOriginalFullscreen = true;
} else {
mOriginalFullscreen = false;
- }
- if (!mOriginalFullscreen) {
- activity.getWindow().setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
} else {
+ if (mOriginalForceNotFullscreen) {
+ activity.getWindow().addFlags(
+ WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ }
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
mDecorView.setSystemUiVisibility(mSystemUiFlag);
} else {
* with this file picker
* @since 1.0
*/
+ @XWalkAPI
public void openFileChooser(XWalkViewInternal view, ValueCallback<Uri> uploadFile,
String acceptType, String capture) {
uploadFile.onReceiveValue(null);
* @param newScale the current scale factor after scaling.
* @since 1.0
*/
+ @XWalkAPI
public void onScaleChanged(XWalkViewInternal view, float oldScale, float newScale) {
}
*
* @since 2.1
*/
+ @XWalkAPI
public boolean shouldOverrideKeyEvent(XWalkViewInternal view, KeyEvent event) {
return false;
}
*
* @since 2.1
*/
+ @XWalkAPI
public void onUnhandledKeyEvent(XWalkViewInternal view, KeyEvent event) {
}
* @param title A String containing the new title of the document.
* @since 2.1
*/
+ @XWalkAPI
public void onReceivedTitle(XWalkViewInternal view, String title) {
}
* The status when a page stopped loading
* @since 2.1
*/
+ @XWalkAPI
public enum LoadStatusInternal {
/** Loading finished. */
FINISHED,
*
* @since 2.1
*/
+ @XWalkAPI
public void onPageLoadStarted(XWalkViewInternal view, String url) {
}
/**
* 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 {@link XWalkViewInternal.PictureListener#onNewPicture}.
+ * rendering picture may not be updated yet.
*
* @param view The XWalkViewInternal that is initiating the callback.
* @param url The url of the page.
*
* @since 2.1
*/
+ @XWalkAPI
public void onPageLoadStopped(XWalkViewInternal view, String url, LoadStatusInternal status) {
}