Url bar selection handling updated

    Bug: 3222647
    framework has been updated to change the way tap/double tap
    and long press are handled
    url bar uses a custom action bar to add the share option

Change-Id: Ie75fc07fe71c9e16fc7f83deda8ecddea39b0397
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 7e54710..0aa09db 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -26,12 +26,9 @@
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
-import android.view.ContextMenu;
 import android.view.LayoutInflater;
-import android.view.MenuInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
-import android.view.View.OnFocusChangeListener;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -39,11 +36,10 @@
  * tabbed title bar for xlarge screen browser
  */
 public class TitleBarXLarge extends TitleBarBase
-    implements UrlInputListener, OnClickListener, OnFocusChangeListener {
+    implements UrlInputListener, OnClickListener {
 
     private static final int PROGRESS_MAX = 100;
 
-    private Activity mActivity;
     private UiController mUiController;
 
     private Drawable mStopDrawable;
@@ -67,7 +63,6 @@
 
     public TitleBarXLarge(Activity activity, UiController controller) {
         super(activity);
-        mActivity = activity;
         mUiController = controller;
         Resources resources = activity.getResources();
         mStopDrawable = resources.getDrawable(R.drawable.ic_stop_normal);
@@ -106,25 +101,15 @@
         mGoButton.setOnClickListener(this);
         mClearButton.setOnClickListener(this);
         mUrlFocused.setUrlInputListener(this);
-        mUrlUnfocused.setOnFocusChangeListener(this);
         mUrlFocused.setContainer(mFocusContainer);
+        mUrlFocused.setController(mUiController);
         mUnfocusContainer.setOnClickListener(this);
     }
 
-    public void onFocusChange(View v, boolean hasFocus) {
-        if (hasFocus) {
-            setUrlMode(true);
-            mUrlFocused.selectAll();
-            mUrlFocused.requestFocus();
-            mUrlFocused.setDropDownWidth(mUnfocusContainer.getWidth());
-            mUrlFocused.setDropDownHorizontalOffset(-mUrlFocused.getLeft());
-        }
-    }
-
     @Override
     public void onClick(View v) {
         if (mUnfocusContainer == v) {
-            mUrlUnfocused.requestFocus();
+            setUrlMode(true);
         } else if (mBackButton == v) {
             mUiController.getCurrentTopWebView().goBack();
         } else if (mForwardButton == v) {
@@ -190,6 +175,10 @@
     private void setUrlMode(boolean focused) {
         swapUrlContainer(focused);
         if (focused) {
+            mUrlFocused.selectAll();
+            mUrlFocused.requestFocus();
+            mUrlFocused.setDropDownWidth(mUnfocusContainer.getWidth());
+            mUrlFocused.setDropDownHorizontalOffset(-mUrlFocused.getLeft());
             mSearchButton.setVisibility(View.GONE);
             mGoButton.setVisibility(View.VISIBLE);
         } else {
@@ -203,13 +192,6 @@
         mFocusContainer.setVisibility(focus ? View.VISIBLE : View.GONE);
     }
 
-    @Override
-    public void createContextMenu(ContextMenu menu) {
-        MenuInflater inflater = mActivity.getMenuInflater();
-        inflater.inflate(R.menu.title_context, menu);
-        mActivity.onCreateContextMenu(menu, this, null);
-    }
-
     private void search() {
         setDisplayTitle("");
         mUrlUnfocused.requestFocus();