Use a single text view for count and date of calls.

This further reduces the number of views needed to render the call log.

At the same time, fix a few minor issues that are needed for pixel
perfect UI:
- Do not show the text when the item is new.
- Instead, for new items, highlight the date in the color associated
  with the item (blue for voicemail, red for missed calls).
- Do not put a separating slash between the count and the date.

Bug: 5099652
Change-Id: I18b71463e7398f00f0fe8fecbeb334b67d618312
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 4d4470f..dc0d9e1 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -141,28 +141,7 @@
                     android:layout_gravity="center_vertical"
                 />
                 <TextView
-                    android:id="@+id/call_type_name"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginRight="@dimen/call_log_inner_margin"
-                    android:layout_gravity="center_vertical"
-                    android:textColor="?attr/call_log_secondary_text_color"
-                    android:textSize="14sp"
-                    android:singleLine="true"
-                />
-                <TextView
-                    android:id="@+id/call_type_separator"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginRight="@dimen/call_log_inner_margin"
-                    android:layout_gravity="center_vertical"
-                    android:textColor="?attr/call_log_secondary_text_color"
-                    android:textSize="14sp"
-                    android:text="@string/call_log_type_date_separator"
-                    android:singleLine="true"
-                />
-                <TextView
-                    android:id="@+id/date"
+                    android:id="@+id/call_count_and_date"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_vertical"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 908e1c0..8cd1d8e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1635,9 +1635,6 @@
     <!-- Message to show when there is an error playing back the voicemail. [CHAR LIMIT=40] -->
     <string name="voicemail_playback_error">Could not play voicemail</string>
 
-    <!-- The separator between the call type text and the date in the call log [CHAR LIMIT=3] -->
-    <string name="call_log_type_date_separator">/</string>
-
     <!-- The header in the call log used to identify missed calls and voicemail that have not yet been consumed [CHAR LIMIT=10] -->
     <string name="call_log_new_header">New</string>
 
@@ -1677,8 +1674,8 @@
     <!--  Fastest voicemail playback speed. [CHAR LIMIT=30] -->
     <string name="voicemail_speed_fastest">fastest speed</string>
 
-    <!-- The counter for calls in a group in the call log [CHAR LIMIT=5] -->
-    <string name="call_log_item_count">(%1$d)</string>
+    <!-- The counter for calls in a group and the date of the latest call as shown in the call log [CHAR LIMIT=15] -->
+    <string name="call_log_item_count_and_date">(<xliff:g id="count">%1$d</xliff:g>) <xliff:g id="date">%2$s</xliff:g></string>
 
     <!-- Hint text in the group name box in the edit group view. [CHAR LIMIT=20]-->
     <string name="group_name_hint">Group\'s Name</string>
diff --git a/src/com/android/contacts/PhoneCallDetailsHelper.java b/src/com/android/contacts/PhoneCallDetailsHelper.java
index 08e6a56..3101aee 100644
--- a/src/com/android/contacts/PhoneCallDetailsHelper.java
+++ b/src/com/android/contacts/PhoneCallDetailsHelper.java
@@ -24,9 +24,12 @@
 import android.graphics.Typeface;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.telephony.PhoneNumberUtils;
+import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.TextUtils;
 import android.text.format.DateUtils;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.StyleSpan;
 import android.view.View;
 import android.widget.TextView;
 
@@ -60,43 +63,36 @@
 
     /** Fills the call details views with content. */
     public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details,
