Contact picker/group list pixel-perfect

There are still a few issues to be fixed around picker
stuff, but it looks basically fine enough.

- fix misc padding issues around contact listing itself
- introduce conditional padding for phone search view to keep
  top padding consistency
- keep consistency between group and contact listing
- remove "groups per account" count
- stop showing quick scroll bar in group list

Bug: 5137457
Bug: 5144140
Bug: 5143350
Bug: 5080599
Change-Id: I038c112bbf9e956e9a2b784178c0360d03e3f333
diff --git a/res/layout/contact_detail_list_item.xml b/res/layout/contact_detail_list_item.xml
index ccfa01d..e292f39 100644
--- a/res/layout/contact_detail_list_item.xml
+++ b/res/layout/contact_detail_list_item.xml
@@ -24,8 +24,8 @@
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     android:gravity="center_vertical"
-    android:paddingTop="12dip"
-    android:paddingBottom="12dip"
+    android:paddingTop="8dip"
+    android:paddingBottom="8dip"
     android:minHeight="@dimen/detail_min_line_item_height">
 
     <!-- Note: padding might be controlled programatically -->
diff --git a/res/layout/contact_detail_list_padding.xml b/res/layout/contact_detail_list_padding.xml
new file mode 100644
index 0000000..8095731
--- /dev/null
+++ b/res/layout/contact_detail_list_padding.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- The actual padding is embedded in a FrameLayout since we cannot change the
+     visibility of a header view in a ListView without having a parent view. -->
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+    <View
+        android:id="@+id/contact_detail_list_padding"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/contact_browser_list_top_margin" />
+</FrameLayout>
+
diff --git a/res/layout/contact_picker.xml b/res/layout/contact_picker.xml
index c3fe2fa..96bf334 100644
--- a/res/layout/contact_picker.xml
+++ b/res/layout/contact_picker.xml
@@ -18,8 +18,6 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     class="com.android.contacts.widget.FullHeightLinearLayout"
     style="@style/ContactPickerLayout"
-    android:paddingLeft="8dip"
-    android:paddingRight="8dip"
     android:orientation="vertical"
     android:layout_height="match_parent">
     <view
@@ -27,18 +25,18 @@
         android:id="@+id/search_view"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="10dip"
-        android:layout_marginRight="10dip"
-        android:layout_marginBottom="10dip"
+        android:layout_marginLeft="0dip"
+        android:layout_marginRight="32dip"
         android:iconifiedByDefault="false" />
+    <!-- will contain an appropriate contacts list -->
     <FrameLayout
+        android:id="@+id/list_container"
         android:layout_width="match_parent"
         android:layout_height="0dip"
-        android:layout_weight="1"
-        android:id="@+id/list_container">
-    </FrameLayout>
+        android:layout_weight="1" />
 
     <View
+        android:id="@+id/divider"
         android:layout_width="match_parent"
         android:layout_height="1dip"
         android:layout_marginLeft="16dip"
@@ -48,7 +46,9 @@
     <LinearLayout
         style="?android:attr/buttonBarStyle"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:paddingLeft="16dip"
+        android:paddingRight="16dip">
         <Button
             style="?android:attr/buttonBarButtonStyle"
             android:id="@+id/cancel"
diff --git a/res/layout/contact_picker_content.xml b/res/layout/contact_picker_content.xml
index 6792f9c..c30add7 100644
--- a/res/layout/contact_picker_content.xml
+++ b/res/layout/contact_picker_content.xml
@@ -26,6 +26,8 @@
         android:id="@android:id/list"
         android:layout_width="match_parent"
         android:layout_height="0dip"
+        android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+        android:layout_marginRight="?attr/contact_browser_list_padding_right"
         android:fastScrollEnabled="true"
         android:layout_weight="1" />
 
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contacts_list_content.xml
index f98d751..66c3936 100644
--- a/res/layout/contacts_list_content.xml
+++ b/res/layout/contacts_list_content.xml
@@ -22,17 +22,19 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/pinned_header_list_layout"
-    android:paddingTop="@dimen/contact_browser_list_top_margin"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
 
-    <!-- Shown only when an Account filter is set. -->
+    <!-- Shown only when an Account filter is set.
+         - paddingTop should be here to show "shade" effect correctly. -->
     <LinearLayout
         android:id="@+id/account_filter_header_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:minHeight="?attr/list_item_header_height"
         android:orientation="vertical"
