本文整理汇总了Java中android.webkit.WebView.getUrl方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.getUrl方法的具体用法?Java WebView.getUrl怎么用?Java WebView.getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.getUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onProgressChanged
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M && newProgress == 100) {
final String url = view.getUrl();
if ("about:blank".equals(url)) {
return;
}
final Uri link = Uri.parse(url);
final String target = Kolibri.getInstance(view.getContext()).getTarget(link);
// Skip external targets when reporting to netmetrix
if (!TARGET_EXTERNAL.equals(target)) {
KolibriApp.getInstance().logEvent(null, link.toString());
}
}
for (KolibriWebChromeClient webChromeClient : webChromeClients) {
webChromeClient.onProgressChanged(view, newProgress);
}
}
示例2: a
import android.webkit.WebView; //导入方法依赖的package包/类
public boolean a(WebView webView, String str) {
f.b(b, "-->canHandleUrl---url = " + str);
if (str == null || !Uri.parse(str).getScheme().equals("jsbridge")) {
return false;
}
ArrayList arrayList = new ArrayList(Arrays.asList((str + "/#").split("/")));
if (arrayList.size() < 6) {
return false;
}
String str2 = (String) arrayList.get(2);
String str3 = (String) arrayList.get(3);
List subList = arrayList.subList(4, arrayList.size() - 1);
a aVar = new a(webView, 4, str);
webView.getUrl();
a(str2, str3, subList, aVar);
return true;
}
示例3: url
import android.webkit.WebView; //导入方法依赖的package包/类
/**
* Get the loaded URL
* @return
*/
public String url() {
WebView view = null;
if (this.getView() != null && (view = this.getView().getWebView()) != null) {
return view.getUrl();
}
return "";
}
示例4: onReceivedTitle
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onReceivedTitle(@Nullable WebView view, @Nullable String title) {
if (title != null && !title.isEmpty()) {
mLightningView.getTitleInfo().setTitle(title);
} else {
mLightningView.getTitleInfo().setTitle(mActivity.getString(R.string.untitled));
}
mUIController.tabChanged(mLightningView);
if (view != null && view.getUrl() != null) {
mUIController.updateHistory(title, view.getUrl());
}
}
示例5: setSource
import android.webkit.WebView; //导入方法依赖的package包/类
@ReactProp(name = "source")
public void setSource(WebView view, @Nullable ReadableMap source) {
if (source != null) {
if (source.hasKey("html")) {
String html = source.getString("html");
if (source.hasKey("baseUrl")) {
view.loadDataWithBaseURL(
source.getString("baseUrl"), html, HTML_MIME_TYPE, HTML_ENCODING, null);
} else {
view.loadData(html, HTML_MIME_TYPE, HTML_ENCODING);
}
return;
}
if (source.hasKey("uri")) {
String url = source.getString("uri");
String previousUrl = view.getUrl();
if (previousUrl != null && previousUrl.equals(url)) {
return;
}
if (source.hasKey("method")) {
String method = source.getString("method");
if (method.equals(HTTP_METHOD_POST)) {
byte[] postData = null;
if (source.hasKey("body")) {
String body = source.getString("body");
try {
postData = body.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
postData = body.getBytes();
}
}
if (postData == null) {
postData = new byte[0];
}
view.postUrl(url, postData);
return;
}
}
HashMap<String, String> headerMap = new HashMap<>();
if (source.hasKey("headers")) {
ReadableMap headers = source.getMap("headers");
ReadableMapKeySetIterator iter = headers.keySetIterator();
while (iter.hasNextKey()) {
String key = iter.nextKey();
if ("user-agent".equals(key.toLowerCase(Locale.ENGLISH))) {
if (view.getSettings() != null) {
view.getSettings().setUserAgentString(headers.getString(key));
}
} else {
headerMap.put(key, headers.getString(key));
}
}
}
view.loadUrl(url, headerMap);
return;
}
}
view.loadUrl(BLANK_URL);
}