-            boolean useIcons, boolean isHighlighted) {
-        if (useIcons) {
-            views.callTypeIcons.clear();
-            int count = details.callTypes.length;
-            for (int index = 0; index < count && index < MAX_CALL_TYPE_ICONS; ++index) {
-                views.callTypeIcons.add(details.callTypes[index]);
-            }
-            views.callTypeIcons.setVisibility(View.VISIBLE);
-            if (count > MAX_CALL_TYPE_ICONS) {
-                views.callTypeText.setVisibility(View.VISIBLE);
-                views.callTypeSeparator.setVisibility(View.VISIBLE);
-                views.callTypeText.setText(
-                        mResources.getString(R.string.call_log_item_count, count));
-            } else {
-                views.callTypeText.setVisibility(View.GONE);
-                views.callTypeSeparator.setVisibility(View.GONE);
-            }
-        } else {
-            // Use the name of the first call type.
-            // TODO: We should update this to handle the text for multiple calls as well.
-            int callType = details.callTypes[0];
-            views.callTypeText.setText(
-                    isHighlighted ? mCallTypeHelper.getHighlightedCallTypeText(callType)
-                            : mCallTypeHelper.getCallTypeText(callType));
-            views.callTypeIcons.clear();
-
-            views.callTypeText.setVisibility(View.VISIBLE);
-            views.callTypeSeparator.setVisibility(View.VISIBLE);
-            views.callTypeIcons.setVisibility(View.GONE);
+            boolean isHighlighted) {
+        // Display up to a given number of icons.
+        views.callTypeIcons.clear();
+        int count = details.callTypes.length;
+        for (int index = 0; index < count && index < MAX_CALL_TYPE_ICONS; ++index) {
+            views.callTypeIcons.add(details.callTypes[index]);
         }
+        views.callTypeIcons.setVisibility(View.VISIBLE);
 
-        CharSequence shortDateText =
+        // Show the total call count only if there are more than the maximum number of icons.
+        final Integer callCount;
+        if (count > MAX_CALL_TYPE_ICONS) {
+            callCount = count;
+        } else {
+            callCount = null;
+        }
+        // The color to highlight the count and date in, if any. This is based on the first call.
+        Integer highlightColor =
+                isHighlighted ? mCallTypeHelper.getHighlightedColor(details.callTypes[0]) : null;
+
+        // The date of this call, relative to the current time.
+        CharSequence dateText =
             DateUtils.getRelativeTimeSpanString(details.date,
                     getCurrentTimeMillis(),
                     DateUtils.MINUTE_IN_MILLIS,
                     DateUtils.FORMAT_ABBREV_RELATIVE);
 
+        // Set the call count and date.
+        setCallCountAndDate(views, callCount, dateText, highlightColor);
+
         CharSequence numberFormattedLabel = null;
         // Only show a label if the number is shown and it is not a SIP address.
         if (!TextUtils.isEmpty(details.number)
@@ -130,7 +126,6 @@
             }
         }
 
-        views.dateView.setText(shortDateText);
         views.nameView.setText(nameText);
         views.numberView.setText(numberText);
     }
@@ -165,4 +160,36 @@
             return mCurrentTimeMillisForTest;
         }
     }
+
+    /** Sets the call count and date. */
+    private void setCallCountAndDate(PhoneCallDetailsViews views, Integer callCount,
+            CharSequence dateText, Integer highlightColor) {
+        // Combine the count (if present) and the date.
+        final CharSequence text;
+        if (callCount != null) {
+            text = mResources.getString(
+                    R.string.call_log_item_count_and_date, callCount.intValue(), dateText);
+        } else {
+            text = dateText;
+        }
+
+        // Apply the highlight color if present.
+        final CharSequence formattedText;
+        if (highlightColor != null) {
+            formattedText = addBoldAndColor(text, highlightColor);
+        } else {
+            formattedText = text;
+        }
+
+        views.callTypeAndDate.setText(formattedText);
+    }
+
+    /** Creates a SpannableString for the given text which is bold and in the given color. */
+    private CharSequence addBoldAndColor(CharSequence text, int color) {
+        int flags = Spanned.SPAN_INCLUSIVE_INCLUSIVE;
+        SpannableString result = new SpannableString(text);
+        result.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), flags);
+        result.setSpan(new ForegroundColorSpan(color), 0, text.length(), flags);
+        return result;
+    }
 }
diff --git a/src/com/android/contacts/PhoneCallDetailsViews.java b/src/com/android/contacts/PhoneCallDetailsViews.java
index c07e337..fa06879 100644
--- a/src/com/android/contacts/PhoneCallDetailsViews.java
+++ b/src/com/android/contacts/PhoneCallDetailsViews.java
@@ -29,20 +29,15 @@
     public final TextView nameView;
     public final View callTypeView;
     public final CallTypeIconsView callTypeIcons;