+        android:paddingTop="@dimen/contact_browser_list_top_margin"
         android:layout_marginLeft="@dimen/contact_browser_list_header_left_margin"
         android:layout_marginRight="@dimen/contact_browser_list_header_right_margin"
         android:visibility="gone">
@@ -40,11 +42,9 @@
             android:id="@+id/account_filter_header"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:minHeight="@dimen/contact_filter_header_min_height"
             android:singleLine="true"
             android:ellipsize="end"
             android:textStyle="bold"
-            android:gravity="left|center_vertical"
             android:textAllCaps="true"
             android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
             android:textAppearance="?android:attr/textAppearanceSmall"
@@ -59,9 +59,9 @@
         class="com.android.contacts.list.ContactEntryListView"
         android:id="@android:id/list"
         android:layout_width="match_parent"
-           android:layout_height="0dip"
-           android:layout_marginLeft="@dimen/contact_browser_list_left_margin"
-        android:layout_marginRight="@dimen/contact_browser_list_right_margin"
+        android:layout_height="0dip"
+        android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+        android:layout_marginRight="?attr/contact_browser_list_padding_right"
         android:fastScrollEnabled="true"
         android:layout_weight="1" />
 
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
index af0b5bd..6043c7b 100644
--- a/res/layout/directory_header.xml
+++ b/res/layout/directory_header.xml
@@ -19,12 +19,14 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     style="@style/DirectoryHeader"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:minHeight="?attr/list_item_header_height"
+    android:paddingLeft="?attr/list_item_padding_left"
+    android:paddingRight="?attr/list_item_padding_right">
     <TextView
         android:id="@+id/display_name"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:minHeight="@dimen/directory_header_height"
         android:layout_toRightOf="@+id/label"
         android:layout_toLeftOf="@+id/count"
         android:layout_centerVertical="true"
@@ -32,7 +34,9 @@
         android:layout_marginRight="8dip"
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textColor="?android:attr/textColorSecondary"
-        android:singleLine="true" />
+        android:singleLine="true"
+        android:textStyle="bold"
+        android:textAllCaps="true" />
     <TextView
         android:id="@+id/label"
         android:layout_width="wrap_content"
@@ -41,16 +45,19 @@
         android:layout_alignBaseline="@id/display_name"
         android:layout_marginLeft="8dip"
         android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary" />
+        android:textColor="?android:attr/textColorSecondary"
+        android:singleLine="true"
+        android:textStyle="bold"
+        android:textAllCaps="true" />
     <TextView
         android:id="@+id/count"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
-        android:layout_marginRight="8dip"
         android:layout_alignBaseline="@id/display_name"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary" />
+        android:singleLine="true"
+        android:textSize="12sp"
+        android:textColor="@color/contact_count_text_color" />
     <View
         android:id="@+id/contact_filter_header_bottom_divider"
         style="@style/SectionDivider"
diff --git a/res/layout/group_browse_list_account_header.xml b/res/layout/group_browse_list_account_header.xml
index f739ea2..b1d873d 100644
--- a/res/layout/group_browse_list_account_header.xml
+++ b/res/layout/group_browse_list_account_header.xml
@@ -18,54 +18,43 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@drawable/list_background_holo"
-    android:paddingLeft="@dimen/group_list_header_padding"
-    android:paddingRight="@dimen/group_list_header_padding"
-    android:paddingTop="@dimen/group_list_header_padding"
+    android:minHeight="?attr/list_item_header_height"
     android:orientation="vertical">
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:paddingLeft="?attr/list_item_header_text_indent"
         android:orientation="horizontal">
 
         <TextView
             android:id="@+id/account_type"
-            android:layout_width="wrap_content"
+            android:layout_width="0px"
             android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:layout_weight="1"
+            android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="@color/people_app_theme_color"
             android:textStyle="bold"
             android:textAllCaps="true"
             android:singleLine="true"/>
 
+        <!-- TODO: Shold use correct color with a correct name (content should be same).
+             can use "?android:attr/textColorTertiary" -->
         <TextView
             android:id="@+id/account_name"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:layout_marginLeft="@dimen/group_list_header_padding"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:singleLine="true"
-            android:ellipsize="middle"
-            android:textColor="@color/people_app_theme_color"/>
-
-        <TextView
-            android:id="@+id/group_count"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:gravity="right"
-            android:singleLine="true"
-            android:layout_marginLeft="@dimen/group_list_header_padding"
+            android:layout_gravity="center_vertical"
             android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="?android:attr/textColorTertiary"/>
