Merge "Remove strict mode violation with number formatting."
diff --git a/res/drawable/list_divider.xml b/res/drawable/list_divider.xml
new file mode 100644
index 0000000..81df0f5
--- /dev/null
+++ b/res/drawable/list_divider.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid
+        android:color="@color/quickcontact_list_divider"/>
+</shape>
\ No newline at end of file
diff --git a/res/drawable/quickcontact_list_item_divider.xml b/res/drawable/quickcontact_list_item_divider.xml
new file mode 100644
index 0000000..99882c4
--- /dev/null
+++ b/res/drawable/quickcontact_list_item_divider.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/list_divider"
+    android:insetRight="16dp"
+    android:insetLeft="16dp" />
\ No newline at end of file
diff --git a/res/layout-land/quickcontact_list_fragment_bottom.xml b/res/layout-land/quickcontact_list_fragment_bottom.xml
new file mode 100755
index 0000000..957ec53
--- /dev/null
+++ b/res/layout-land/quickcontact_list_fragment_bottom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_alignParentBottom="true"
+    style="@style/QuickContactListBottomStyle"/>
diff --git a/res/layout-sw580dp-w1000dp/quickcontact_list_fragment_bottom.xml b/res/layout-sw580dp-w1000dp/quickcontact_list_fragment_bottom.xml
new file mode 100755
index 0000000..e08b3aa
--- /dev/null
+++ b/res/layout-sw580dp-w1000dp/quickcontact_list_fragment_bottom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_alignBottom="@+id/list"
+    style="@style/QuickContactListBottomStyle"/>
diff --git a/res/layout/quickcontact_activity.xml b/res/layout/quickcontact_activity.xml
index c8d0ad4..c1759bf 100644
--- a/res/layout/quickcontact_activity.xml
+++ b/res/layout/quickcontact_activity.xml
@@ -29,6 +29,7 @@
         android:layout_height="wrap_content"
         android:paddingLeft="15dip"
         android:paddingRight="15dip"
+        android:paddingTop="8dip"
         android:orientation="vertical">
         <view
             class="com.android.contacts.widget.ProportionalLayout"
@@ -47,6 +48,6 @@
         <android.support.v4.view.ViewPager
             android:id="@+id/item_list_pager"
             android:layout_width="match_parent"
-            android:layout_height="180dip" />
+            android:layout_height="156dip" />
     </LinearLayout>
 </view>
diff --git a/res/layout/quickcontact_list_fragment.xml b/res/layout/quickcontact_list_fragment.xml
index 8c62c4c..5ade104 100755
--- a/res/layout/quickcontact_list_fragment.xml
+++ b/res/layout/quickcontact_list_fragment.xml
@@ -24,12 +24,18 @@
         android:layout_width="match_parent"
         android:layout_height="1dip"
         android:background="@color/quickcontact_list_divider" />
-    <ListView
-        android:id="@+id/list"
+    <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:divider="@color/quickcontact_list_divider"
-        android:dividerHeight="1dip"
-        android:background="@color/quickcontact_list_background"
-        android:cacheColorHint="@null" />
+        android:layout_height="wrap_content">
+        <ListView
+            android:id="@+id/list"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:divider="@drawable/quickcontact_list_item_divider"
+            android:dividerHeight="1dip"
+            android:background="@color/quickcontact_list_background"
+            android:cacheColorHint="@null"
+            android:layout_alignParentTop="true" />
+        <include layout="@layout/quickcontact_list_fragment_bottom"/>
+    </RelativeLayout>
 </LinearLayout>
diff --git a/res/layout/quickcontact_list_fragment_bottom.xml b/res/layout/quickcontact_list_fragment_bottom.xml
new file mode 100755
index 0000000..e08b3aa
--- /dev/null
+++ b/res/layout/quickcontact_list_fragment_bottom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_alignBottom="@+id/list"
+    style="@style/QuickContactListBottomStyle"/>
diff --git a/res/layout/quickcontact_list_item.xml b/res/layout/quickcontact_list_item.xml
index 5a1643c..ee3a89f 100755
--- a/res/layout/quickcontact_list_item.xml
+++ b/res/layout/quickcontact_list_item.xml
@@ -13,32 +13,20 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/actions_view_container"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:orientation="horizontal"
-    android:gravity="center_vertical"
-    android:background="?android:attr/selectableItemBackground"
-    android:nextFocusRight="@+id/secondary_action_button">
-    <LinearLayout
-        android:layout_width="0dip"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:paddingLeft="16dip"
-        android:paddingRight="16dip"
-        android:gravity="center_vertical"
-        android:orientation="vertical"
-    >
+    android:nextFocusRight="@+id/secondary_action_button"
+    style="@style/QuickContactListItemStyle">
+    <LinearLayout style="@style/QuickContactListItemTextWrapperStyle">
         <TextView
             android:id="@android:id/text1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textColor="@color/primary_text_color"