-    public final TextView callTypeText;
-    public final View callTypeSeparator;
-    public final TextView dateView;
+    public final TextView callTypeAndDate;
     public final TextView numberView;
 
     private PhoneCallDetailsViews(TextView nameView, View callTypeView,
-            CallTypeIconsView callTypeIcons, TextView callTypeText, View callTypeSeparator,
-            TextView dateView, TextView numberView) {
+            CallTypeIconsView callTypeIcons, TextView callTypeAndDate, TextView numberView) {
         this.nameView = nameView;
         this.callTypeView = callTypeView;
         this.callTypeIcons = callTypeIcons;
-        this.callTypeText = callTypeText;
-        this.callTypeSeparator = callTypeSeparator;
-        this.dateView = dateView;
+        this.callTypeAndDate = callTypeAndDate;
         this.numberView = numberView;
     }
 
@@ -57,9 +52,7 @@
         return new PhoneCallDetailsViews((TextView) view.findViewById(R.id.name),
                 view.findViewById(R.id.call_type),
                 (CallTypeIconsView) view.findViewById(R.id.call_type_icons),
-                (TextView) view.findViewById(R.id.call_type_name),
-                view.findViewById(R.id.call_type_separator),
-                (TextView) view.findViewById(R.id.date),
+                (TextView) view.findViewById(R.id.call_count_and_date),
                 (TextView) view.findViewById(R.id.number));
     }
 
@@ -69,8 +62,6 @@
                 new View(context),
                 new CallTypeIconsView(context),
                 new TextView(context),
-                new View(context),
-                new TextView(context),
                 new TextView(context));
     }
 }
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index 63b41af..ae70c0b 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -39,7 +39,6 @@
 import android.content.Intent;
 import android.content.res.Resources;
 import android.database.Cursor;
-import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -760,11 +759,9 @@
             }
 
             final boolean isNew = CallLogQuery.isNewSection(c);
-            // Use icons for old items, but text for new ones.
-            final boolean useIcons = !isNew;
             // New items also use the highlighted version of the text.
             final boolean isHighlighted = isNew;
-            mCallLogViewsHelper.setPhoneCallDetails(views, details, useIcons, isHighlighted);
+            mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted);
             setPhoto(views, thumbnailUri, personId, lookupKey);
 
             // Listen for the first draw
diff --git a/src/com/android/contacts/calllog/CallLogListItemHelper.java b/src/com/android/contacts/calllog/CallLogListItemHelper.java
index a448399..a973d49 100644
--- a/src/com/android/contacts/calllog/CallLogListItemHelper.java
+++ b/src/com/android/contacts/calllog/CallLogListItemHelper.java
@@ -48,12 +48,11 @@
      *
      * @param views the views to populate
      * @param details the details of a phone call needed to fill in the data
-     * @param useIcons whether to use icons to show the type of the call
      * @param isHighlighted whether to use the highlight text for the call
      */
     public void setPhoneCallDetails(CallLogListItemViews views, PhoneCallDetails details,
-            boolean useIcons, boolean isHighlighted) {
-        mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details, useIcons,
+            boolean isHighlighted) {
+        mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details,
                 isHighlighted);
         boolean canCall = mPhoneNumberHelper.canPlaceCallsTo(details.number);
         boolean canPlay = details.callTypes[0] == Calls.VOICEMAIL_TYPE;
diff --git a/src/com/android/contacts/calllog/CallTypeHelper.java b/src/com/android/contacts/calllog/CallTypeHelper.java
index d27d4f9..d5d1068 100644
--- a/src/com/android/contacts/calllog/CallTypeHelper.java
+++ b/src/com/android/contacts/calllog/CallTypeHelper.java
@@ -19,12 +19,7 @@
 import com.android.contacts.R;
 
 import android.content.res.Resources;
-import android.graphics.Typeface;
 import android.provider.CallLog.Calls;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.StyleSpan;
 
 /**
  * Helper class to perform operations related to call types.
@@ -38,10 +33,10 @@
     private final CharSequence mMissedName;
     /** Name used to identify voicemail calls. */
     private final CharSequence mVoicemailName;
