Use simple TextView for call details header.
Instead of the using the more complex call_log_phone_call_details
layout, use just a text view, since all we want to show is the name (or
number) of the person who called.
Bug: 5099652
Change-Id: I408b5ffaeea09c0efe2631bd317d1ea640be294f
diff --git a/src/com/android/contacts/PhoneCallDetailsHelper.java b/src/com/android/contacts/PhoneCallDetailsHelper.java
index 8cdd0d0..08e6a56 100644
--- a/src/com/android/contacts/PhoneCallDetailsHelper.java
+++ b/src/com/android/contacts/PhoneCallDetailsHelper.java
@@ -28,6 +28,7 @@
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.View;
+import android.widget.TextView;
/**
* Helper class to fill in the views in {@link PhoneCallDetailsViews}.
@@ -59,7 +60,7 @@
/** Fills the call details views with content. */
public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details,
- boolean useIcons, boolean isHighlighted, boolean nameOnly) {
+ boolean useIcons, boolean isHighlighted) {
if (useIcons) {
views.callTypeIcons.clear();
int count = details.callTypes.length;
@@ -130,21 +131,22 @@
}
views.dateView.setText(shortDateText);
- views.dateView.setVisibility(View.VISIBLE);
views.nameView.setText(nameText);
- views.nameView.setVisibility(View.VISIBLE);
- // Do not show the number if it is not available. This happens if we have only the number,
- // in which case the number is shown in the name field instead.
- if (!TextUtils.isEmpty(numberText)) {
- views.numberView.setText(numberText);
- views.numberView.setVisibility(View.VISIBLE);
+ views.numberView.setText(numberText);
+ }
+
+ /** Sets the name in the text view for the given phone call. */
+ public void setPhoneCallName(TextView nameView, PhoneCallDetails details) {
+ final CharSequence nameText;
+ final CharSequence displayNumber =
+ mPhoneNumberHelper.getDisplayNumber(details.number, details.formattedNumber);
+ if (TextUtils.isEmpty(details.name)) {
+ nameText = displayNumber;
} else {
- views.numberView.setVisibility(View.GONE);
+ nameText = details.name;
}
- // Hide the rest if not visible.
- views.callTypeView.setVisibility(nameOnly ? View.GONE : View.VISIBLE);
- views.numberView.setVisibility(nameOnly ? View.GONE : View.VISIBLE);
+ nameView.setText(nameText);
}
public void setCurrentTimeForTest(long currentTimeMillis) {