-
+            android:textColor="@color/contact_count_text_color"
+            android:textSize="12sp"
+            android:singleLine="true"
+            android:ellipsize="middle" />
     </LinearLayout>
 
     <View
         android:layout_width="match_parent"
         android:layout_height="1dip"
-        android:layout_marginTop="@dimen/group_list_header_padding"
-        android:background="@color/people_app_theme_color"/>
+        android:background="@color/people_app_theme_color" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/group_browse_list_fragment.xml b/res/layout/group_browse_list_fragment.xml
index 9e6bd27..6e82e8f 100644
--- a/res/layout/group_browse_list_fragment.xml
+++ b/res/layout/group_browse_list_fragment.xml
@@ -25,20 +25,23 @@
       class="com.android.contacts.widget.AutoScrollListView"
       android:layout_width="match_parent"
       android:layout_height="0dip"
-      android:fastScrollEnabled="true"
+      android:paddingTop="@dimen/contact_browser_list_top_margin"
+      android:paddingLeft="16dip"
+      android:paddingRight="16dip"
       android:scrollbarStyle="outsideOverlay"
       android:layout_weight="1"
       android:cacheColorHint="@android:color/transparent"
       android:divider="@null" />
 
     <TextView
-      android:id="@+id/empty"
-      android:layout_marginTop="@dimen/empty_message_top_margin"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      android:gravity="center_horizontal"
-      android:textAppearance="?android:attr/textAppearanceMedium"
-      android:text="@string/noGroups" />
+        android:id="@+id/empty"
+        android:layout_marginTop="@dimen/empty_message_top_margin"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingTop="8dip"
+        android:gravity="center_horizontal"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:text="@string/noGroups" />
 
     <LinearLayout
       android:id="@+id/add_accounts"
diff --git a/res/layout/group_browse_list_item.xml b/res/layout/group_browse_list_item.xml
index 326b413..599cc13 100644
--- a/res/layout/group_browse_list_item.xml
+++ b/res/layout/group_browse_list_item.xml
@@ -19,35 +19,33 @@
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="@dimen/detail_min_line_item_height">
+    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" >
 
-    <ImageView
+    <View
         android:id="@+id/divider"
         android:layout_width="match_parent"
         android:layout_height="1dip"
-        android:paddingLeft="10dip"
-        android:paddingRight="10dip"
-        android:scaleType="fitXY"
-        android:src="@color/people_app_theme_color"/>
+        android:background="?android:attr/listDivider" />
 
     <include
         android:id="@+id/group_list_header"
         layout="@layout/group_browse_list_account_header"
-        android:paddingRight="20dip"
-        android:paddingBottom="10dip"
         android:visibility="gone" />
 
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingTop="10dip"
-        android:paddingRight="20dip"
-        android:paddingBottom="10dip"
-        style="@style/GroupBrowseListItem">
+        android:paddingTop="8dip"
+        android:paddingBottom="8dip">
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:paddingLeft="?attr/list_item_text_indent"
             android:orientation="vertical"
             android:layout_toLeftOf="@+id/icons"
             android:layout_alignParentLeft="true"
@@ -57,8 +55,6 @@
                 android:id="@+id/label"
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
-                android:paddingLeft="10dip"
-                android:paddingRight="10dip"
                 android:textAppearance="?android:attr/textAppearanceMedium"
                 android:ellipsize="end"
                 android:singleLine="true" />
@@ -67,8 +63,6 @@
                 android:id="@+id/count"
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
-                android:paddingLeft="10dip"
-                android:paddingRight="10dip"
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:textColor="?android:attr/textColorTertiary"
                 android:ellipsize="end"
diff --git a/res/layout/join_contact_picker.xml b/res/layout/join_contact_picker.xml
index 20a7740..ffea137 100644
--- a/res/layout/join_contact_picker.xml
+++ b/res/layout/join_contact_picker.xml
@@ -24,20 +24,22 @@
         android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1"
-        android:id="@+id/list_container">
-    </FrameLayout>
+        android:id="@+id/list_container" />
 
     <View
+        android:id="@+id/divider"
         android:layout_width="match_parent"
         android:layout_height="1dip"
-        android:layout_marginLeft="16dip"
-        android:layout_marginRight="16dip"
+        android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+        android:layout_marginRight="?attr/contact_browser_list_padding_right"
         android:background="?android:attr/dividerHorizontal" />
 
     <LinearLayout
         style="?android:attr/buttonBarStyle"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+        android:layout_marginRight="?attr/contact_browser_list_padding_right">
         <Button
             style="?android:attr/buttonBarButtonStyle"
             android:id="@+id/cancel"