-    /** Name used to identify new missed calls. */
-    private final CharSequence mNewMissedName;
-    /** Name used to identify new voicemail calls. */
-    private final CharSequence mNewVoicemailName;
+    /** Color used to identify new missed calls. */
+    private final int mNewMissedColor;
+    /** Color used to identify new voicemail calls. */
+    private final int mNewVoicemailColor;
 
     public CallTypeHelper(Resources resources) {
         // Cache these values so that we do not need to look them up each time.
@@ -49,10 +44,8 @@
         mOutgoingName = resources.getString(R.string.type_outgoing);
         mMissedName = resources.getString(R.string.type_missed);
         mVoicemailName = resources.getString(R.string.type_voicemail);
-        mNewMissedName = addBoldAndColor(mMissedName,
-                resources.getColor(R.color.call_log_missed_call_highlight_color));
-        mNewVoicemailName = addBoldAndColor(mVoicemailName,
-                resources.getColor(R.color.call_log_voicemail_highlight_color));
+        mNewMissedColor = resources.getColor(R.color.call_log_missed_call_highlight_color);
+        mNewVoicemailColor = resources.getColor(R.color.call_log_voicemail_highlight_color);
     }
 
     /** Returns the text used to represent the given call type. */
@@ -75,34 +68,25 @@
         }
     }
 
-    /** Returns the text used to represent the given call type. */
-    public CharSequence getHighlightedCallTypeText(int callType) {
+    /** Returns the color used to highlight the given call type, null if not highlight is needed. */
+    public Integer getHighlightedColor(int callType) {
         switch (callType) {
             case Calls.INCOMING_TYPE:
                 // New incoming calls are not highlighted.
-                return mIncomingName;
+                return null;
 
             case Calls.OUTGOING_TYPE:
                 // New outgoing calls are not highlighted.
-                return mOutgoingName;
+                return null;
 
             case Calls.MISSED_TYPE:
-                return mNewMissedName;
+                return mNewMissedColor;
 
             case Calls.VOICEMAIL_TYPE:
-                return mNewVoicemailName;
+                return mNewVoicemailColor;
 
             default:
                 throw new IllegalArgumentException("invalid call type: " + callType);
         }
     }
-
-    /** Creates a SpannableString for the given text which is bold and in the given color. */
-    private CharSequence addBoldAndColor(CharSequence text, int color) {
-        int flags = Spanned.SPAN_INCLUSIVE_INCLUSIVE;
-        SpannableString result = new SpannableString(text);
-        result.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), flags);
-        result.setSpan(new ForegroundColorSpan(color), 0, text.length(), flags);
-        return result;
-    }
 }
diff --git a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
index 21b9a6f..487a13f 100644
--- a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
@@ -25,6 +25,8 @@
 import android.content.res.Resources;
 import android.provider.CallLog.Calls;
 import android.test.AndroidTestCase;
+import android.text.Html;
+import android.text.Spanned;
 import android.view.View;
 import android.widget.TextView;
 
@@ -38,7 +40,8 @@
     /** The number to be used to access the voicemail. */
     private static final String TEST_VOICEMAIL_NUMBER = "125";
     /** The date of the call log entry. */
-    private static final long TEST_DATE = 1300000000;
+    private static final long TEST_DATE =
+        new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis();
     /** A test duration value for phone calls. */
     private static final long TEST_DURATION = 62300;
     /** The number of the caller/callee in the log entry. */
@@ -54,6 +57,7 @@
     private PhoneCallDetailsViews mViews;
     private TextView mNameView;
     private PhoneNumberHelper mPhoneNumberHelper;
+    private LocaleTestUtils mLocaleTestUtils;
 
     @Override
     protected void setUp() throws Exception {
@@ -63,14 +67,21 @@
         CallTypeHelper callTypeHelper = new CallTypeHelper(resources);
         mPhoneNumberHelper = new PhoneNumberHelper(resources, TEST_VOICEMAIL_NUMBER);
         mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, mPhoneNumberHelper);
