Filter and header refactoring.

- have AccountFilterUtil to unify account filter implementations.
- modify account header on top of search screens
  Now it is bigger than before (40dip > 32dip), and uses people's
  blue text color instead of gray (issue 5451033)
- introduce ContactListSeparatorTextViewStyle and use it everywhere

Bug: 5269692
Bug: 5451033
Bug: 5429203
Change-Id: Ibe810ff9adaafc74d53b0dcf171a3853f4be039a
diff --git a/res/layout-sw580dp/list_separator.xml b/res/layout-sw580dp/list_separator.xml
index a53bd6b..34e8d79 100644
--- a/res/layout-sw580dp/list_separator.xml
+++ b/res/layout-sw580dp/list_separator.xml
@@ -17,12 +17,6 @@
 <TextView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/title"
-    style="?android:attr/listSeparatorTextViewStyle"
-    android:layout_height="32dip"
+    style="@style/ContactListSeparatorTextViewStyle"
     android:paddingLeft="8dip"
-    android:paddingRight="8dip"
-    android:background="@drawable/list_section_divider_holo_custom"
-    android:textColor="@color/people_app_theme_color"
-    android:textAllCaps="true"
-    android:singleLine="true"
-    android:ellipsize="end" />
\ No newline at end of file
+    android:paddingRight="8dip" />
diff --git a/res/layout/account_filter_header.xml b/res/layout/account_filter_header.xml
index 4d45d25..26207f0 100644
--- a/res/layout/account_filter_header.xml
+++ b/res/layout/account_filter_header.xml
@@ -22,7 +22,6 @@
     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"
@@ -31,17 +30,6 @@
     android:visibility="gone">
     <TextView
         android:id="@+id/account_filter_header"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:singleLine="true"
-        android:ellipsize="end"
-        android:textStyle="bold"
-        android:textAllCaps="true"
-        android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary" />
-    <View
-        android:id="@+id/account_filter_header_bottom_divider"
-        android:layout_height="1dip"
-        style="@style/SectionDivider" />
+        style="@style/ContactListSeparatorTextViewStyle"
+        android:paddingLeft="@dimen/contact_browser_list_item_text_indent" />
 </LinearLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 4768bf6..777c7af 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -129,20 +129,11 @@
 
     <TextView
         android:id="@+id/call_log_header"
-        style="?android:attr/listSeparatorTextViewStyle"
+        style="@style/ContactListSeparatorTextViewStyle"
         android:layout_marginLeft="@dimen/call_log_outer_margin"
         android:layout_marginRight="@dimen/call_log_outer_margin"
         android:paddingTop="@dimen/call_log_inner_margin"
-        android:paddingBottom="@dimen/call_log_inner_margin"
-        android:background="@drawable/list_section_divider_holo_custom"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textStyle="bold"
-        android:textColor="?attr/call_log_header_color"
-        android:textAllCaps="true"
-        android:singleLine="true"
-        android:ellipsize="end"
-        android:focusable="true"
-    />
+        android:paddingBottom="@dimen/call_log_inner_margin" />
 
     <View
         android:id="@+id/call_log_divider"
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contact_list_content.xml
similarity index 100%
rename from res/layout/contacts_list_content.xml
rename to res/layout/contact_list_content.xml
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
index a1516ef..a2adf48 100644
--- a/res/layout/directory_header.xml
+++ b/res/layout/directory_header.xml
@@ -20,7 +20,9 @@
     style="@style/DirectoryHeader"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="?attr/list_item_header_height"
+    android:minHeight="@dimen/list_section_divider_min_height"
+    android:background="@drawable/list_section_divider_holo_custom"
+    android:paddingTop="@dimen/contact_browser_list_top_margin"
     android:paddingLeft="?attr/list_item_padding_left"
     android:paddingRight="?attr/list_item_padding_right">
     <TextView
@@ -32,7 +34,7 @@
         android:layout_centerVertical="true"
         android:layout_marginLeft="8dip"
         android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary"
+        android:textColor="@color/people_app_theme_color"
         android:singleLine="true"
         android:textStyle="bold"
         android:textAllCaps="true" />
@@ -55,12 +57,8 @@
         android:layout_marginLeft="8dip"
         android:layout_marginRight="8dip"
         android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary"
+        android:textColor="@color/people_app_theme_color"
         android:singleLine="true"
         android:textStyle="bold"
         android:textAllCaps="true" />
-    <View
-        android:id="@+id/contact_filter_header_bottom_divider"
-        style="@style/SectionDivider"
-        android:layout_below="@id/display_name" />
 </RelativeLayout>
