本文整理匯總了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);