+        mHelper.setCurrentTimeForTest(
+                new GregorianCalendar(2011, 5, 4, 13, 0, 0).getTimeInMillis());
         mViews = PhoneCallDetailsViews.createForTest(context);
         mNameView = new TextView(context);
+        mLocaleTestUtils = new LocaleTestUtils(getContext());
+        mLocaleTestUtils.setLocale(Locale.US);
     }
 
     @Override
     protected void tearDown() throws Exception {
+        mLocaleTestUtils.restoreLocale();
+        mNameView = null;
         mViews = null;
         mHelper = null;
+        mPhoneNumberHelper = null;
         super.tearDown();
     }
 
@@ -96,34 +107,40 @@
 
     public void testSetPhoneCallDetails_Normal() {
         setPhoneCallDetailsWithNumber("14125551212", "1-412-555-1212");
-        assertNameEquals("1-412-555-1212");
+        assertEquals("yesterday", mViews.callTypeAndDate.getText().toString());
+        assertEqualsHtml("<font color='#33b5e5'><b>yesterday</b></font>",
+                mViews.callTypeAndDate.getText());
+    }
+
+    /** Asserts that a char sequence is actually a Spanned corresponding to the expected HTML. */
+    private void assertEqualsHtml(String expectedHtml, CharSequence actualText) {
+        // In order to contain HTML, the text should actually be a Spanned.
+        assertTrue(actualText instanceof Spanned);
+        Spanned actualSpanned = (Spanned) actualText;
+        // Convert from and to HTML to take care of alternative formatting of HTML.
+        assertEquals(Html.toHtml(Html.fromHtml(expectedHtml)), Html.toHtml(actualSpanned));
+
     }
 
     public void testSetPhoneCallDetails_Date() {
-        LocaleTestUtils localeTestUtils = new LocaleTestUtils(getContext());
-        localeTestUtils.setLocale(Locale.US);
-        try {
-            mHelper.setCurrentTimeForTest(
-                    new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis());
+        mHelper.setCurrentTimeForTest(
+                new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis());
 
-            setPhoneCallDetailsWithDate(
-                    new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis());
-            assertDateEquals("0 mins ago");
+        setPhoneCallDetailsWithDate(
+                new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis());
+        assertDateEquals("0 mins ago");
 
-            setPhoneCallDetailsWithDate(
-                    new GregorianCalendar(2011, 5, 3, 12, 0, 0).getTimeInMillis());
-            assertDateEquals("1 hour ago");
+        setPhoneCallDetailsWithDate(
+                new GregorianCalendar(2011, 5, 3, 12, 0, 0).getTimeInMillis());
+        assertDateEquals("1 hour ago");
 
-            setPhoneCallDetailsWithDate(
-                    new GregorianCalendar(2011, 5, 2, 13, 0, 0).getTimeInMillis());
-            assertDateEquals("yesterday");
+        setPhoneCallDetailsWithDate(
+                new GregorianCalendar(2011, 5, 2, 13, 0, 0).getTimeInMillis());
+        assertDateEquals("yesterday");
 
-            setPhoneCallDetailsWithDate(
-                    new GregorianCalendar(2011, 5, 1, 13, 0, 0).getTimeInMillis());
-            assertDateEquals("2 days ago");
-        } finally {
-            localeTestUtils.restoreLocale();
-        }
+        setPhoneCallDetailsWithDate(
+                new GregorianCalendar(2011, 5, 1, 13, 0, 0).getTimeInMillis());
+        assertDateEquals("2 days ago");
     }
 
     public void testSetPhoneCallDetails_CallTypeIcons() {
@@ -151,66 +168,57 @@
     public void testSetPhoneCallDetails_MultipleCallTypeIconsLastOneDropped() {
         setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE,
                 Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
-        assertCallTypeIconsEqualsPlusOverflow(
-            getContext().getString(R.string.call_log_item_count, 4),
-            Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
-    }
-
-    public void testSetPhoneCallDetails_CallTypeText() {
-        LocaleTestUtils localeTestUtils = new LocaleTestUtils(getContext());
-        localeTestUtils.setLocale(Locale.US);
-        try {
-            setPhoneCallDetailsWithCallTypeText(Calls.INCOMING_TYPE);
-            assertCallTypeTextEquals("Incoming call");
-
-            setPhoneCallDetailsWithCallTypeText(Calls.OUTGOING_TYPE);
-            assertCallTypeTextEquals("Outgoing call");
-
-            setPhoneCallDetailsWithCallTypeText(Calls.MISSED_TYPE);
-            assertCallTypeTextEquals("Missed call");
-
-            setPhoneCallDetailsWithCallTypeText(Calls.VOICEMAIL_TYPE);
-            assertCallTypeTextEquals("Voicemail");
-        } finally {
-            localeTestUtils.restoreLocale();
-        }
+        assertCallTypeIconsEqualsPlusOverflow("(4)",
+                Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
     }
 
     public void testSetPhoneCallDetails_Geocode() {
-        LocaleTestUtils localeTestUtils = new LocaleTestUtils(getContext());
-        localeTestUtils.setLocale(Locale.US);
-        try {
-            setPhoneCallDetailsWithNumber("+14125555555", "1-412-555-5555");
-            assertNameEquals("1-412-555-5555");  // The phone number is shown as the name.
-            assertNumberEquals("Pennsylvania");  // The geocode is shown as the number.
-        } finally {
-            localeTestUtils.restoreLocale();
-        }
+        setPhoneCallDetailsWithNumber("+14125555555", "1-412-555-5555");
+        assertNameEquals("1-412-555-5555");  // The phone number is shown as the name.
+        assertNumberEquals("Pennsylvania");  // The geocode is shown as the number.
     }
 
     public void testSetPhoneCallDetails_NoGeocode() {
-        LocaleTestUtils localeTestUtils = new LocaleTestUtils(getContext());
-        localeTestUtils.setLocale(Locale.US);
-        try {
-            setPhoneCallDetailsWithNumber("+0", "+0");
-            assertNameEquals("+0");  // The phone number is shown as the name.
-            assertNumberEquals("-");  // The empty geocode is shown as the number.
-        } finally {
-            localeTestUtils.restoreLocale();
-        }
+        setPhoneCallDetailsWithNumber("+0", "+0");
+        assertNameEquals("+0");  // The phone number is shown as the name.
+        assertNumberEquals("-");  // The empty geocode is shown as the number.
+    }
+
+    public void testSetPhoneCallDetails_NoGeocodeForUnknown() {
+        setPhoneCallDetailsWithNumber(CallerInfo.UNKNOWN_NUMBER, "");
+        assertNumberEquals("-");  // The empty geocode is shown as the number.
+    }
+
+    public void testSetPhoneCallDetails_NoGeocodeForPrivate() {
+        setPhoneCallDetailsWithNumber(CallerInfo.PRIVATE_NUMBER, "");
+        assertNumberEquals("-");  // The empty geocode is shown as the number.
+    }
+
+    public void testSetPhoneCallDetails_NoGeocodeForPayphone() {
+        setPhoneCallDetailsWithNumber(CallerInfo.PAYPHONE_NUMBER, "");
+        assertNumberEquals("-");  // The empty geocode is shown as the number.
+    }
+
+    public void testSetPhoneCallDetails_NoGeocodeForVoicemail() {
+        setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, "");
+        assertNumberEquals("-");  // The empty geocode is shown as the number.
+    }
+
+    public void testSetPhoneCallDetails_Highlighted() {
+        setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, "");
     }
 
     public void testSetPhoneName_NumberOnly() {
-      setPhoneCallNameWithNumberOnly();
-      assertEquals(View.VISIBLE, mNameView.getVisibility());
-      assertEquals(TEST_FORMATTED_NUMBER, mNameView.getText().toString());
-  }
+        setPhoneCallNameWithNumberOnly();
+        assertEquals(View.VISIBLE, mNameView.getVisibility());
+        assertEquals(TEST_FORMATTED_NUMBER, mNameView.getText().toString());
+    }
 
     public void testSetPhoneName() {
-      setPhoneCallName("John Doe");
-      assertEquals(View.VISIBLE, mNameView.getVisibility());
-      assertEquals("John Doe", mNameView.getText().toString());
-  }
+        setPhoneCallName("John Doe");
+        assertEquals(View.VISIBLE, mNameView.getVisibility());
+        assertEquals("John Doe", mNameView.getText().toString());
+    }
 
     /** Asserts that the name text field contains the value of the given string resource. */
     private void assertNameEqualsResource(int resId) {
@@ -229,7 +237,7 @@
 
     /** Asserts that the date text field contains the given string value. */
     private void assertDateEquals(String text) {
-        assertEquals(text, mViews.dateView.getText().toString());
+        assertEquals(text, mViews.callTypeAndDate.getText().toString());
     }
 
     /** Asserts that the call type contains the images with the given drawables. */
@@ -240,8 +248,7 @@
             assertEquals(id, mViews.callTypeIcons.getCallType(index));
         }
         assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility());
