public interface

IX5WebViewClientExtension

com.tencent.smtt.export.external.extension.interfaces.IX5WebViewClientExtension
Known Indirect Subclasses

Class Overview

为了避免app在每次更新sdk后都遇到编译错误,在设置IX5WebViewClientExtension时(setWebViewClientExtension(IX5WebViewClientExtension)) 需要创建ProxyWebViewClientExtension对象并重写需要的方法,不要直接利用接口IX5WebViewClientExtension构建对象, 利用接口构建对象会造成重写全部方法且后续接口增加会造成编译不过的问题

Summary

Public Methods
abstract boolean allowJavaScriptOpenWindowAutomatically(String host, String blockedUrl)
在不允许自动打开新窗口的情况下,当js在非用户操作下打开新窗口被内核拦截时,让宿主再次判断是否允许打开页面
abstract void computeScroll(View view)
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
abstract boolean dispatchTouchEvent(MotionEvent ev, View view)
Pass the touch screen motion event down to the target view, or this view if it is the target.
abstract boolean notifyAutoAudioPlay(String url, JsResult result)
当设置了audio自动播放通知后 setAudioAutoPlayNotify(boolean),如果有自动播放的audio将会回调此接口, 一个audio只回调一次;多个不同audio元素每个audio回调一次
abstract boolean notifyJavaScriptOpenWindowsBlocked(String url, String[] blockedUrlList, ValueCallback<Boolean> callback, boolean hadAllowShow)
当js在非用户操作下打开新页面被内核拦截且宿主也不允许当前页面自动打开时,对应页面会被内核阻止 如果在IX5WebSettingsExtension设置了setJavaScriptOpenWindowsBlockedNotifyEnabled为true时 此时会回调宿主当前拦截的所有页面是否允许被打开,此时宿主可以提示用户是否允许、直接打开拦截页面但仍保持拦截或不做处理 当设置为允许时,后续对应页面的弹窗再被拦截时则会直接按照此授权处理,不再回调该接口通知宿主 如果页面想下次拦截仍被通知,则不需要为callback设置true
abstract void onMetricsSavedCountReceived(String url, boolean isUsedProxy, long usedBytes, String metricsSaved, int apnType)
省流回调
abstract Object onMiscCallBack(String method, Bundle bundle)
内核回调app的杂类接口,通过method字段传递方法名,通过bundle封装对应的参数
abstract void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY, View view)
Called by overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation.
abstract void onPreReadFinished()
预读完成时回调
abstract void onPromptScaleSaved()
缩放比例保存后回调 该功能有开关设置,见setAutoRecoredAndRestoreScaleEnabled(boolean)
abstract void onReceivedSslErrorCancel()
页面遇到SSL异常回调
abstract void onReportAdFilterInfo(int adBlockNum, int popupBlockNum, String url, boolean isMobileSite)
广告过滤结果回调
abstract void onReportResponseHeaders(String url, int type, HashMap<String, String> headers)
请求响应回调
abstract void onScrollChanged(int l, int t, int oldl, int oldt, View view)
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents).
abstract void onSetButtonStatus(boolean textFieldPrev, boolean textFieldNext)
当存在多个输入框内核会通知前后输入框的状态, false说明无对应输入框,true说明对应输入框可用
abstract boolean onShowLongClickPopupMenu()
页面要显示长按菜单时回调该接口, true表示上层拦截了长按菜单(此时内核不再显示长按菜单),false表示上层不做处理内核正常显示长按菜单
abstract void onSoftKeyBoardShow()
输入法显示回调
abstract boolean onTouchEvent(MotionEvent event, View view)
Implement this method to handle touch screen motion events.
abstract boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent, View view)
Scroll the view with standard behavior for scrolling beyond the normal content boundaries.

Public Methods

public abstract boolean allowJavaScriptOpenWindowAutomatically (String host, String blockedUrl)

在不允许自动打开新窗口的情况下,当js在非用户操作下打开新窗口被内核拦截时,让宿主再次判断是否允许打开页面

Parameters
host 页面host
blockedUrl 自动打开的页面url
Returns
  • 是否允许url页面利用新窗口打开blockedUrl, true:允许新窗口打开,false:不允许在新窗口打开

public abstract void computeScroll (View view)

Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. This will typically be done if the child is animating a scroll using a android.widget.Scroller Scroller object.

public abstract boolean dispatchTouchEvent (MotionEvent ev, View view)

Pass the touch screen motion event down to the target view, or this view if it is the target.

Parameters
ev The motion event to be dispatched.
view the view
Returns
  • True if the event was handled by the view, false otherwise.

public abstract boolean notifyAutoAudioPlay (String url, JsResult result)

当设置了audio自动播放通知后 setAudioAutoPlayNotify(boolean),如果有自动播放的audio将会回调此接口, 一个audio只回调一次;多个不同audio元素每个audio回调一次

Parameters
url 页面url
result client端处理后需要调用result的cancel或confirm方法(目前两者无差别)
Returns
  • 返回client是否处理了该通知,如已处理需要返回true并且负责对result的调用,否则返回false内核做默认处理

