android.webkit.WebView.HitTestResult Java Examples

The following examples show how to use android.webkit.WebView.HitTestResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrowserActivity.java    From browser with GNU General Public License v2.0 5 votes vote down vote up
void openBookmarkUrlLongClick(final String url){
	LightningView lv = getCurrentWebView();
	HitTestResult result = lv.getWebView().getHitTestResult();
	if (url != null) {
		onBookmarkLongClick(url);
	} else if (result != null) {
		if (result.getExtra() != null) {
			final String newUrl = result.getExtra();
			onBookmarkLongClick(newUrl);
		}

	}
}
 
Example #2
Source File: BrowserActivity.java    From browser with GNU General Public License v2.0 5 votes vote down vote up
void openHistoryUrlLongClick(final String url){
	LightningView lv = getCurrentWebView();
	HitTestResult result = lv.getWebView().getHitTestResult();
	if (url != null) {
		onHistoryLongClick(url);
	} else if (result != null) {
		if (result.getExtra() != null) {
			final String newUrl = result.getExtra();
			onHistoryLongClick(newUrl);
		}

	}
}
 
Example #3
Source File: BrowserActivity.java    From browser with GNU General Public License v2.0 4 votes vote down vote up
@Override
/**
 * handles a long click on the page, parameter String url
 * is the url that should have been obtained from the WebView touch node
 * thingy, if it is null, this method tries to deal with it and find a workaround
 */
public void longClickPage(final String url) {
	HitTestResult result = null;

	LightningView lv=getCurrentWebView();

	if(lv==null){
		return;
	}
	if(lv.getUrl().indexOf("http")<0){
		longClickPageFiles(url);
		return;
	}
	if (lv.getWebView() != null) {
		result = getCurrentWebView().getWebView().getHitTestResult();
	}


	if (url != null) {
		if (result != null) {
			if (result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE
					|| result.getType() == HitTestResult.IMAGE_TYPE) {

				final String imageUrl = result.getExtra();
				onImageLongClick(url,imageUrl);

			} else {

				final String extraLink = result.getExtra();
				//result.
				//ToastUtil.showMessage("ex:"+extraLink+" url:"+url);
				onLinkLongClick(url);
			}
		} else {
			onLinkLongClick(url);
		}

	} else if (result != null) {
		if (result.getExtra() != null) {
			final String newUrl = result.getExtra();
			if (result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE
					|| result.getType() == HitTestResult.IMAGE_TYPE) {
				onImageLongClick(newUrl,newUrl);
				//onImageLongClickExtraUrl(newUrl);
			} else {
				onLinkLongClick(newUrl);
			}

		}

	}

}
 
Example #4
Source File: WebViewProvider.java    From android_9.0.0_r45 with Apache License 2.0 votes vote down vote up
public HitTestResult getHitTestResult();