-        assertEquals(View.GONE, mViews.callTypeText.getVisibility());
-        assertEquals(View.GONE, mViews.callTypeSeparator.getVisibility());
+        assertEquals("yesterday", mViews.callTypeAndDate.getText().toString());
     }
 
     /**
@@ -255,25 +262,15 @@
             assertEquals(id, mViews.callTypeIcons.getCallType(index));
         }
         assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility());
-        assertEquals(View.VISIBLE, mViews.callTypeText.getVisibility());
-        assertEquals(overflowText, mViews.callTypeText.getText().toString());
-        assertEquals(View.VISIBLE, mViews.callTypeSeparator.getVisibility());
-    }
-
-    /** Asserts that the call type contains the given text. */
-    private void assertCallTypeTextEquals(String text) {
-        assertEquals(text, mViews.callTypeText.getText().toString());
-        assertEquals(View.GONE, mViews.callTypeIcons.getVisibility());
-        assertEquals(View.VISIBLE, mViews.callTypeText.getVisibility());
-        assertEquals(View.VISIBLE, mViews.callTypeSeparator.getVisibility());
+        assertEquals(overflowText + " yesterday", mViews.callTypeAndDate.getText().toString());
     }
 
     /** Sets the phone call details with default values and the given number. */
     private void setPhoneCallDetailsWithNumber(String number, String formattedNumber) {
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO,
-                        new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION),
-                false, false);
+                        new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION),
+                true);
     }
 
     /** Sets the phone call details with default values and the given date. */
