Merge "Excluding local invisible contacts from search results"
diff --git a/res/drawable-hdpi/filter_selector_corner.png b/res/drawable-hdpi/filter_selector_corner.png
new file mode 100644
index 0000000..964dd75
--- /dev/null
+++ b/res/drawable-hdpi/filter_selector_corner.png
Binary files differ
diff --git a/res/drawable-mdpi/filter_selector_corner.png b/res/drawable-mdpi/filter_selector_corner.png
new file mode 100644
index 0000000..964dd75
--- /dev/null
+++ b/res/drawable-mdpi/filter_selector_corner.png
Binary files differ
diff --git a/res/drawable/filter_selector_background.xml b/res/drawable/filter_selector_background.xml
new file mode 100644
index 0000000..16464f6
--- /dev/null
+++ b/res/drawable/filter_selector_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@color/filter_selector_selected_background" />
+    <item android:drawable="@android:color/transparent"/>
+</selector>
diff --git a/res/layout-xlarge/contacts_list_content.xml b/res/layout-xlarge/contacts_list_content.xml
index e5af112..0af4a81 100644
--- a/res/layout-xlarge/contacts_list_content.xml
+++ b/res/layout-xlarge/contacts_list_content.xml
@@ -15,53 +15,62 @@
 -->
 
 <LinearLayout 
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/pinned_header_list_layout"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/pinned_header_list_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    >
+
+    <view
+        class="com.android.contacts.widget.NotifyingSpinner"
+        android:id="@+id/filter_spinner"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="44dip"
+        android:prompt="@string/list_filter_prompt"
+        android:background="@drawable/filter_selector_background"
+        android:spinnerMode="dropdown"
+        android:visibility="gone"
+    />
+
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:orientation="horizontal"
         >
 
-    <view
-        class="com.android.contacts.list.ContactListAizyView"
-        android:id="@+id/contacts_list_aizy"
-        android:layout_width="40dip"
-        android:layout_height="match_parent"
-    />
+        <view
+            class="com.android.contacts.list.ContactListAizyView"
+            android:id="@+id/contacts_list_aizy"
+            android:layout_width="40dip"
+            android:layout_height="match_parent"
+        />
 
-    <LinearLayout
+        <LinearLayout
             android:layout_width="0px"
             android:layout_height="match_parent"
             android:orientation="vertical"
             android:layout_weight="1"
             >
 
-        <view
-            class="com.android.contacts.widget.NotifyingSpinner"
-            android:id="@+id/filter_spinner"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:prompt="@string/list_filter_prompt"
-            android:spinnerMode="dropdown"
-            android:visibility="gone"
-        />
+            <view
+                class="com.android.contacts.ContactEntryListView"
+                android:id="@android:id/list"
+                android:layout_width="match_parent"
+                android:layout_height="0dip"
+                android:fastScrollEnabled="true"
+                android:layout_weight="1"
+                android:scrollingCache="false"
+            />
 
-        <view
-            class="com.android.contacts.ContactEntryListView"
-            android:id="@android:id/list"
-            android:layout_width="match_parent"
-            android:layout_height="0dip"
-            android:fastScrollEnabled="true"
-            android:layout_weight="1"
-            android:scrollingCache="false"
-        />
+            <include layout="@layout/contacts_list_empty"/>
 
-        <include layout="@layout/contacts_list_empty"/>
-
-        <ViewStub android:id="@+id/footer_stub"
-            android:layout="@layout/footer_panel"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-        />
+            <ViewStub android:id="@+id/footer_stub"
+                android:layout="@layout/footer_panel"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+            />
+        </LinearLayout>
     </LinearLayout>
 </LinearLayout>
diff --git a/res/layout/filter_spinner.xml b/res/layout/filter_spinner.xml
new file mode 100644
index 0000000..eb2b444
--- /dev/null
+++ b/res/layout/filter_spinner.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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"
+    class="com.android.contacts.list.FilterSpinnerItemView"
+    android:layout_height="wrap_content"
+    android:layout_width="fill_parent"
+    android:paddingTop="12dip"
+    android:paddingBottom="12dip"
+    android:gravity="left">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="?android:attr/textColorTertiary"
+        android:gravity="center_vertical"
+        android:text="@string/list_filter_label"/>
+
+    <ImageView
+        android:id="@+id/icon"
+        android:scaleType="fitCenter"
+        android:layout_width="24dip"
+        android:layout_height="24dip"
+        android:layout_marginLeft="8dip"
+    />
+
+    <TextView
+        android:id="@+id/label"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="8dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:gravity="center_vertical"
+        android:ellipsize="end"
+    />
+
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="8dip"
+        android:layout_gravity="bottom"
+        android:src="@drawable/filter_selector_corner"
+    />
+</view>
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c50dd73..3c2fa1d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -35,4 +35,8 @@
 
     <!-- Color used for the letter in the A-Z section header -->
     <color name="section_header_text_color">#ff999999</color>
