summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java8
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java8
-rw-r--r--tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java25
3 files changed, 30 insertions, 11 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index db37bb3f3..c8206227a 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -212,10 +212,12 @@ public class PhoneCallDetailsHelper {
@NeededForTesting
public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) {
final CharSequence nameText;
- if (TextUtils.isEmpty(details.name)) {
- nameText = mResources.getString(R.string.recentCalls_addToContact);
- } else {
+ if (!TextUtils.isEmpty(details.name)) {
nameText = details.name;
+ } else if (!TextUtils.isEmpty(details.displayNumber)) {
+ nameText = details.displayNumber;
+ } else {
+ nameText = mResources.getString(R.string.unknown);
}
nameView.setText(nameText);
diff --git a/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java b/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
index e7fcde263..acfd32cf3 100644
--- a/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
+++ b/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
@@ -71,14 +71,14 @@ public class PhoneNumberDisplayUtil {
int presentation,
CharSequence formattedNumber,
boolean isVoicemail) {
- if (!TextUtils.isEmpty(formattedNumber)) {
- return formattedNumber;
- }
-
final CharSequence displayName =
getDisplayName(context, accountHandle, number, presentation, isVoicemail);
if (!TextUtils.isEmpty(displayName)) {
return displayName;
+ }
+
+ if (!TextUtils.isEmpty(formattedNumber)) {
+ return formattedNumber;
} else if (!TextUtils.isEmpty(number)) {
return number;
} else {
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index 701a06ed9..3e7eb66b6 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -132,11 +132,11 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
setPhoneCallDetailsWithDate(
new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis());
- assertDateEquals("0 mins ago");
+ assertDateEquals("0 min. ago");
setPhoneCallDetailsWithDate(
new GregorianCalendar(2011, 5, 3, 12, 0, 0).getTimeInMillis());
- assertDateEquals("1 hour ago");
+ assertDateEquals("1 hr. ago");
setPhoneCallDetailsWithDate(
new GregorianCalendar(2011, 5, 2, 13, 0, 0).getTimeInMillis());
@@ -223,7 +223,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
public void testSetCallDetailsHeader_NumberOnly() {
setCallDetailsHeaderWithNumber(TEST_NUMBER, Calls.PRESENTATION_ALLOWED);
assertEquals(View.VISIBLE, mNameView.getVisibility());
- assertEquals("Add to contacts", mNameView.getText().toString());
+ assertEquals("1-412-255-5555", mNameView.getText().toString());
}
public void testSetCallDetailsHeader_UnknownNumber() {
@@ -245,7 +245,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
}
public void testSetCallDetailsHeader_VoicemailNumber() {
- setCallDetailsHeaderWithNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED);
+ setCallDetailsHeaderWithVoicemailNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED);
assertEquals(View.VISIBLE, mNameView.getVisibility());
assertEquals("Voicemail", mNameView.getText().toString());
}
@@ -412,6 +412,23 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
false /* isVoicemail */));
}
+ private void setCallDetailsHeaderWithVoicemailNumber(String number, int presentation) {
+ mHelper.setCallDetailsHeader(mNameView,
+ new PhoneCallDetails(
+ mContext,
+ number,
+ presentation,
+ TEST_FORMATTED_NUMBER,
+ TEST_COUNTRY_ISO,
+ TEST_GEOCODE,
+ new int[]{ Calls.INCOMING_TYPE },
+ TEST_DATE,
+ TEST_DURATION,
+ null, 0, null, null,
+ true /* isVoicemail */));
+ }
+
+
private void setCallDetailsHeader(String name) {
mHelper.setCallDetailsHeader(mNameView,
new PhoneCallDetails(