@@ -281,24 +278,15 @@
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
                         new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION),
-                false, false);
+                false);
     }
 
     /** Sets the phone call details with default values and the given call types using icons. */
     private void setPhoneCallDetailsWithCallTypeIcons(int... callTypes) {
-        setPhoneCallDetailsWithCallTypes(true, callTypes);
-    }
-
-    /** Sets the phone call details with default values and the given call types using text. */
-    private void setPhoneCallDetailsWithCallTypeText(int... callTypes) {
-        setPhoneCallDetailsWithCallTypes(false, callTypes);
-    }
-
-    private void setPhoneCallDetailsWithCallTypes(boolean useIcons, int... callTypes) {
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
                         callTypes, TEST_DATE, TEST_DURATION),
-                useIcons, false);
+                false);
     }
 
     private void setPhoneCallNameWithNumberOnly() {
diff --git a/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
index 4628b8e..1cf7da9 100644
--- a/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
@@ -140,7 +140,7 @@
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO,
                         new int[]{ callType }, TEST_DATE, TEST_DURATION),
-                true, false);
+                false);
     }
 
     /** Sets the details of a phone call using the specified call type. */
@@ -148,7 +148,7 @@
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
                         types, TEST_DATE, TEST_DURATION),
-                true, false);
+                false);
     }
 
     /** Sets the details of a phone call using the specified call type. */
@@ -156,6 +156,6 @@
         mHelper.setPhoneCallDetails(mViews,
                 new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
                         types, TEST_DATE, TEST_DURATION),
-                true, true);
+                true);
     }
 }