Merge "Highlight the current group on group list"
diff --git a/res/drawable/group_list_item_background.xml b/res/drawable/group_list_item_background.xml
new file mode 100644
index 0000000..0e2e604
--- /dev/null
+++ b/res/drawable/group_list_item_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+    <item android:state_activated="true" android:drawable="@drawable/list_activated_holo" />
+    <item android:state_pressed="true" android:drawable="@drawable/list_pressed_holo" />
+    <item android:state_focused="true" android:drawable="@drawable/list_focused_holo" />
+</selector>
\ No newline at end of file
diff --git a/res/layout/group_browse_list_account_header.xml b/res/layout/group_browse_list_account_header.xml
index b1d873d..da6b960 100644
--- a/res/layout/group_browse_list_account_header.xml
+++ b/res/layout/group_browse_list_account_header.xml
@@ -18,6 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginRight="?attr/list_item_padding_right"
     android:minHeight="?attr/list_item_header_height"
     android:orientation="vertical">
 
diff --git a/res/layout/group_browse_list_fragment.xml b/res/layout/group_browse_list_fragment.xml
index c390e67..0d8d4f3 100644
--- a/res/layout/group_browse_list_fragment.xml
+++ b/res/layout/group_browse_list_fragment.xml
@@ -20,6 +20,7 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
+    <!-- See group_browse_list_item.xml for the reason for the transparent android:listSelector -->
     <view
       android:id="@+id/list"
       class="com.android.contacts.widget.AutoScrollListView"
@@ -32,7 +33,8 @@
       android:layout_weight="1"
       android:fadingEdge="none"
       android:cacheColorHint="@android:color/transparent"
-      android:divider="@null" />
+      android:divider="@null"
+      android:listSelector="@android:color/transparent"/>
 
     <TextView
         android:id="@+id/empty"
diff --git a/res/layout/group_browse_list_item.xml b/res/layout/group_browse_list_item.xml
index 6bac5ea..88ff575 100644
--- a/res/layout/group_browse_list_item.xml
+++ b/res/layout/group_browse_list_item.xml
@@ -14,6 +14,17 @@
      limitations under the License.
 -->
 
+<!--
+    Note: Because this item layout contains the header too, we don't want to highlight the entire
+    thing when pressed or set the activated background to it.  So we disable the default hilighting
+    by setting transparent to android:listSelector for the list view in
+    group_browse_list_fragment.xml, and make the body part "duplicateParentState", and then set the
+    state list drawable to its background, which has the "activated" background (the drawable with
+    the triangular thing on the right side).  Because of this structure, the item view can't have
+    paddingRight, as the body part should touch the right edge.  Instead we make each child have
+    either marginRight or paddingRight.
+-->
+
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
@@ -21,7 +32,6 @@
     android:layout_height="wrap_content"
     android:paddingLeft="?attr/list_item_padding_left"
     android:paddingTop="?attr/list_item_padding_top"
-    android:paddingRight="?attr/list_item_padding_right"
     android:paddingBottom="?attr/list_item_padding_bottom"
     android:minHeight="@dimen/detail_min_line_item_height" >
 
@@ -29,6 +39,7 @@
         android:id="@+id/divider"
         android:layout_width="match_parent"
         android:layout_height="1dip"
+        android:layout_marginRight="?attr/list_item_padding_right"
         android:background="?android:attr/listDivider" />
 
     <include
@@ -40,12 +51,15 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingTop="8dip"
-        android:paddingBottom="8dip">
+        android:paddingBottom="8dip"
+        android:duplicateParentState="true"
+        android:background="@drawable/group_list_item_background"
+        >
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:paddingLeft="?attr/list_item_text_indent"
+            android:layout_marginRight="?attr/list_item_padding_right"
             android:orientation="vertical"
             android:layout_toLeftOf="@+id/icons"
             android:layout_alignParentLeft="true"