diff options
-rw-r--r-- | res/menu/browsercontext.xml | 4 | ||||
-rw-r--r-- | src/com/android/browser/Controller.java | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/res/menu/browsercontext.xml b/res/menu/browsercontext.xml index 70cf8d4..f5361d5 100644 --- a/res/menu/browsercontext.xml +++ b/res/menu/browsercontext.xml @@ -57,5 +57,9 @@ <item android:id="@+id/set_wallpaper_context_menu_id" android:title="@string/contextmenu_set_wallpaper"/> </group> + <group android:id="@+id/SELECT_TEXT_MENU"> + <item android:id="@+id/select_text_menu_id" + android:title="@string/select_dot"/> + </group> </menu> diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index aabdb26..83bbc63 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -1193,7 +1193,15 @@ public class Controller menu.setGroupVisible(R.id.ANCHOR_MENU, type == WebView.HitTestResult.SRC_ANCHOR_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE); - + boolean hitText = type == WebView.HitTestResult.SRC_ANCHOR_TYPE + || type == WebView.HitTestResult.PHONE_TYPE + || type == WebView.HitTestResult.EMAIL_TYPE + || type == WebView.HitTestResult.GEO_TYPE; + menu.setGroupVisible(R.id.SELECT_TEXT_MENU, hitText); + if (hitText) { + menu.findItem(R.id.select_text_menu_id) + .setOnMenuItemClickListener(new SelectText(webview)); + } // Setup custom handling depending on the type switch (type) { case WebView.HitTestResult.PHONE_TYPE: @@ -1884,6 +1892,22 @@ public class Controller } } + private static class SelectText implements OnMenuItemClickListener { + private WebView mWebView; + + public boolean onMenuItemClick(MenuItem item) { + if (mWebView != null) { + return mWebView.selectText(); + } + return false; + } + + public SelectText(WebView webView) { + mWebView = webView; + } + + } + /********************** TODO: UI stuff *****************************/ // these methods have been copied, they still need to be cleaned up |