public class AdvancedWebView
extends android.webkit.WebView
| Modifier and Type | Class and Description |
|---|---|
static class |
AdvancedWebView.Browsers
Wrapper for methods related to alternative browsers that have their own rendering engines
|
static interface |
AdvancedWebView.Listener |
android.webkit.WebView.FindListener, android.webkit.WebView.HitTestResult, android.webkit.WebView.PictureListener, android.webkit.WebView.WebViewTransportandroid.widget.AbsoluteLayout.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.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.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String[] |
ALTERNATIVE_BROWSERS
Alternative browsers that have their own rendering engine and *may* be installed on this device
|
protected static java.lang.String |
CHARSET_DEFAULT |
protected static java.lang.String |
DATABASES_SUB_FOLDER |
protected static java.lang.String |
LANGUAGE_DEFAULT_ISO3 |
protected java.lang.ref.WeakReference<android.app.Activity> |
mActivity |
protected android.webkit.WebChromeClient |
mCustomWebChromeClient |
protected android.webkit.WebViewClient |
mCustomWebViewClient |
protected android.webkit.ValueCallback<android.net.Uri> |
mFileUploadCallbackFirst
File upload callback for platform versions prior to Android 5.0
|
protected android.webkit.ValueCallback<android.net.Uri[]> |
mFileUploadCallbackSecond
File upload callback for Android 5.0+
|
protected java.lang.ref.WeakReference<android.app.Fragment> |
mFragment |
protected boolean |
mGeolocationEnabled |
protected java.util.Map<java.lang.String,java.lang.String> |
mHttpHeaders |
protected java.lang.String |
mLanguageIso3 |
protected long |
mLastError |
protected AdvancedWebView.Listener |
mListener |
protected java.util.List<java.lang.String> |
mPermittedHostnames |
protected int |
mRequestCodeFilePicker |
protected java.lang.String |
mUploadableFileTypes |
static java.lang.String |
PACKAGE_NAME_DOWNLOAD_MANAGER |
protected static int |
REQUEST_CODE_FILE_PICKER |
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, 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_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_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 |
|---|
AdvancedWebView(android.content.Context context) |
AdvancedWebView(android.content.Context context,
android.util.AttributeSet attrs) |
AdvancedWebView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHttpHeader(java.lang.String name,
java.lang.String value)
Adds an additional HTTP header that will be sent along with every HTTP `GET` request
This does only affect the main requests, not the requests to included resources (e.g.
|
void |
addPermittedHostname(java.lang.String hostname) |
void |
addPermittedHostnames(java.util.Collection<? extends java.lang.String> collection) |
void |
clearPermittedHostnames() |
protected static java.lang.String |
decodeBase64(java.lang.String base64) |
protected java.lang.String |
getFileUploadPromptLabel()
Provides localizations for the 25 most widely spoken languages that have a ISO 639-2/T code
|
protected static java.lang.String |
getLanguageIso3() |
java.util.List<java.lang.String> |
getPermittedHostnames() |
static boolean |
handleDownload(android.content.Context context,
java.lang.String fromUrl,
java.lang.String toFilename)
Handles a download by loading the file from `fromUrl` and saving it to `toFilename` on the external storage
This requires the two permissions `android.permission.INTERNET` and `android.permission.WRITE_EXTERNAL_STORAGE`
Only supported on API level 9 (Android 2.3) and above
|
protected boolean |
hasError() |
protected void |
init(android.content.Context context) |
static boolean |
isFileUploadAvailable()
Returns whether file uploads can be used on the current device (generally all platform versions except for 4.4)
|
static boolean |
isFileUploadAvailable(boolean needsCorrectMimeType)
Returns whether file uploads can be used on the current device (generally all platform versions except for 4.4)
On Android 4.4.3/4.4.4, file uploads may be possible but will come with a wrong MIME type
|
protected boolean |
isHostnameAllowed(java.lang.String url)
Deprecated.
use `isPermittedUrl` instead
|
boolean |
isPermittedUrl(java.lang.String url) |
void |
loadHtml(java.lang.String html)
Loads and displays the provided HTML source text
|
void |
loadHtml(java.lang.String html,
java.lang.String baseUrl)
Loads and displays the provided HTML source text
|
void |
loadHtml(java.lang.String html,
java.lang.String baseUrl,
java.lang.String historyUrl)
Loads and displays the provided HTML source text
|
void |
loadHtml(java.lang.String html,
java.lang.String baseUrl,
java.lang.String historyUrl,
java.lang.String encoding)
Loads and displays the provided HTML source text
|
void |
loadUrl(java.lang.String url) |
void |
loadUrl(java.lang.String url,
boolean preventCaching) |
void |
loadUrl(java.lang.String url,
boolean preventCaching,
java.util.Map<java.lang.String,java.lang.String> additionalHttpHeaders) |
void |
loadUrl(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> additionalHttpHeaders) |
protected static java.lang.String |
makeUrlUnique(java.lang.String url) |
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent intent) |
boolean |
onBackPressed() |
void |
onDestroy() |
void |
onPause() |
void |
onResume() |
protected void |
openFileInput(android.webkit.ValueCallback<android.net.Uri> fileUploadCallbackFirst,
android.webkit.ValueCallback<android.net.Uri[]> fileUploadCallbackSecond,
boolean allowMultiple) |
void |
removeHttpHeader(java.lang.String name)
Removes one of the HTTP headers that have previously been added via `addHttpHeader()`
If you want to unset a pre-defined header, set it to an empty string with `addHttpHeader()` instead
The `WebView` implementation may in some cases overwrite headers that you set or unset
|
void |
removePermittedHostname(java.lang.String hostname) |
protected static void |
setAllowAccessFromFileUrls(android.webkit.WebSettings webSettings,
boolean allowed) |
void |
setCookiesEnabled(boolean enabled) |
void |
setDesktopMode(boolean enabled) |
protected void |
setGeolocationDatabasePath() |
void |
setGeolocationEnabled(boolean enabled) |
protected void |
setLastError() |
void |
setListener(android.app.Activity activity,
AdvancedWebView.Listener listener) |
void |
setListener(android.app.Activity activity,
AdvancedWebView.Listener listener,
int requestCodeFilePicker) |
protected void |
setListener(AdvancedWebView.Listener listener,
int requestCodeFilePicker) |
void |
setListener(android.app.Fragment fragment,
AdvancedWebView.Listener listener) |
void |
setListener(android.app.Fragment fragment,
AdvancedWebView.Listener listener,
int requestCodeFilePicker) |
void |
setMixedContentAllowed(boolean allowed) |
protected void |
setMixedContentAllowed(android.webkit.WebSettings webSettings,
boolean allowed) |
void |
setThirdPartyCookiesEnabled(boolean enabled) |
void |
setUploadableFileTypes(java.lang.String mimeType) |
void |
setWebChromeClient(android.webkit.WebChromeClient client) |
void |
setWebViewClient(android.webkit.WebViewClient client) |
addJavascriptInterface, canGoBack, canGoBackOrForward, canGoForward, canZoomIn, canZoomOut, capturePicture, clearCache, clearClientCertPreferences, clearFormData, clearHistory, clearMatches, clearSslPreferences, clearView, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, copyBackForwardList, createPrintDocumentAdapter, createPrintDocumentAdapter, destroy, dispatchDraw, dispatchKeyEvent, documentHasImages, enableSlowWholeDocumentDraw, evaluateJavascript, findAddress, findAll, findAllAsync, findNext, flingScroll, freeMemory, getAccessibilityNodeProvider, getCertificate, getContentHeight, getFavicon, getHitTestResult, getHttpAuthUsernamePassword, getOriginalUrl, getProgress, getScale, getSettings, getTitle, getUrl, goBack, goBackOrForward, goForward, invokeZoomPicker, isPrivateBrowsingEnabled, loadData, loadDataWithBaseURL, onAttachedToWindow, onChildViewAdded, onChildViewRemoved, onConfigurationChanged, onCreateInputConnection, onDraw, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onGlobalFocusChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyMultiple, onKeyUp, onMeasure, onOverScrolled, onScrollChanged, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, overlayHorizontalScrollbar, overlayVerticalScrollbar, pageDown, pageUp, pauseTimers, performAccessibilityAction, performLongClick, postUrl, reload, removeJavascriptInterface, requestChildRectangleOnScreen, requestFocus, requestFocusNodeHref, requestImageRef, restoreState, resumeTimers, savePassword, saveState, saveWebArchive, saveWebArchive, setBackgroundColor, setCertificate, setDownloadListener, setFindListener, setHorizontalScrollbarOverlay, setHttpAuthUsernamePassword, setInitialScale, setLayerType, setLayoutParams, setMapTrackballToArrowKeys, setNetworkAvailable, setOverScrollMode, setPictureListener, setScrollBarStyle, setVerticalScrollbarOverlay, setWebContentsDebuggingEnabled, shouldDelayChildPressedState, showFindDialog, stopLoading, zoomBy, zoomIn, zoomOutcheckLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, onLayoutaddChildrenForAccessibility, 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, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableHotspotChanged, 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, onAnimationEnd, onAnimationStart, onCreateDrawableState, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestDisallowInterceptTouchEvent, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, 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, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, 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, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, 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, 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, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onCreateContextMenu, onDisplayHint, onDragEvent, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onHoverChanged, onKeyLongPress, onKeyPreIme, onKeyShortcut, onPopulateAccessibilityEvent, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onSetAlpha, onWindowSystemUiVisibilityChanged, overScrollBy, performClick, performHapticFeedback, performHapticFeedback, 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, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setActivated, setAlpha, setAnimation, setBackground, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayoutDirection, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, 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 java.lang.String PACKAGE_NAME_DOWNLOAD_MANAGER
protected static final int REQUEST_CODE_FILE_PICKER
protected static final java.lang.String DATABASES_SUB_FOLDER
protected static final java.lang.String LANGUAGE_DEFAULT_ISO3
protected static final java.lang.String CHARSET_DEFAULT
protected static final java.lang.String[] ALTERNATIVE_BROWSERS
protected java.lang.ref.WeakReference<android.app.Activity> mActivity
protected java.lang.ref.WeakReference<android.app.Fragment> mFragment
protected AdvancedWebView.Listener mListener
protected final java.util.List<java.lang.String> mPermittedHostnames
protected android.webkit.ValueCallback<android.net.Uri> mFileUploadCallbackFirst
protected android.webkit.ValueCallback<android.net.Uri[]> mFileUploadCallbackSecond
protected long mLastError
protected java.lang.String mLanguageIso3
protected int mRequestCodeFilePicker
protected android.webkit.WebViewClient mCustomWebViewClient
protected android.webkit.WebChromeClient mCustomWebChromeClient
protected boolean mGeolocationEnabled
protected java.lang.String mUploadableFileTypes
protected final java.util.Map<java.lang.String,java.lang.String> mHttpHeaders
public AdvancedWebView(android.content.Context context)
public AdvancedWebView(android.content.Context context,
android.util.AttributeSet attrs)
public AdvancedWebView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
public void setListener(android.app.Activity activity,
AdvancedWebView.Listener listener)
public void setListener(android.app.Activity activity,
AdvancedWebView.Listener listener,
int requestCodeFilePicker)
public void setListener(android.app.Fragment fragment,
AdvancedWebView.Listener listener)
public void setListener(android.app.Fragment fragment,
AdvancedWebView.Listener listener,
int requestCodeFilePicker)
protected void setListener(AdvancedWebView.Listener listener, int requestCodeFilePicker)
public void setWebViewClient(android.webkit.WebViewClient client)
setWebViewClient in class android.webkit.WebViewpublic void setWebChromeClient(android.webkit.WebChromeClient client)
setWebChromeClient in class android.webkit.WebViewpublic void setGeolocationEnabled(boolean enabled)
protected void setGeolocationDatabasePath()
public void setUploadableFileTypes(java.lang.String mimeType)
public void loadHtml(java.lang.String html)
html - the HTML source text to loadpublic void loadHtml(java.lang.String html,
java.lang.String baseUrl)
html - the HTML source text to loadbaseUrl - the URL to use as the page's base URLpublic void loadHtml(java.lang.String html,
java.lang.String baseUrl,
java.lang.String historyUrl)
html - the HTML source text to loadbaseUrl - the URL to use as the page's base URLhistoryUrl - the URL to use for the page's history entrypublic void loadHtml(java.lang.String html,
java.lang.String baseUrl,
java.lang.String historyUrl,
java.lang.String encoding)
html - the HTML source text to loadbaseUrl - the URL to use as the page's base URLhistoryUrl - the URL to use for the page's history entryencoding - the encoding or charset of the HTML source textpublic void onResume()
onResume in class android.webkit.WebViewpublic void onPause()
onPause in class android.webkit.WebViewpublic void onDestroy()
public void onActivityResult(int requestCode,
int resultCode,
android.content.Intent intent)
public void addHttpHeader(java.lang.String name,
java.lang.String value)
name - the name of the HTTP header to addvalue - the value of the HTTP header to sendpublic void removeHttpHeader(java.lang.String name)
name - the name of the HTTP header to removepublic void addPermittedHostname(java.lang.String hostname)
public void addPermittedHostnames(java.util.Collection<? extends java.lang.String> collection)
public java.util.List<java.lang.String> getPermittedHostnames()
public void removePermittedHostname(java.lang.String hostname)
public void clearPermittedHostnames()
public boolean onBackPressed()
protected static void setAllowAccessFromFileUrls(android.webkit.WebSettings webSettings,
boolean allowed)
public void setCookiesEnabled(boolean enabled)
public void setThirdPartyCookiesEnabled(boolean enabled)
public void setMixedContentAllowed(boolean allowed)
protected void setMixedContentAllowed(android.webkit.WebSettings webSettings,
boolean allowed)
public void setDesktopMode(boolean enabled)
protected void init(android.content.Context context)
public void loadUrl(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> additionalHttpHeaders)
loadUrl in class android.webkit.WebViewpublic void loadUrl(java.lang.String url)
loadUrl in class android.webkit.WebViewpublic void loadUrl(java.lang.String url,
boolean preventCaching)
public void loadUrl(java.lang.String url,
boolean preventCaching,
java.util.Map<java.lang.String,java.lang.String> additionalHttpHeaders)
protected static java.lang.String makeUrlUnique(java.lang.String url)
public boolean isPermittedUrl(java.lang.String url)
protected boolean isHostnameAllowed(java.lang.String url)
protected void setLastError()
protected boolean hasError()
protected static java.lang.String getLanguageIso3()
protected java.lang.String getFileUploadPromptLabel()
protected static java.lang.String decodeBase64(java.lang.String base64)
throws java.lang.IllegalArgumentException,
java.io.UnsupportedEncodingException
java.lang.IllegalArgumentExceptionjava.io.UnsupportedEncodingExceptionprotected void openFileInput(android.webkit.ValueCallback<android.net.Uri> fileUploadCallbackFirst,
android.webkit.ValueCallback<android.net.Uri[]> fileUploadCallbackSecond,
boolean allowMultiple)
public static boolean isFileUploadAvailable()
public static boolean isFileUploadAvailable(boolean needsCorrectMimeType)
needsCorrectMimeType - whether a correct MIME type is required for file uploads or `application/octet-stream` is acceptablepublic static boolean handleDownload(android.content.Context context,
java.lang.String fromUrl,
java.lang.String toFilename)
context - a valid `Context` referencefromUrl - the URL of the file to download, e.g. the one from `AdvancedWebView.onDownloadRequested(...)`toFilename - the name of the destination file where the download should be saved, e.g. `myImage.jpg`java.lang.IllegalStateException - if the storage or the target directory could not be found or accessed