+
+    <!-- Color used as a selected background for the account/group selection widget -->
+    <color name="filter_selector_selected_background">#66ffffff</color>
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fa712e1..5bfdab7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1309,11 +1309,14 @@
     <!-- Toast shown when creating a personal copy of a contact [CHAR LIMIT=100] -->
     <string name="toast_making_personal_copy">Creating a personal copy</string>
 
+    <!-- Label for the contact filter selector. [CHAR LIMIT=32] -->
+    <string name="list_filter_label">Displaying:</string>
+
     <!-- Prompt for selection of a contact list filter [CHAR LIMIT=64] -->
     <string name="list_filter_prompt">Choose contact list</string>
 
     <!-- Contact list filter label indicating that the list is showing all available accounts [CHAR LIMIT=64] -->
-    <string name="list_filter_all_accounts">All accounts</string>
+    <string name="list_filter_all_accounts">All contacts</string>
 
     <!-- Contact list filter indicating that the list shows groups chosen by the user [CHAR LIMIT=64] -->
     <string name="list_filter_custom">Custom list</string>
@@ -1332,5 +1335,4 @@
 
     <!-- The preference section title for contact display options [CHAR LIMIT=128] -->
     <string name="preference_displayOptions">Display options</string>
-
 </resources>
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 25ae7d8..58ed7c9 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -453,11 +453,16 @@
 
         public View getView(int position, View convertView, ViewGroup parent, boolean dropdown) {
             FilterSpinnerItemView view;
-            if (dropdown && convertView != null) {
-                view = (FilterSpinnerItemView) convertView;
+            if (dropdown) {
+                if (convertView != null) {
+                    view = (FilterSpinnerItemView) convertView;
+                } else {
+                    view = (FilterSpinnerItemView) mLayoutInflater.inflate(
+                            R.layout.filter_spinner_item, parent, false);
+                }
             } else {
                 view = (FilterSpinnerItemView) mLayoutInflater.inflate(
-                        R.layout.filter_spinner_item, parent, false);
+                        R.layout.filter_spinner, parent, false);
             }
             view.setContactListFilter(mFilters.valueAt(position));
             view.bindView(dropdown);
diff --git a/src/com/android/contacts/list/FilterSpinnerItemView.java b/src/com/android/contacts/list/FilterSpinnerItemView.java
index ab98a41..32a9ad0 100644
--- a/src/com/android/contacts/list/FilterSpinnerItemView.java
+++ b/src/com/android/contacts/list/FilterSpinnerItemView.java
@@ -63,7 +63,9 @@
                 mIcon.setVisibility(View.GONE);
                 mLabel.setText(R.string.list_filter_all_accounts);
                 mLabel.setVisibility(View.VISIBLE);
-                mIndentedLabel.setVisibility(View.GONE);
+                if (dropdown) {
+                    mIndentedLabel.setVisibility(View.GONE);
+                }
                 break;
             }
             case ContactListFilter.FILTER_TYPE_CUSTOM: {
@@ -72,7 +74,9 @@
                         ? R.string.list_filter_customize
                         : R.string.list_filter_custom);
                 mLabel.setVisibility(View.VISIBLE);
-                mIndentedLabel.setVisibility(View.GONE);
+                if (dropdown) {
+                    mIndentedLabel.setVisibility(View.GONE);
+                }
                 break;
             }
             case ContactListFilter.FILTER_TYPE_ACCOUNT: {
@@ -84,7 +88,9 @@
                 }
                 mLabel.setText(mFilter.accountName);
                 mLabel.setVisibility(View.VISIBLE);
-                mIndentedLabel.setVisibility(View.GONE);
+                if (dropdown) {
+                    mIndentedLabel.setVisibility(View.GONE);
+                }
                 break;
             }
             case ContactListFilter.FILTER_TYPE_GROUP: {
@@ -96,7 +102,6 @@
                 } else {
                     mLabel.setText(mFilter.title);
                     mLabel.setVisibility(View.VISIBLE);
-                    mIndentedLabel.setVisibility(View.GONE);
                 }
                 break;
             }
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index 030996b..9e5ec95 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -770,12 +770,7 @@
             // Set the content
             final TextView content = views.data;
             if (content != null) {
-                if (entry.mimetype.equals(Phone.CONTENT_ITEM_TYPE)
-                        || entry.mimetype.equals(Constants.MIME_SMS_ADDRESS)) {
-                    content.setText(PhoneNumberUtils.formatNumber(entry.data));
-                } else {
-                    content.setText(entry.data);
-                }
+                content.setText(entry.data);
                 setMaxLines(content, entry.maxLines);
             }