diff --git a/res/layout/join_contact_picker_list_content.xml b/res/layout/join_contact_picker_list_content.xml
index 0d2a089..9e72c31 100644
--- a/res/layout/join_contact_picker_list_content.xml
+++ b/res/layout/join_contact_picker_list_content.xml
@@ -19,33 +19,30 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:paddingTop="8dip"
     android:orientation="vertical">
 
     <TextView
         android:id="@+id/join_contact_blurb"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingLeft="10dip"
-        android:paddingTop="12dip"
-        android:paddingBottom="12dip"
-        android:layout_marginLeft="12dip"
-        android:layout_marginRight="12dip"
+        android:paddingLeft="16dip"
+        android:paddingRight="16dip"
         android:maxLines="2"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary" />
+        android:textAppearance="?android:attr/textAppearanceMedium" />
 
     <FrameLayout
         android:id="@+id/pinned_header_list_layout"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_marginLeft="48dip"
-        android:layout_marginRight="48dip">
-
+        android:layout_height="match_parent">
         <view
             class="com.android.contacts.list.ContactEntryListView"
             android:id="@android:id/list"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:fastScrollEnabled="true" />
+            android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+            android:layout_marginRight="?attr/contact_browser_list_padding_right"
+            android:fastScrollEnabled="true"
+            android:scrollbarStyle="outsideOverlay" />
     </FrameLayout>
 </LinearLayout>
diff --git a/res/layout/join_contact_picker_section.xml b/res/layout/join_contact_picker_section.xml
index 95ec107..260ea2d 100644
--- a/res/layout/join_contact_picker_section.xml
+++ b/res/layout/join_contact_picker_section.xml
@@ -22,12 +22,12 @@
 
     <TextView
         android:id="@+id/text"
-        android:layout_height="32dip"
         android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingLeft="?attr/list_item_header_text_indent"
+        android:minHeight="16dip"
         android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary"
         android:gravity="center_vertical" />
 
-    <View
-        style="@style/SectionDivider" />
+    <View style="@style/SectionDivider" />
 </LinearLayout>
diff --git a/res/layout/user_profile_button.xml b/res/layout/user_profile_button.xml
index 4937d7b..8735f5a 100644
--- a/res/layout/user_profile_button.xml
+++ b/res/layout/user_profile_button.xml
@@ -18,11 +18,13 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
+    android:minHeight="@dimen/contact_browser_list_item_photo_size"
+    android:layout_marginLeft="?attr/list_item_padding_left"
+    android:layout_marginRight="?attr/list_item_padding_right"
+    android:paddingLeft="?attr/list_item_header_text_indent"
     android:background="?android:attr/selectableItemBackground"
     android:singleLine="true"
     android:text="@string/profile_display_name"
     android:ellipsize="end"
-    android:minHeight="@dimen/contact_browser_list_item_photo_size"
     android:gravity="left|center_vertical"
-    android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
     android:textAppearance="?android:attr/textAppearanceMedium" />
diff --git a/res/layout/user_profile_header.xml b/res/layout/user_profile_header.xml
index 7c82ea4..ff01a11 100644
--- a/res/layout/user_profile_header.xml
+++ b/res/layout/user_profile_header.xml
@@ -16,15 +16,19 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:paddingTop="@dimen/contact_browser_list_top_margin"
+    android:id="@+id/user_profile_header"
     android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:minHeight="?attr/list_item_header_height"
+    android:paddingTop="@dimen/contact_browser_list_top_margin"
+    android:paddingLeft="?attr/list_item_padding_left"
+    android:paddingRight="?attr/list_item_padding_right" >
 
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content" >
+        android:layout_height="wrap_content">
 
         <TextView
             android:id="@+id/profile_title"
@@ -37,7 +41,7 @@
             android:gravity="left|center_vertical"
             android:layout_weight="1"
             android:textAppearance="?android:attr/textAppearanceSmall"
-            android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
+            android:paddingLeft="?attr/list_item_text_indent"
             android:textColor="@color/people_app_theme_color" />
 
         <TextView
@@ -55,6 +59,6 @@
     <View
         android:background="@color/people_app_theme_color"
         android:layout_width="match_parent"
-        android:layout_height="1dip" />
+        android:layout_height="?attr/list_item_header_underline_height" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>