-            android:textAppearance="?android:attr/textAppearanceMedium" />
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:singleLine="true"
+            android:ellipsize="end" />
         <TextView
             android:id="@android:id/text2"
             android:layout_width="wrap_content"
@@ -47,27 +35,5 @@
             android:textAllCaps="true"
             android:textAppearance="?android:attr/textAppearanceSmall" />
     </LinearLayout>
-    <View
-        android:id="@+id/vertical_divider"
-        android:layout_width="1dip"
-        android:layout_height="match_parent"
-        android:layout_gravity="center_vertical"
-        android:layout_marginTop="@dimen/detail_vertical_divider_vertical_margin"
-        android:layout_marginBottom="@dimen/detail_vertical_divider_vertical_margin"
-        android:background="?android:attr/dividerVertical" />
-    <ImageView
-        android:id="@+id/secondary_action_button"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:paddingLeft="@dimen/detail_item_icon_margin"
-        android:paddingRight="@dimen/detail_item_icon_margin"
-        android:background="?android:attr/selectableItemBackground"
-        android:duplicateParentState="false"
-        android:nextFocusLeft="@id/actions_view_container" />
-    <View
-        android:id="@+id/vertical_divider"
-        android:layout_width="1dip"
-        android:layout_height="match_parent"
-        android:layout_gravity="center_vertical"
-        android:background="?android:attr/dividerVertical" />
+    <include layout="@layout/quickcontact_list_item_base"/>
 </LinearLayout>
diff --git a/res/layout/quickcontact_list_item_address.xml b/res/layout/quickcontact_list_item_address.xml
new file mode 100755
index 0000000..9773b10
--- /dev/null
+++ b/res/layout/quickcontact_list_item_address.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/actions_view_container"
+    android:nextFocusRight="@+id/secondary_action_button"
+    style="@style/QuickContactListItemStyle">
+    <LinearLayout style="@style/QuickContactListItemTextWrapperStyle"
+        android:layout_marginTop="12dip"
+        android:layout_marginBottom="12dip">
+        <TextView
+            android:id="@android:id/text1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/primary_text_color"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+        <TextView
+            android:id="@android:id/text2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/secondary_text_color"
+            android:textAllCaps="true"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+    </LinearLayout>
+    <include layout="@layout/quickcontact_list_item_base"/>
+</LinearLayout>
diff --git a/res/layout/quickcontact_list_item_base.xml b/res/layout/quickcontact_list_item_base.xml
new file mode 100644
index 0000000..329df78
--- /dev/null
+++ b/res/layout/quickcontact_list_item_base.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <View
+        android:id="@+id/vertical_divider"
+        android:layout_width="1dip"
+        android:layout_height="match_parent"
+        android:layout_gravity="center_vertical"
+        android:layout_marginTop="@dimen/detail_vertical_divider_vertical_margin"
+        android:layout_marginBottom="@dimen/detail_vertical_divider_vertical_margin"
+        android:background="?android:attr/dividerVertical" />
+    <ImageView
+        android:id="@+id/secondary_action_button"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:paddingLeft="8dip"
+        android:paddingRight="14dip"
+        android:background="?android:attr/selectableItemBackground"
+        android:duplicateParentState="false"
+        android:nextFocusLeft="@id/actions_view_container"/>
+    <View
+        android:id="@+id/vertical_divider"
+        android:layout_width="1dip"
+        android:layout_height="match_parent"
+        android:layout_gravity="center_vertical"
+        android:background="?android:attr/dividerVertical" />
+</merge>
diff --git a/res/layout/quickcontact_photo_container.xml b/res/layout/quickcontact_photo_container.xml
index ffaf12f..1ba939a 100644
--- a/res/layout/quickcontact_photo_container.xml
+++ b/res/layout/quickcontact_photo_container.xml
@@ -26,6 +26,11 @@
             android:layout_height="match_parent"
             android:scaleType="centerCrop" />
         <View
+            android:layout_width="match_parent"
+            android:layout_height="1dip"
+            android:layout_alignParentTop="true"
+            android:background="#4CFFFFFF" />
+        <View
             android:id="@+id/photo_text_bar"
             android:layout_width="0dip"
             android:layout_height="42dip"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5e7d9e2..f33f2a6 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -263,4 +263,28 @@
         <item name="android:displayOptions"></item>
     </style>
 