public abstract boolean notifyJavaScriptOpenWindowsBlocked (String url, String[] blockedUrlList, ValueCallback<Boolean> callback, boolean hadAllowShow)

当js在非用户操作下打开新页面被内核拦截且宿主也不允许当前页面自动打开时,对应页面会被内核阻止 如果在IX5WebSettingsExtension设置了setJavaScriptOpenWindowsBlockedNotifyEnabled为true时 此时会回调宿主当前拦截的所有页面是否允许被打开,此时宿主可以提示用户是否允许、直接打开拦截页面但仍保持拦截或不做处理 当设置为允许时,后续对应页面的弹窗再被拦截时则会直接按照此授权处理,不再回调该接口通知宿主 如果页面想下次拦截仍被通知,则不需要为callback设置true

Parameters
url 页面url
blockedUrlList 被阻止打开的页面url列表
callback true:打开拦截页面且后续不再拦截,false:打开宿主页面后续继续拦截,如果已经做过该操作,则后续回调接口中hadAllowShow为true
hadAllowShow 是否允许展示过该host的弹出窗口,当曾经设置过callback时该值为true,否则为false
Returns
  • 宿主处理了该接口返回true,否则返回false

public abstract void onMetricsSavedCountReceived (String url, boolean isUsedProxy, long usedBytes, String metricsSaved, int apnType)

省流回调

Parameters
url the url
isUsedProxy flag for use proxy
usedBytes =sentBytes+receivedBytes
metricsSaved saved
apnType type

public abstract Object onMiscCallBack (String method, Bundle bundle)

内核回调app的杂类接口,通过method字段传递方法名,通过bundle封装对应的参数

Parameters
method 方法名
bundle 封装对应参数

public abstract void onOverScrolled (int scrollX, int scrollY, boolean clampedX, boolean clampedY, View view)

Called by overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation.

Parameters
scrollX New X scroll value in pixels
scrollY New Y scroll value in pixels
clampedX True if scrollX was clamped to an over-scroll boundary
clampedY True if scrollY was clamped to an over-scroll boundary
view the view

public abstract void onPreReadFinished ()

预读完成时回调

public abstract void onPromptScaleSaved ()

缩放比例保存后回调 该功能有开关设置,见setAutoRecoredAndRestoreScaleEnabled(boolean)

public abstract void onReceivedSslErrorCancel ()

页面遇到SSL异常回调

public abstract void onReportAdFilterInfo (int adBlockNum, int popupBlockNum, String url, boolean isMobileSite)

广告过滤结果回调

Parameters
adBlockNum 过滤的广告数量
popupBlockNum 过滤的弹窗数量
url 页面url
isMobileSite 是否是手机版

public abstract void onReportResponseHeaders (String url, int type, HashMap<String, String> headers)

请求响应回调

Parameters
url 页面URL
type 资源类型
headers 响应头信息

public abstract void onScrollChanged (int l, int t, int oldl, int oldt, View view)

This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). This is typically as a result of scrollBy(int, int) or scrollTo(int, int) having been called.

Parameters
l Current horizontal scroll origin.
t Current vertical scroll origin.
oldl Previous horizontal scroll origin.
oldt Previous vertical scroll origin.
view the view

public abstract void onSetButtonStatus (boolean textFieldPrev, boolean textFieldNext)

当存在多个输入框内核会通知前后输入框的状态, false说明无对应输入框,true说明对应输入框可用

Parameters
textFieldPrev 为true时说明前面一个输入框可用
textFieldNext 为true时说明后面一个输入框可用

public abstract boolean onShowLongClickPopupMenu ()

页面要显示长按菜单时回调该接口, true表示上层拦截了长按菜单(此时内核不再显示长按菜单),false表示上层不做处理内核正常显示长按菜单

public abstract void onSoftKeyBoardShow ()

输入法显示回调

public abstract boolean onTouchEvent (MotionEvent event, View view)

Implement this method to handle touch screen motion events.

Parameters
event The motion event.
view the view
Returns
  • True if the event was handled, false otherwise.

public abstract boolean overScrollBy (int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent, View view)

Scroll the view with standard behavior for scrolling beyond the normal content boundaries. Views that call this method should override onOverScrolled(int, int, boolean, boolean) to respond to the results of an over-scroll operation. Views can use this method to handle any touch or fling-based scrolling.

Parameters
deltaX Change in X in pixels
deltaY Change in Y in pixels
scrollX Current X scroll value in pixels before applying deltaX
scrollY Current Y scroll value in pixels before applying deltaY
scrollRangeX Maximum content scroll range along the X axis
scrollRangeY Maximum content scroll range along the Y axis
maxOverScrollX Number of pixels to overscroll by in either direction along the X axis.
maxOverScrollY Number of pixels to overscroll by in either direction along the Y axis.
isTouchEvent true if this scroll operation is the result of a touch event.
view the view
Returns
  • true if scrolling was clamped to an over-scroll boundary along either axis, false otherwise.