Fixes some entry layouts

Moves text over to match up with "See all"/"See less" and adds top margin when only header text is visible.

Bug: 16326938
Change-Id: Ib9171ba8c27ffccfc5eb3c1e023e827e8e71e7fe
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d86d9d7..7c6b635 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -171,7 +171,7 @@
     <dimen name="expanding_entry_card_item_padding_end">20dp</dimen>
     <dimen name="expanding_entry_card_item_padding_top">16dp</dimen>
     <dimen name="expanding_entry_card_item_padding_bottom">16dp</dimen>
-    <dimen name="expanding_entry_card_item_image_spacing">16dp</dimen>
+    <dimen name="expanding_entry_card_item_image_spacing">20dp</dimen>
 
     <!-- Dimensions for a button in ExpandingEntryCardView -->
     <dimen name="expanding_entry_card_button_padding_start">20dp</dimen>
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index e4770d8..a0bed05 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -37,6 +37,7 @@
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.android.contacts.R;
@@ -508,6 +509,16 @@
             view.setTag(entry.getIntent());
         }
 
+        // If only the header is visible, add a top margin to match icon's top margin
+        if (header.getVisibility() == View.VISIBLE && subHeader.getVisibility() == View.GONE &&
+                text.getVisibility() == View.GONE) {
+            RelativeLayout.LayoutParams headerLayoutParams =
+                    (RelativeLayout.LayoutParams) header.getLayoutParams();
+            headerLayoutParams.topMargin = (int) (getResources().getDimension(
+                    R.dimen.expanding_entry_card_item_icon_margin_top));
+            header.setLayoutParams(headerLayoutParams);
+        }
+
         final ImageView alternateIcon = (ImageView) view.findViewById(R.id.icon_alternate);
         if (entry.getAlternateIcon() != null && entry.getAlternateIntent() != null) {
             alternateIcon.setImageDrawable(entry.getAlternateIcon());