public class XWalkView
extends android.widget.FrameLayout
XWalkView represents an Android view for web apps/pages. Thus most of attributes for Android view are valid for this class. Since it internally uses android.view.SurfaceView for rendering web pages by default, it can't be resized, rotated, transformed and animated due to the limitations of SurfaceView. Alternatively, XWalkView can be transformed and animated by using TextureView, which is intentionally used to render web pages for animation support. Besides, XWalkView won't be rendered if it's invisible.
Crosswalk provides two ways to choose TextureView or SurfaceView:
XWalkPreferences.ANIMATABLE_XWALK_VIEW to true to use TextureView,
and vice versa. Notice that all XWalkViews share the same preference value.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="AnimatableView">
<attr name="animatable" format="boolean" />
</declare-styleable>
</resources>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xwalk="http://schemas.android.com/apk/res-auto"
......
<org.xwalk.core.XWalkView
android:id="@+id/xwalkview"
android:layout_width="match_parent"
android:layout_height="match_parent"
xwalk:animatable="true" >
</org.xwalk.core.XWalkView>
mXWalkView = (XWalkView) findViewById(R.id.xwalkview);
XWalkView needs hardware acceleration to render web pages. As a result, the AndroidManifest.xml of the caller's app must be appended with the attribute "android:hardwareAccelerated" and its value must be set as "true".
<application android:name="android.app.Application" android:label="XWalkUsers"
android:hardwareAccelerated="true">
Crosswalk provides 2 major callback classes, namely XWalkResourceClient and
XWalkUIClient for listening to the events related to resource loading and UI.
By default, Crosswalk has a default implementation. Callers can override them if needed.
Unlike other Android views, this class has to listen to system events like intents and activity result. The web engine inside this view need to get and handle them. With contianer activity's lifecycle change, XWalkView will pause all timers and other components like videos when activity paused, resume back them when activity resumed. When activity is about to destroy, XWalkView will destroy itself as well. Embedders can also call onHide() and pauseTimers() to explicitly pause XWalkView. Similarily with onShow(), resumeTimers() and onDestroy().
Unlike WebView, you shouldn't use XWalkView directly. It must be accompanied with
XWalkActivity or XWalkInitializer.
For example:
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import org.xwalk.core.XWalkActivity;
import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkUIClient;
import org.xwalk.core.XWalkView;
import org.xwalk.core.XWalkWebResourceRequest;
import org.xwalk.core.XWalkWebResourceResponse;
public class MainActivity extends XWalkActivity {
private XWalkView mXWalkView;
private class MyResourceClient extends XWalkResourceClient {
public MyResourceClient(XWalkView view) {
super(view);
}
@Override
public XWalkWebResourceResponse shouldInterceptLoadRequest(XWalkView view,
XWalkWebResourceRequest request) {
// Handle it here.
// Use createXWalkWebResourceResponse instead of "new XWalkWebResourceResponse"
// to create the response.
// Similar with before, there are two function to use:
// 1) createXWalkWebResourceResponse(String mimeType, String encoding, InputStream data)
// 2) createXWalkWebResourceResponse(String mimeType, String encoding, InputStream data,
// int statusCode, String reasonPhrase, Map<String, String> responseHeaders)
return createXWalkWebResourceResponse("text/html", "UTF-8", null);
}
}
private class MyUIClient extends XWalkUIClient {
public MyUIClient(XWalkView view) {
super(view);
}
@Override
public boolean onCreateWindowRequested(XWalkView view, InitiateBy initiator,
ValueCallback<XWalkView> callback) {
XWalkView newView = new XWalkView(MainActivity.this);
callback.onReceiveValue(newView);
return true;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Until onXWalkReady() is invoked, you should do nothing with the
// embedding API except the following:
// 1. Instantiate the XWalkView object
// 2. Call XWalkPreferences.setValue()
// 3. Call mXWalkView.setXXClient(), e.g., setUIClient
// 4. Call mXWalkView.setXXListener(), e.g., setDownloadListener
// 5. Call mXWalkView.addJavascriptInterface()
setContentView(R.layout.activity_main);
mXWalkView = (XWalkView) findViewById(R.id.xwalkview);
mXWalkView.setResourceClient(new MyResourceClient(mXWalkView));
mXWalkView.setUIClient(new MyUIClient(mXWalkView));
}
@Override
public void onXWalkReady() {
// Do anyting with the embedding API
mXWalkView.load("https://crosswalk-project.org/", null);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mXWalkView != null) {
mXWalkView.onActivityResult(requestCode, resultCode, data);
}
}
@Override
protected void onNewIntent(Intent intent) {
if (mXWalkView != null) {
mXWalkView.onNewIntent(intent);
}
}
}
android.widget.FrameLayout.LayoutParamsandroid.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
static int |
RELOAD_IGNORE_CACHE
Reload mode with bypassing the cache.
|
static int |
RELOAD_NORMAL
Normal reload mode as default.
|
static java.lang.String |
SURFACE_VIEW
SurfaceView is the default compositing surface which has a bit performance advantage,
such as it has less latency and uses less memory.
|
static java.lang.String |
TEXTURE_VIEW
Use TextureView as compositing surface which supports animation on the View.
|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
XWalkView(android.content.Context context)
Constructs a new XWalkView with a Context object.
|
XWalkView(android.content.Context context,
android.app.Activity activity)
Constructor for Crosswalk runtime.
|
XWalkView(android.content.Context context,
android.util.AttributeSet attrs)
Constructor for inflating via XML.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addJavascriptInterface(java.lang.Object object,
java.lang.String name)
Injects the supplied Java object into this XWalkView.
|
boolean |
canZoomIn()
Gets whether this XWalkView can be zoomed in.
|
boolean |
canZoomOut()
Gets whether this XWalkView can be zoomed out.
|
void |
captureBitmapAsync(XWalkGetBitmapCallback callback)
Capture a bitmap of visible content.
|
void |
clearCache(boolean includeDiskFiles)
Clear the resource cache.
|
void |
clearCacheForSingleFile(java.lang.String url)
Clear the resource cache.
|
void |
clearClientCertPreferences(java.lang.Runnable callback)
Clears the client certificate preferences stored in response to
proceeding/cancelling client cert requests.
|
void |
clearFormData()
Removes the autocomplete popup from the currently focused form field, if present.
|
void |
clearMatches()
Clears the highlighting surrounding text matches created by
findAllAsync(java.lang.String). |
void |
clearSslPreferences()
Clears the SSL preferences table stored in response to proceeding with
SSL certificate errors.
|
int |
computeHorizontalScrollOffset()
Compute the horizontal offset of the horizontal scrollbar's
thumb within the horizontal range.
|
int |
computeHorizontalScrollRange()
Compute the horizontal range that the horizontal scrollbar represents.
|
int |
computeVerticalScrollExtent()
Compute the vertical extent of the vertical scrollbar's thumb
within the vertical range.
|
int |
computeVerticalScrollOffset()
Compute the vertical offset the vertical scrollbar's thumb
within the horizontal range.
|
int |
computeVerticalScrollRange()
Compute the vertical range that the vertical scrollbar represents.
|
void |
evaluateJavascript(java.lang.String script,
android.webkit.ValueCallback<java.lang.String> callback)
Evaluate a fragment of JavaScript code and get the result via callback.
|
void |
findAllAsync(java.lang.String searchString)
Finds all instances of find on the page and highlights them asynchronously.
|
void |
findNext(boolean forward)
Highlights and scrolls to the next match found by
findAllAsync(java.lang.String),
wrapping around page boundaries as necessary. |
java.lang.String |
getAPIVersion()
Get the API version of Crosswalk embedding API.
|
protected java.lang.Object |
getBridge() |
android.net.http.SslCertificate |
getCertificate()
Gets the SSL certificate for the main top-level page or null
if there is no certificate (the site is not secure).
|
java.lang.String |
getCompositingSurfaceType()
Gets the compositing surface type of this XWalkView.
|
int |
getContentHeight()
Get the content height of current web page/app.
|
XWalkExternalExtensionManager |
getExtensionManager()
Get the external extension manager for current XWalkView.
|
android.graphics.Bitmap |
getFavicon()
Return the icon which current page has.
|
org.xwalk.core.XWalkHitTestResult |
getHitTestResult()
Get the resource type of hit place in the current page.
|
XWalkNavigationHistory |
getNavigationHistory()
Get the navigation history for current XWalkView.
|
java.lang.String |
getOriginalUrl()
Get the original url specified by caller.
|
android.net.Uri |
getRemoteDebuggingUrl()
Get the websocket url for remote debugging.
|
XWalkSettings |
getSettings()
Get XWalkSettings
|
java.lang.String |
getTitle()
Get the title of current web page/app.
|
java.lang.String |
getUrl()
Get the url of current web page/app.
|
java.lang.String |
getUserAgentString()
Get the user agent of web page/app.
|
java.lang.String |
getXWalkVersion()
Get the Crosswalk version.
|
boolean |
hasEnteredFullscreen()
Indicate that a HTML element is occupying the whole screen.
|
void |
leaveFullscreen()
Leave fullscreen mode if it's.
|
void |
load(java.lang.String url,
java.lang.String content)
Load a web page/app from a given base URL or a content.
|
void |
load(java.lang.String url,
java.lang.String content,
java.util.Map<java.lang.String,java.lang.String> headers)
Load a web page/app from a given base URL or a content with specified HTTP headers
|
void |
loadAppFromManifest(java.lang.String url,
java.lang.String content)
Load a web app from a given manifest.json file.
|
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
Pass through activity result to XWalkView.
|
android.view.inputmethod.InputConnection |
onCreateInputConnection(android.view.inputmethod.EditorInfo outAttrs)
Create a new InputConnection for and InputMethod to interact with the view.
|
void |
onDestroy()
Release internal resources occupied by this XWalkView.
|
void |
onHide()
Pause many other things except JavaScript timers inside rendering engine,
like video player, modal dialogs, etc.
|
boolean |
onNewIntent(android.content.Intent intent)
Pass through intents to XWalkView.
|
void |
onShow()
Resume video player, modal dialogs.
|
boolean |
onTouchEvent(android.view.MotionEvent event) |
void |
pauseTimers()
Pause all layout, parsing and JavaScript timers for all XWalkView instances.
|
void |
postXWalkViewInternalContextActivityConstructor() |
void |
postXWalkViewInternalContextAttributeSetConstructor() |
void |
postXWalkViewInternalContextConstructor() |
void |
reload(int mode)
Reload a web app with a given mode.
|
void |
removeJavascriptInterface(java.lang.String name)
Removes a previously injected Java object from this XWalkView.
|
boolean |
restoreState(android.os.Bundle inState)
Restore the state from the saved bundle data.
|
void |
resumeTimers()
Resume all layout, parsing and JavaScript timers for all XWalkView instances.
|
boolean |
saveState(android.os.Bundle outState)
Save current internal state of this XWalkView.
|
void |
scrollBy(int x,
int y) |
void |
scrollTo(int x,
int y) |
void |
setAcceptLanguages(java.lang.String acceptLanguages)
Set the accept languages of XWalkView.
|
void |
setBackgroundColor(int color) |
void |
setDownloadListener(XWalkDownloadListener listener)
Registers the interface to be used when content can not be handled by
the rendering engine, and should be downloaded instead.
|
void |
setFindListener(XWalkFindListener listener)
Registers the listener to be notified as find-on-page operations progress.
|
void |
setInitialScale(int scaleInPercent)
Sets the initial scale for this XWalkView.
|
void |
setLayerType(int layerType,
android.graphics.Paint paint) |
void |
setNetworkAvailable(boolean networkUp)
This method is used by Cordova for hacking.
|
void |
setOnTouchListener(android.view.View.OnTouchListener l) |
void |
setOriginAccessWhitelist(java.lang.String url,
java.lang.String[] patterns)
Set origin access whitelist.
|
void |
setResourceClient(XWalkResourceClient client)
Embedders use this to customize their handlers to events/callbacks related
to resource loading.
|
void |
setSurfaceViewVisibility(int visibility)
Set the enabled state of SurfaceView.
|
void |
setUIClient(XWalkUIClient client)
Embedders use this to customize their handlers to events/callbacks related
to UI.
|
void |
setUserAgentString(java.lang.String userAgent)
Set the user agent of web page/app.
|
void |
setVisibility(int visibility)
Set the enabled state of this view.
|
void |
setXWalkViewInternalVisibility(int visibility)
Set the enabled state of XWalkView.
|
void |
setZOrderOnTop(boolean onTop)
Control whether the XWalkView's surface is placed on top of its window.
|
void |
startActivityForResult(android.content.Intent intent,
int requestCode,
android.os.Bundle options)
Start another activity to get some data back.
|
void |
stopLoading()
Stop current loading progress.
|
void |
zoomBy(float factor)
Performs a zoom operation in this XWalkView.
|
boolean |
zoomIn()
Performs zoom in in this XWalkView.
|
boolean |
zoomOut()
Performs zoom out in this XWalkView.
|
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getConsiderGoneChildrenWhenMeasuring, getMeasureAllChildren, onLayout, onMeasure, setForegroundGravity, setMeasureAllChildren, shouldDelayChildPressedStateaddChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayoutpublic static final int RELOAD_NORMAL
public static final int RELOAD_IGNORE_CACHE
public static final java.lang.String SURFACE_VIEW
public static final java.lang.String TEXTURE_VIEW
public XWalkView(android.content.Context context)
context - a Context object used to access application assets.public XWalkView(android.content.Context context,
android.util.AttributeSet attrs)
context - a Context object used to access application assets.attrs - an AttributeSet passed to our parent.public XWalkView(android.content.Context context,
android.app.Activity activity)
context - a Context object used to access application assetsactivity - the activity for this XWalkView.protected java.lang.Object getBridge()
public void postXWalkViewInternalContextConstructor()
public void postXWalkViewInternalContextAttributeSetConstructor()
public void postXWalkViewInternalContextActivityConstructor()
public void load(java.lang.String url,
java.lang.String content)
getUrl().
If content is null, try to load the content from the url.
It supports URL schemes like 'http:', 'https:' and 'file:'.
It can also load files from Android assets, e.g. 'file:///android_asset/'.url - the url for web page/app.content - the content for the web page/app. Could be empty.public void load(java.lang.String url,
java.lang.String content,
java.util.Map<java.lang.String,java.lang.String> headers)
url - the url for web page/app.content - the content for the web page/app. Could be empty.headers - the additional HTTP headerspublic void loadAppFromManifest(java.lang.String url,
java.lang.String content)
url - the url for manifest.json.content - the content for manifest.json.public void reload(int mode)
mode - the reload mode.public void stopLoading()
public java.lang.String getUrl()
public org.xwalk.core.XWalkHitTestResult getHitTestResult()
public int getContentHeight()
public java.lang.String getTitle()
public java.lang.String getOriginalUrl()
public XWalkNavigationHistory getNavigationHistory()
public void addJavascriptInterface(java.lang.Object object,
java.lang.String name)
JavascriptInterface if it's called by JavaScript.object - the supplied Java object, called by JavaScript.name - the name injected in JavaScript.public void removeJavascriptInterface(java.lang.String name)
addJavascriptInterface(java.lang.Object, java.lang.String).name - the name used to expose the object in JavaScriptpublic void evaluateJavascript(java.lang.String script,
android.webkit.ValueCallback<java.lang.String> callback)
script - the JavaScript string.callback - the callback to handle the evaluated result.public void clearCache(boolean includeDiskFiles)
includeDiskFiles - indicate whether to clear disk files for cache.public void clearCacheForSingleFile(java.lang.String url)
url - indicate which cache will be cleared.public boolean hasEnteredFullscreen()
public void leaveFullscreen()
public void pauseTimers()
public void resumeTimers()
public void onHide()
pauseTimers() about pausing
JavaScript timers.
It will be called when the container Activity get paused. It can also be explicitly
called to pause above things.public void onShow()
public void onDestroy()
public void startActivityForResult(android.content.Intent intent,
int requestCode,
android.os.Bundle options)
public void onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
requestCode - passed from android.app.Activity.onActivityResult().resultCode - passed from android.app.Activity.onActivityResult().data - passed from android.app.Activity.onActivityResult().public boolean onNewIntent(android.content.Intent intent)
intent - passed from android.app.Activity.onNewIntent().public boolean saveState(android.os.Bundle outState)
outState - the saved state for restoring.public boolean restoreState(android.os.Bundle inState)
inState - the state saved from saveState().public java.lang.String getAPIVersion()
public java.lang.String getXWalkVersion()
public void setUIClient(XWalkUIClient client)
client - the XWalkUIClient defined by callers.public void setResourceClient(XWalkResourceClient client)
client - the XWalkResourceClient defined by callers.public void setBackgroundColor(int color)
setBackgroundColor in class android.view.Viewpublic void setOriginAccessWhitelist(java.lang.String url,
java.lang.String[] patterns)
url - the url for accesssing whitelist.patterns - representing hosts which the application should be able to access.public void setLayerType(int layerType,
android.graphics.Paint paint)
setLayerType in class android.view.Viewpublic void setUserAgentString(java.lang.String userAgent)
userAgent - the user agent string passed from client.public java.lang.String getUserAgentString()
public void setAcceptLanguages(java.lang.String acceptLanguages)
acceptLanguages - the accept languages string passed from client.public void captureBitmapAsync(XWalkGetBitmapCallback callback)
callback - callback to call when the bitmap capture is done.public XWalkSettings getSettings()
public void setNetworkAvailable(boolean networkUp)
public android.net.Uri getRemoteDebuggingUrl()
public boolean zoomIn()
public boolean zoomOut()
public void zoomBy(float factor)
factor - the zoom factor to apply.
The zoom factor will be clamped to the XWalkView's zoom limits.
This value must be in the range 0.01 to 100.0 inclusive.public boolean canZoomIn()
public boolean canZoomOut()
public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo outAttrs)
onCreateInputConnection in class android.view.ViewoutAttrs - Fill in with attribute information about the connectionpublic void setInitialScale(int scaleInPercent)
scaleInPercent - the initial scale in percent.public android.graphics.Bitmap getFavicon()
public void setZOrderOnTop(boolean onTop)
onTop - true for on top.public void clearFormData()
public void setVisibility(int visibility)
setVisibility in class android.view.Viewvisibility - One of VISIBLE, INVISIBLE, or GONE.public void setSurfaceViewVisibility(int visibility)
visibility - One of VISIBLE, INVISIBLE, or GONE.public void setXWalkViewInternalVisibility(int visibility)
visibility - One of VISIBLE, INVISIBLE, or GONE.public void setDownloadListener(XWalkDownloadListener listener)
listener - an implementation of XWalkDownloadListenerpublic boolean onTouchEvent(android.view.MotionEvent event)
onTouchEvent in class android.view.Viewpublic void setOnTouchListener(android.view.View.OnTouchListener l)
setOnTouchListener in class android.view.Viewpublic void scrollTo(int x,
int y)
scrollTo in class android.view.Viewpublic void scrollBy(int x,
int y)
scrollBy in class android.view.Viewpublic int computeHorizontalScrollRange()
computeHorizontalScrollRange in class android.view.Viewpublic int computeHorizontalScrollOffset()
computeHorizontalScrollOffset in class android.view.Viewpublic int computeVerticalScrollRange()
computeVerticalScrollRange in class android.view.Viewpublic int computeVerticalScrollOffset()
computeVerticalScrollOffset in class android.view.Viewpublic int computeVerticalScrollExtent()
computeVerticalScrollExtent in class android.view.Viewpublic XWalkExternalExtensionManager getExtensionManager()
public void clearSslPreferences()
public void clearClientCertPreferences(java.lang.Runnable callback)
public android.net.http.SslCertificate getCertificate()
public void setFindListener(XWalkFindListener listener)
listener - an implementation of XWalkFindListenerpublic void findAllAsync(java.lang.String searchString)
XWalkFindListener.
Successive calls to this will cancel any pending searches.searchString - the string to find.public void findNext(boolean forward)
findAllAsync(java.lang.String),
wrapping around page boundaries as necessary.
Notifies any registered XWalkFindListener.
If findAllAsync(java.lang.String) has not been called yet, or if clearMatches() has been
called since the last find operation, this function does nothing.forward - the direction to searchpublic void clearMatches()
findAllAsync(java.lang.String).public java.lang.String getCompositingSurfaceType()