diff --git a/res/layout/edit_kind_title.xml b/res/layout/edit_kind_title.xml
index f178876..1cd6833 100644
--- a/res/layout/edit_kind_title.xml
+++ b/res/layout/edit_kind_title.xml
@@ -20,20 +20,13 @@
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="32dip"
+    android:layout_height="wrap_content"
     android:paddingLeft="8dip"
     android:paddingRight="8dip"
     android:focusable="false">
-
     <TextView
         android:id="@+id/kind_title"
-        style="?android:attr/listSeparatorTextViewStyle"
+        style="@style/ContactListSeparatorTextViewStyle"
         android:paddingLeft="8dip"
-        android:paddingRight="8dip"
-        android:background="@drawable/list_section_divider_holo_custom"
-        android:textColor="@color/people_app_theme_color"
-        android:textAllCaps="true"
-        android:singleLine="true"
-        android:ellipsize="end" />
-
-</FrameLayout>
\ No newline at end of file
+        android:paddingRight="8dip" />
+</FrameLayout>
diff --git a/res/layout/list_separator.xml b/res/layout/list_separator.xml
index 3ffaca7..d94e18c 100644
--- a/res/layout/list_separator.xml
+++ b/res/layout/list_separator.xml
@@ -17,20 +17,13 @@
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="32dip"
+    android:layout_height="wrap_content"
     android:paddingLeft="16dip"
     android:paddingRight="16dip"
     android:focusable="false">
-
     <TextView
         android:id="@+id/title"
-        style="?android:attr/listSeparatorTextViewStyle"
+        style="@style/ContactListSeparatorTextViewStyle"
         android:paddingLeft="8dip"
-        android:paddingRight="8dip"
-        android:background="@drawable/list_section_divider_holo_custom"
-        android:textColor="@color/people_app_theme_color"
-        android:textAllCaps="true"
-        android:singleLine="true"
-        android:ellipsize="end" />
-
+        android:paddingRight="8dip" />
 </FrameLayout>
diff --git a/res/layout/phone_favorite_account_filter_header.xml b/res/layout/phone_favorite_account_filter_header.xml
deleted file mode 100644
index d63382a..0000000
--- a/res/layout/phone_favorite_account_filter_header.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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.
--->
-
-<!-- Layout showing the type of account filter in phone favorite screen.
-
-     Note: This xml is based on account_filter_header.xml and list_separator.xml.
-     Some configurations (e.g. padding) are from account_filter_header.xml, while
-     some other configurations (e.g. background, height, text style) are from
-     list_separator.xml. See also bug 5432231. -->
-<FrameLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/account_filter_header_container"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="32dip"
-    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:background="?android:attr/selectableItemBackground"
-    android:visibility="gone">
-    <TextView
-        android:id="@+id/account_filter_header"
-        style="?android:attr/listSeparatorTextViewStyle"
-        android:singleLine="true"
-        android:ellipsize="end"
-        android:textStyle="bold"
-        android:textAllCaps="true"
-        android:textColor="@color/people_app_theme_color"
-        android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:background="@drawable/list_section_divider_holo_custom" />
-</FrameLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6c21d31..12ae918 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -214,4 +214,9 @@
     <integer name="dialpad_layout_weight_digits">20</integer>
     <integer name="dialpad_layout_weight_dialpad">65</integer>
     <integer name="dialpad_layout_weight_additional_buttons">15</integer>
+
+    <!-- Minimum height used with @drawable/list_section_divider_holo_custom.
+         Right now the drawable has implicit 32dip minimal height, which is confusing.
+         This value is for making the hidden configuration explicit in xml. -->
+    <dimen name="list_section_divider_min_height">32dip</dimen>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c337933..93be77a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -301,5 +301,27 @@
         <item name="android:background">@color/quickcontact_tab_indicator</item>
     </style>
 
+
     <style name="GroupMembershipSizeTextAppearance" parent="@android:style/TextAppearance.Small"/>
+
+    <!-- TextView style with blue underline. It is most suitable for headers.
+
+         This is similar to ?android:attr/listSeparatorTextView but uses different
+         background and text color. See also android:style/Widget.Holo.TextView.ListSeparator
+         (which is private, so we cannot specify it as a parent style).  -->
+    <style name="ContactListSeparatorTextViewStyle">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <!-- See comments for @dimen/list_section_divider_min_height -->
+        <item name="android:minHeight">@dimen/list_section_divider_min_height</item>
+        <item name="android:background">@drawable/list_section_divider_holo_custom</item>
+        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:textColor">@color/people_app_theme_color</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:paddingLeft">8dip</item>
+        <item name="android:ellipsize">end</item>
+        <item name="android:singleLine">true</item>
+        <item name="android:textAllCaps">true</item>
+    </style>
 </resources>