Multiple fixes to browser

- Support dial phone number when input "wtai://wp/mc" scheme in url
- Fix folder creation done button broken in bookmark screen
  when user in landscape mode.

Change-Id: I3978e3ec309c778da6ba214ac556b91585d033ff
diff --git a/res/layout/new_folder_layout.xml b/res/layout/new_folder_layout.xml
index ad9ba4b..dc0fa39 100644
--- a/res/layout/new_folder_layout.xml
+++ b/res/layout/new_folder_layout.xml
@@ -40,6 +40,7 @@
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:textAppearance="?android:attr/textAppearanceMedium"
+        android:inputType="textCapSentences|textNoSuggestions"
         android:background="@null"
         android:gravity="center_vertical"
         android:paddingLeft="6dip"
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index 73a1ebf..a81b1ba 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -201,7 +201,7 @@
                 }
             }
             // Steal the key press; otherwise a newline will be added
-            return true;
+            // return true;
         }
         return false;
     }
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java
index 0cf23ee..22655f2 100644
--- a/src/com/android/browser/NavigationBarBase.java
+++ b/src/com/android/browser/NavigationBarBase.java
@@ -176,7 +176,8 @@
             Class[] type = new Class[] {String.class, boolean.class};
             Boolean wap2estore = (Boolean) ReflectHelper.invokeStaticMethod(
                       "android.os.SystemProperties", "getBoolean", type, params);
-            if ((wap2estore && isEstoreTypeUrl(text)) || isRtspTypeUrl(text)) {
+            if ((wap2estore && isEstoreTypeUrl(text)) || isRtspTypeUrl(text)
+                || isMakeCallTypeUrl(text)) {
                 url = text;
             } else {
                 url = UrlUtils.smartUrlFilter(text, false);
@@ -203,6 +204,12 @@
                     return;
                 }
             }
+            // add for "wtai://wp/mc;" scheme feature
+            if (url != null && t != null && isMakeCallTypeUrl(url)) {
+                if (handleMakeCallTypeUrl(url)) {
+                    return;
+                }
+            }
         }
         Intent i = new Intent();
         String action = Intent.ACTION_SEARCH;
@@ -220,6 +227,41 @@
         setDisplayTitle(text);
     }
 
+    private boolean isMakeCallTypeUrl(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(UrlHandler.SCHEME_WTAI_MC)) {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean handleMakeCallTypeUrl(String url) {
+        // wtai://wp/mc;number
+        // number=string(phone-number)
+        if (url.startsWith(UrlHandler.SCHEME_WTAI_MC)) {
+            Intent intent = new Intent(Intent.ACTION_VIEW,
+                    Uri.parse(WebView.SCHEME_TEL +
+                    url.substring(UrlHandler.SCHEME_WTAI_MC.length())));
+            getContext().startActivity(intent);
+            // before leaving BrowserActivity, close the empty child tab.
+            // If a new tab is created through JavaScript open to load this
+            // url, we would like to close it as we will load this url in a
+            // different Activity.
+            Tab current = mUiController.getCurrentTab();
+            if (current != null
+                    && current.getWebView().copyBackForwardList().getSize() == 0) {
+                mUiController.closeCurrentTab();
+            }
+            return true;
+        }
+        return false;
+    }
+
     private boolean isEstoreTypeUrl(String url) {
         String utf8Url = null;
         try {