本文整理汇总了Java中android.webkit.WebView.HitTestResult方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.HitTestResult方法的具体用法?Java WebView.HitTestResult怎么用?Java WebView.HitTestResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.HitTestResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateContextMenu
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
WebView.HitTestResult result = webView.getHitTestResult();
if (result != null) {
int type = result.getType();
if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
showLongPressedImageMenu(menu, result.getExtra());
}
}
}
示例2: onCreateContextMenu
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
WebView.HitTestResult result = webView.getHitTestResult();
if (result != null) {
int type = result.getType();
if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
showLongPressedImageMenu(menu, result.getExtra());
}
}
}
示例3: imageLongClicked
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void imageLongClicked(WebView.HitTestResult hitTestResult) {
if (null == hitTestResult)
return;
int type = hitTestResult.getType();
switch (type) {
case WebView.HitTestResult.UNKNOWN_TYPE:
return;
case WebView.HitTestResult.PHONE_TYPE: // 处理拨号
break;
case WebView.HitTestResult.EMAIL_TYPE: // 处理Email
break;
case WebView.HitTestResult.GEO_TYPE:
break;
case WebView.HitTestResult.SRC_ANCHOR_TYPE: // 超链接
break;
case WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE:
break;
case WebView.HitTestResult.IMAGE_TYPE: // 处理长按图片的菜单项
if (mIView != null)
mIView.showPopupWindow();
break;
default:
break;
}
}
示例4: onCreateWindow
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
WebView.HitTestResult result = view.getHitTestResult();
String data = result.getExtra();
WebView.WebViewTransport transport =
(WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(view);
resultMsg.sendToTarget();
return true;
}
示例5: shouldOverrideUrlLoading
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d(TAG, "shouldOverrideUrlLoading() called with: view = [" + view + "], url = " +
"[" + url + "]");
mAddress.setText(url);
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
WebView.HitTestResult hitTestResult = view.getHitTestResult();
//hitTestResult==null解决重定向问题
if (!TextUtils.isEmpty(url) && hitTestResult == null) {
view.loadUrl(url);
return true;
}
return super.shouldOverrideUrlLoading(view, url);
}
示例6: hitLinkResult
import android.webkit.WebView; //导入方法依赖的package包/类
private boolean hitLinkResult(WebView.HitTestResult result) {
return result.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE || result.getType() == HitTestResult.IMAGE_TYPE ||
result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE;
}
示例7: hitLinkResult
import android.webkit.WebView; //导入方法依赖的package包/类
private boolean hitLinkResult(WebView.HitTestResult result) {
return result.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE ||
result.getType() == HitTestResult.IMAGE_TYPE ||
result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE;
}
示例8: imageLongClicked
import android.webkit.WebView; //导入方法依赖的package包/类
/**
* 图片长按事件
*
* @param hitTestResult {@link WebView.HitTestResult}
*/
public abstract void imageLongClicked(WebView.HitTestResult hitTestResult);