Fixes for long phone numbers and labels.
Move the label after the numbe for consistency with other views.
Split the number and label so that RTL support works, instead of
composing two strings programmatically.
Do not split phone numbers and labels on multiple lines in the details
view.
Bug: 5465709
Bug: 5429886
Bug: 5631828
Change-Id: I169f99ae45a674f79c7bb3dc59f79801a8b38567
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 13124f2..7498f5a 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -162,16 +162,22 @@
<TextView android:id="@+id/call_and_sms_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:paddingRight="@dimen/call_log_icon_margin"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?attr/call_log_primary_text_color"
+ android:singleLine="true"
+ android:ellipsize="end"
/>
<TextView android:id="@+id/call_and_sms_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:paddingRight="@dimen/call_log_icon_margin"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/call_log_primary_text_color"
android:textAllCaps="true"
+ android:singleLine="true"
+ android:ellipsize="end"
/>
</LinearLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 777c7af..4040c28 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -69,18 +69,38 @@
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
android:textColor="?attr/call_log_primary_text_color"
android:textSize="18sp"
android:singleLine="true"
/>
- <TextView
- android:id="@+id/number"
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="14sp"
- android:singleLine="true"
- />
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:id="@+id/number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="14sp"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ />
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textStyle="bold"
+ android:textSize="14sp"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ />
+ </LinearLayout>
<LinearLayout
android:id="@+id/call_type"
android:layout_width="wrap_content"
@@ -99,6 +119,7 @@
android:id="@+id/call_count_and_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
android:layout_gravity="center_vertical"
android:textColor="?attr/call_log_secondary_text_color"
android:textSize="14sp"
diff --git a/src/com/android/contacts/PhoneCallDetailsHelper.java b/src/com/android/contacts/PhoneCallDetailsHelper.java
index 2d75c26..60dfb7b 100644
--- a/src/com/android/contacts/PhoneCallDetailsHelper.java
+++ b/src/com/android/contacts/PhoneCallDetailsHelper.java
@@ -18,7 +18,6 @@
import com.android.contacts.calllog.CallTypeHelper;
import com.android.contacts.calllog.PhoneNumberHelper;
-import com.android.contacts.format.FormatUtils;
import android.content.res.Resources;
import android.graphics.Typeface;
@@ -103,6 +102,7 @@
final CharSequence nameText;
final CharSequence numberText;
+ final CharSequence labelText;
final CharSequence displayNumber =
mPhoneNumberHelper.getDisplayNumber(details.number, details.formattedNumber);
if (TextUtils.isEmpty(details.name)) {
@@ -113,20 +113,17 @@
} else {
numberText = details.geocode;
}
+ labelText = null;
} else {
nameText = details.name;
- if (numberFormattedLabel != null) {
- numberText = FormatUtils.applyStyleToSpan(Typeface.BOLD,
- numberFormattedLabel + " " + displayNumber, 0,
- numberFormattedLabel.length(),
- Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- } else {
- numberText = displayNumber;
- }
+ numberText = displayNumber;
+ labelText = numberFormattedLabel;
}
views.nameView.setText(nameText);
views.numberView.setText(numberText);
+ views.labelView.setText(labelText);
+ views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE);
}
/** Sets the text of the header view for the details page of a phone call. */
diff --git a/src/com/android/contacts/PhoneCallDetailsViews.java b/src/com/android/contacts/PhoneCallDetailsViews.java
index fa06879..ea5a461 100644
--- a/src/com/android/contacts/PhoneCallDetailsViews.java
+++ b/src/com/android/contacts/PhoneCallDetailsViews.java
@@ -31,14 +31,17 @@
public final CallTypeIconsView callTypeIcons;
public final TextView callTypeAndDate;
public final TextView numberView;
+ public final TextView labelView;
private PhoneCallDetailsViews(TextView nameView, View callTypeView,
- CallTypeIconsView callTypeIcons, TextView callTypeAndDate, TextView numberView) {
+ CallTypeIconsView callTypeIcons, TextView callTypeAndDate, TextView numberView,
+ TextView labelView) {
this.nameView = nameView;
this.callTypeView = callTypeView;
this.callTypeIcons = callTypeIcons;
this.callTypeAndDate = callTypeAndDate;
this.numberView = numberView;
+ this.labelView = labelView;
}
/**
@@ -53,7 +56,8 @@
view.findViewById(R.id.call_type),
(CallTypeIconsView) view.findViewById(R.id.call_type_icons),
(TextView) view.findViewById(R.id.call_count_and_date),
- (TextView) view.findViewById(R.id.number));
+ (TextView) view.findViewById(R.id.number),
+ (TextView) view.findViewById(R.id.label));
}
public static PhoneCallDetailsViews createForTest(Context context) {
@@ -62,6 +66,7 @@
new View(context),
new CallTypeIconsView(context),
new TextView(context),
+ new TextView(context),
new TextView(context));
}
}