+    <style name="QuickContactListItemStyle">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
+        <item name="android:orientation">horizontal</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:background">?android:attr/selectableItemBackground</item>
+    </style>
+
+    <style name="QuickContactListItemTextWrapperStyle">
+        <item name="android:layout_width">0dip</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_weight">1</item>
+        <item name="android:paddingLeft">16dip</item>
+        <item name="android:paddingRight">16dip</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:orientation">vertical</item>
+    </style>
+
+    <style name="QuickContactListBottomStyle">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">2dip</item>
+        <item name="android:background">@color/quickcontact_tab_indicator</item>
+    </style>
 </resources>
diff --git a/src/com/android/contacts/list/DefaultContactListAdapter.java b/src/com/android/contacts/list/DefaultContactListAdapter.java
index 2a8d665..3409f56 100644
--- a/src/com/android/contacts/list/DefaultContactListAdapter.java
+++ b/src/com/android/contacts/list/DefaultContactListAdapter.java
@@ -185,7 +185,7 @@
                 break;
             }
             case ContactListFilter.FILTER_TYPE_ACCOUNT: {
-                // TODO (stopship): avoid the use of private API
+                // TODO: avoid the use of private API
                 selection.append(
                         Contacts._ID + " IN ("
                                 + "SELECT DISTINCT " + RawContacts.CONTACT_ID
diff --git a/src/com/android/contacts/quickcontact/QuickContactListFragment.java b/src/com/android/contacts/quickcontact/QuickContactListFragment.java
index 5dd9db7..0d3b644 100644
--- a/src/com/android/contacts/quickcontact/QuickContactListFragment.java
+++ b/src/com/android/contacts/quickcontact/QuickContactListFragment.java
@@ -20,7 +20,10 @@
 
 import android.app.Fragment;
 import android.os.Bundle;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Website;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -87,12 +90,17 @@
 
             @Override
             public View getView(int position, View convertView, ViewGroup parent) {
-                final View resultView = convertView != null ? convertView
-                        : getActivity().getLayoutInflater()
-                        .inflate(R.layout.quickcontact_list_item, parent, false);
-
                 // Set action title based on summary value
                 final Action action = mActions.get(position);
+                String mimeType = action.getMimeType();
+
+                final View resultView = convertView != null ? convertView
+                        : getActivity().getLayoutInflater().inflate(
+                                mimeType.equals(StructuredPostal.CONTENT_ITEM_TYPE) ?
+                                        R.layout.quickcontact_list_item_address :
+                                        R.layout.quickcontact_list_item,
+                                        parent, false);
+
 
                 // TODO: Put those findViewByIds in a container
                 final TextView text1 = (TextView) resultView.findViewById(
@@ -116,7 +124,7 @@
                 alternateActionButton.setVisibility(hasAlternateAction ? View.VISIBLE : View.GONE);
 
                 // Special case for phone numbers in accessibility mode
-                if (action.getMimeType().equals(Phone.CONTENT_ITEM_TYPE)) {
+                if (mimeType.equals(Phone.CONTENT_ITEM_TYPE)) {
                     text1.setContentDescription(getActivity().getString(
                             R.string.description_dial_phone_number, action.getBody()));
                     if (hasAlternateAction) {
@@ -126,14 +134,15 @@
                 }
 
                 text1.setText(action.getBody());
-                CharSequence subtitle = action.getSubtitle();
-                text2.setText(subtitle);
-                if (TextUtils.isEmpty(subtitle)) {
-                    text2.setVisibility(View.GONE);
-                } else {
-                    text2.setVisibility(View.VISIBLE);
+                if (text2 != null) {
+                    CharSequence subtitle = action.getSubtitle();
+                    text2.setText(subtitle);
+                    if (TextUtils.isEmpty(subtitle)) {
+                        text2.setVisibility(View.GONE);
+                    } else {
+                        text2.setVisibility(View.VISIBLE);
+                    }
                 }
-
                 return resultView;
             }
         });
diff --git a/src/com/android/contacts/vcard/ExportVCardActivity.java b/src/com/android/contacts/vcard/ExportVCardActivity.java
index a0fd4d8..c36cc38 100644
--- a/src/com/android/contacts/vcard/ExportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ExportVCardActivity.java
@@ -141,6 +141,7 @@
                 mService.handleExportRequest(request, new NotificationImportExportListener(
                         ExportVCardActivity.this));
             }
+            unbindAndFinish();
         }
     }