Fixes headers for new and older calls.

The attribute android:drawableBottom does not work as I expected (it
works as documented though).

Instead, use the same pattern used for headers elsewhere in the
application.

Bug: 5152462
Change-Id: I4b3f9b0d959c9f69c90ef8181b98e62f6031d25d
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 8bd6a19..734e1b8 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -141,17 +141,33 @@
         </LinearLayout>
     </RelativeLayout>
 
-    <TextView
-        android:id="@+id/call_log_header_text"
+    <LinearLayout
+        android:id="@+id/call_log_header"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="@dimen/call_log_inner_margin"
-        android:layout_marginRight="@dimen/call_log_inner_margin"
-        android:textSize="14sp"
-        android:textStyle="bold"
-        android:textColor="?attr/call_log_header_color"
-        android:padding="@dimen/call_log_inner_margin"
-        android:focusable="true"
-        android:drawableBottom="@android:color/holo_blue_light"
-    />
+        android:paddingLeft="@dimen/call_log_outer_margin"
+        android:paddingRight="@dimen/call_log_outer_margin"
+        android:paddingTop="@dimen/call_log_inner_margin"
+        android:paddingBottom="@dimen/call_log_inner_margin"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/call_log_header_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingLeft="@dimen/call_log_inner_margin"
+            android:paddingRight="@dimen/call_log_inner_margin"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold"
+            android:textColor="?attr/call_log_header_color"
+            android:textAllCaps="true"
+            android:focusable="true"
+        />
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="2dip"
+            android:background="@color/call_log_voicemail_highlight_color"/>
+    </LinearLayout>
 </view>
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index 740f2f2..2d0ddbd 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -701,7 +701,7 @@
             if (section == CallLogQuery.SECTION_NEW_HEADER
                     || section == CallLogQuery.SECTION_OLD_HEADER) {
                 views.listItemView.setVisibility(View.GONE);
-                views.listHeaderTextView.setVisibility(View.VISIBLE);
+                views.listHeaderView.setVisibility(View.VISIBLE);
                 views.listHeaderTextView.setText(
                         section == CallLogQuery.SECTION_NEW_HEADER
                                 ? R.string.call_log_new_header
@@ -711,7 +711,7 @@
             }
             // Default case: an item in the call log.
             views.listItemView.setVisibility(View.VISIBLE);
-            views.listHeaderTextView.setVisibility(View.GONE);
+            views.listHeaderView.setVisibility(View.GONE);
 
             final String number = c.getString(CallLogQuery.NUMBER);
             final long date = c.getLong(CallLogQuery.DATE);
diff --git a/src/com/android/contacts/calllog/CallLogListItemViews.java b/src/com/android/contacts/calllog/CallLogListItemViews.java
index fbf91cc..847e354 100644
--- a/src/com/android/contacts/calllog/CallLogListItemViews.java
+++ b/src/com/android/contacts/calllog/CallLogListItemViews.java
@@ -43,13 +43,15 @@
     public final PhoneCallDetailsViews phoneCallDetailsViews;
     /** The item view for a stand-alone row, or null for other types of rows. */
     public final View listItemView;
-    /** The text of the header in a stand-alone row, or null for other types of rows. */
+    /** The header of a section. */
+    public final View listHeaderView;
+    /** The text of the header of a section. */
     public final TextView listHeaderTextView;
 
     private CallLogListItemViews(QuickContactBadge quickContactView, View primaryActionView,
             ImageView secondaryActionView, View unheardView, View dividerView,
             PhoneCallDetailsViews phoneCallDetailsViews, View listItemView,
-            TextView listHeaderTextView) {
+            View listHeaderView, TextView listHeaderTextView) {
         this.quickContactView = quickContactView;
         this.primaryActionView = primaryActionView;
         this.secondaryActionView = secondaryActionView;
@@ -57,6 +59,7 @@
         this.dividerView = dividerView;
         this.phoneCallDetailsViews = phoneCallDetailsViews;
         this.listItemView = listItemView;
+        this.listHeaderView = listHeaderView;
         this.listHeaderTextView = listHeaderTextView;
     }
 
@@ -69,6 +72,7 @@
                 view.findViewById(R.id.divider),
                 PhoneCallDetailsViews.fromView(view),
                 view.findViewById(R.id.call_log_item),
+                view.findViewById(R.id.call_log_header),
                 (TextView) view.findViewById(R.id.call_log_header_text));
     }
 
@@ -81,6 +85,7 @@
                 new View(context),
                 PhoneCallDetailsViews.createForTest(context),
                 new View(context),
+                new View(context),
                 new TextView(context));
     }
 }