Merge "More fixes for push-states."
diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml
index 852b6f7..4735d03 100644
--- a/res/layout/call_log_fragment.xml
+++ b/res/layout/call_log_fragment.xml
@@ -14,6 +14,7 @@
      limitations under the License.
 -->
 
+<!-- Layout parameters are set programmatically. -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
diff --git a/res/layout/contact_detail_network_title_entry_view.xml b/res/layout/contact_detail_network_title_entry_view.xml
index bc0d3f1..1907a7a 100644
--- a/res/layout/contact_detail_network_title_entry_view.xml
+++ b/res/layout/contact_detail_network_title_entry_view.xml
@@ -17,31 +17,38 @@
  */
 -->
 
-<LinearLayout
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:paddingLeft="@dimen/detail_item_side_margin"
-    android:paddingRight="@dimen/detail_item_side_margin"
-    android:paddingTop="@dimen/detail_item_vertical_margin"
-    android:paddingBottom="@dimen/detail_item_vertical_margin"
-    android:orientation="horizontal"
-    android:gravity="center_vertical">
-
-    <ImageView
-        android:id="@+id/network_icon"
-        android:layout_width="@dimen/detail_network_icon_size"
-        android:layout_height="@dimen/detail_network_icon_size"
-        android:layout_marginLeft="@dimen/detail_item_icon_margin"
-        android:layout_marginRight="@dimen/detail_item_icon_margin"
-        android:layout_gravity="center_vertical"
-        android:scaleType="centerInside" />
-
-    <TextView
-        android:id="@+id/network_title"
-        android:layout_width="wrap_content"
+    android:paddingRight="@dimen/detail_item_side_margin">
+    <LinearLayout
+        android:id="@+id/primary_action_view"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
+        android:paddingTop="@dimen/detail_item_vertical_margin"
+        android:paddingBottom="@dimen/detail_item_vertical_margin"
+        android:focusable="true"
+        android:background="?android:attr/selectableItemBackground"
+        android:minHeight="@dimen/detail_min_line_item_height"
+        android:orientation="horizontal"
+        android:gravity="center_vertical">
 
-</LinearLayout>
+        <ImageView
+            android:id="@+id/network_icon"
+            android:layout_width="@dimen/detail_network_icon_size"
+            android:layout_height="@dimen/detail_network_icon_size"
+            android:layout_marginLeft="@dimen/detail_item_icon_margin"
+            android:layout_marginRight="@dimen/detail_item_icon_margin"
+            android:layout_gravity="center_vertical"
+            android:scaleType="centerInside" />
+
+        <TextView
+            android:id="@+id/network_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+    </LinearLayout>
+</FrameLayout>
diff --git a/res/layout/contact_tile_frequent.xml b/res/layout/contact_tile_frequent.xml
index 43bbe9d..5b51c78 100644
--- a/res/layout/contact_tile_frequent.xml
+++ b/res/layout/contact_tile_frequent.xml
@@ -18,9 +18,7 @@
     class="com.android.contacts.list.ContactTileView"
     android:focusable="true"
     android:background="?android:attr/selectableItemBackground"
-    android:nextFocusRight="@+id/contact_tile_quick"
-    android:paddingRight="16dip"
-    android:paddingLeft="16dip" >
+    android:nextFocusRight="@+id/contact_tile_quick">
 
     <RelativeLayout
         android:layout_width="match_parent"
diff --git a/res/layout/contact_tile_frequent_phone.xml b/res/layout/contact_tile_frequent_phone.xml
index dffdfc7..5bd82cd 100644
--- a/res/layout/contact_tile_frequent_phone.xml
+++ b/res/layout/contact_tile_frequent_phone.xml
@@ -13,15 +13,15 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
+
+<!-- Layout parameters are set programmatically. -->
 <view
-    android:id="@+id/contact_tile_frequent_phone"
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/contact_tile_frequent_phone"
     class="com.android.contacts.list.ContactTileDarkFrequentView"
     android:focusable="true"
     android:background="?android:attr/selectableItemBackground"
-    android:nextFocusLeft="@+id/contact_tile_quick"
-    android:paddingRight="16dip"
-    android:paddingLeft="16dip" >
+    android:nextFocusLeft="@+id/contact_tile_quick">
 
     <RelativeLayout
         android:layout_width="match_parent"
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index 605a920..f3f8e8a 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -1161,7 +1161,7 @@
             this.mIcon = icon;
             this.mLabel = label;
             this.mOnClickListener = onClickListener;
-            this.isEnabled = onClickListener != null;
+            this.isEnabled = false;
         }
 
         public static NetworkTitleViewEntry fromAccountType(Context context, AccountType type) {
@@ -1554,6 +1554,8 @@
                         parent, false);
                 viewCache = new NetworkTitleViewCache(result);
                 result.setTag(viewCache);
+                result.findViewById(R.id.primary_action_view).setOnClickListener(
+                        entry.mOnClickListener);
             }
 
             viewCache.name.setText(entry.getLabel());
diff --git a/src/com/android/contacts/list/ContactTileAdapter.java b/src/com/android/contacts/list/ContactTileAdapter.java
index 304b109..a12b127 100644
--- a/src/com/android/contacts/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/list/ContactTileAdapter.java
@@ -513,9 +513,16 @@
                 contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null);
                 // Note: the layoutparam set here is only actually used for FREQUENT.
                 // We override onMeasure() for STARRED and we don't care the layout param there.
-                contactTile.setLayoutParams(new FrameLayout.LayoutParams(
+                Resources resources = mContext.getResources();
+                FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                         ViewGroup.LayoutParams.WRAP_CONTENT,
-                        ViewGroup.LayoutParams.WRAP_CONTENT));
+                        ViewGroup.LayoutParams.WRAP_CONTENT);
+                params.setMargins(
+                        resources.getDimensionPixelSize(R.dimen.detail_item_side_margin),
+                        0,
+                        resources.getDimensionPixelSize(R.dimen.detail_item_side_margin),
+                        0);
+                contactTile.setLayoutParams(params);
                 contactTile.setPhotoManager(mPhotoManager);
                 contactTile.setListener(mContactTileListener);
                 addView(contactTile);