#############################################
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java
index daeb1de..6bec737 100644
--- a/src/com/android/browser/NavigationBarBase.java
+++ b/src/com/android/browser/NavigationBarBase.java
@@ -172,12 +172,13 @@ public class NavigationBarBase extends LinearLayout implements
boolean wap2estore = SystemProperties.getBoolean(
"persist.env.browser.wap2estore", false);
if ((wap2estore && isEstoreTypeUrl(text))
+ || isWtaiTypeUrl(text)) {
url = text;
} else {
url = UrlUtils.smartUrlFilter(text, false);
}
-
Tab t = mBaseUi.getActiveTab();
// Only shortcut javascript URIs for now, as there is special
// logic in UrlHandler for other schemas
@@ -199,7 +200,19 @@ public class NavigationBarBase extends LinearLayout implements
return;
}
}
+ Log.e(TAG,"bar url = " + url);
+ if (url != null && t != null && isWtaiTypeUrl(url))
+ {
+ if(handleWtaiTypeUrl(url))
+ {
+ return;
+ }
+ }
}
+
Intent i = new Intent();
String action = Intent.ACTION_SEARCH;
i.setAction(action);
@@ -256,6 +269,21 @@ public class NavigationBarBase extends LinearLayout implements
}
}
+ private boolean isWtaiTypeUrl(String url) {
+ String utf8Url = null;
+ try {
+ utf8Url = new String(url.getBytes("UTF-8"), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ Log.e(TAG, "err " + e);
+ }
+ if (utf8Url != null && utf8Url.startsWith("wtai://wp/mc;")) {
+ return true;
+ }
+ return false;
+ }
+
String utf8Url = null;
try {
@@ -269,6 +297,21 @@ public class NavigationBarBase extends LinearLayout implements
return false;
}
+ private boolean handleWtaiTypeUrl(String url) {
+ Intent intent;
+ // perform generic parsing of the URI to turn it into an Intent.
+ intent = new Intent(Intent.ACTION_VIEW, Uri.parse(WebView.SCHEME_TEL + url.substring(("wtai://wp/mc;").length())));
+ try {
+ mContext.startActivity(intent);
+ } catch (ActivityNotFoundException ex) {
+ Log.w("Browser", "No resolveActivity " + url);
+ return false;
+ }
+ return true;
+ }
+
private boolean handleRtspTypeUrl(String url) {
Intent intent;
// perform generic parsing of the URI to turn it into an Intent.
android browser 的几个小feature (三) wtai类型url的处理
原文:http://blog.csdn.net/chaoy1116/article/details/18236165