Give more space to the close button, and highlight separately from tab.

Fix for http://b/issue?id=2126503 and http://b/issue?id=2124781

Change-Id: I4a83223477e553d124ed667d92bc4970a3ebca0e
diff --git a/src/com/android/browser/ActiveTabsPage.java b/src/com/android/browser/ActiveTabsPage.java
index 9837ad6..2971e09 100644
--- a/src/com/android/browser/ActiveTabsPage.java
+++ b/src/com/android/browser/ActiveTabsPage.java
@@ -16,12 +16,15 @@
 
 package com.android.browser;
 
+import android.content.Context;
+import android.util.AttributeSet;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.TextView;
@@ -74,6 +77,26 @@
         return super.dispatchKeyEvent(event);
     }
 
+    /**
+     * Special class to hold the close drawable.  Its sole purpose is to allow
+     * the parent to be pressed without being pressed itself.  This way the line
+     * of a tab can be pressed, but the close button itself is not.
+     */
+    private static class CloseHolder extends ImageView {
+        public CloseHolder(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        @Override
+        public void setPressed(boolean pressed) {
+            // If the parent is pressed, do not set to pressed.
+            if (pressed && ((View) getParent()).isPressed()) {
+                return;
+            }
+            super.setPressed(pressed);
+        }
+    }
+
     private class TabsListAdapter extends BaseAdapter {
         public int getCount() {
             int count = mControl.getTabCount();