am f4b2bac2: am 3d0ee424: Fix cosmetic glitch in the Call log with SIP addresses
Merge commit 'f4b2bac2f1554276c66cd835ba56942d63eb358f'
* commit 'f4b2bac2f1554276c66cd835ba56942d63eb358f':
Fix cosmetic glitch in the Call log with SIP addresses
diff --git a/res/layout/recent_calls_list_group_item.xml b/res/layout/recent_calls_list_group_item.xml
index 5b4cf21..79423fa 100644
--- a/res/layout/recent_calls_list_group_item.xml
+++ b/res/layout/recent_calls_list_group_item.xml
@@ -60,6 +60,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="36dip"
+ android:layout_marginRight="5dip"
android:layout_alignBaseline="@id/date"
android:singleLine="true"
@@ -71,7 +72,6 @@
<TextView android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
android:layout_toRightOf="@id/label"
android:layout_toLeftOf="@id/date"
android:layout_alignBaseline="@id/label"
diff --git a/res/layout/recent_calls_list_item_layout.xml b/res/layout/recent_calls_list_item_layout.xml
index 7463669..faaa893 100644
--- a/res/layout/recent_calls_list_item_layout.xml
+++ b/res/layout/recent_calls_list_item_layout.xml
@@ -52,6 +52,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="36dip"
+ android:layout_marginRight="5dip"
android:layout_alignBaseline="@id/date"
android:singleLine="true"
@@ -63,7 +64,6 @@
<TextView android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
android:layout_toRightOf="@id/label"
android:layout_toLeftOf="@id/date"
android:layout_alignBaseline="@id/label"
diff --git a/src/com/android/contacts/RecentCallsListActivity.java b/src/com/android/contacts/RecentCallsListActivity.java
index 3a6b35e..35d926c 100644
--- a/src/com/android/contacts/RecentCallsListActivity.java
+++ b/src/com/android/contacts/RecentCallsListActivity.java
@@ -676,8 +676,33 @@
if (!TextUtils.isEmpty(numberLabel)) {
views.labelView.setText(numberLabel);
views.labelView.setVisibility(View.VISIBLE);
+
+ // Zero out the numberView's left margin (see below)
+ ViewGroup.MarginLayoutParams numberLP =
+ (ViewGroup.MarginLayoutParams) views.numberView.getLayoutParams();
+ numberLP.leftMargin = 0;
+ views.numberView.setLayoutParams(numberLP);
} else {
- views.labelView.setVisibility(View.GONE);
+ // There's nothing to display in views.labelView, so hide it.
+ // We can't set it to View.GONE, since it's the anchor for
+ // numberView in the RelativeLayout, so make it INVISIBLE.
+ // Also, we need to manually *subtract* some left margin from
+ // numberView to compensate for the right margin built in to
+ // labelView (otherwise the number will be indented by a very
+ // slight amount).
+ // TODO: a cleaner fix would be to contain both the label and
+ // number inside a LinearLayout, and then set labelView *and*
+ // its padding to GONE when there's no label to display.
+ views.labelView.setText(null);
+ views.labelView.setVisibility(View.INVISIBLE);
+
+ ViewGroup.MarginLayoutParams labelLP =
+ (ViewGroup.MarginLayoutParams) views.labelView.getLayoutParams();
+ ViewGroup.MarginLayoutParams numberLP =
+ (ViewGroup.MarginLayoutParams) views.numberView.getLayoutParams();
+ // Equivalent to setting android:layout_marginLeft in XML
+ numberLP.leftMargin = -labelLP.rightMargin;
+ views.numberView.setLayoutParams(numberLP);
}
} else {
if (number.equals(CallerInfo.UNKNOWN_NUMBER)) {