Merge "Add statelist for disabled voicemail controls."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 01a6f95..a1829d1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -557,12 +557,6 @@
android:theme="@android:style/Theme.Translucent">
</activity>
- <!-- Makes .PeopleActivity the search target for any activity in Contacts -->
- <meta-data
- android:name="android.app.default_searchable"
- android:value=".activities.PeopleActivity" />
-
-
<!-- LIVE FOLDERS -->
<activity
android:name=".ContactsLiveFolders$AllContacts"
diff --git a/res/drawable-hdpi/ab_stacked_solid_inverse_holo.9.png b/res/drawable-hdpi/ab_stacked_solid_inverse_holo.9.png
new file mode 100644
index 0000000..42528b1
--- /dev/null
+++ b/res/drawable-hdpi/ab_stacked_solid_inverse_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ab_show_all_holo_dark.png b/res/drawable-hdpi/ic_ab_show_all_holo_dark.png
new file mode 100644
index 0000000..1893425
--- /dev/null
+++ b/res/drawable-hdpi/ic_ab_show_all_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ab_show_group_holo_dark.png b/res/drawable-hdpi/ic_ab_show_group_holo_dark.png
new file mode 100644
index 0000000..5a28614
--- /dev/null
+++ b/res/drawable-hdpi/ic_ab_show_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_add_contact_holo_dark.png b/res/drawable-hdpi/ic_add_contact_holo_dark.png
index 1190bf6..3583003 100644
--- a/res/drawable-hdpi/ic_add_contact_holo_dark.png
+++ b/res/drawable-hdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_contacts_holo_dark.png b/res/drawable-hdpi/ic_contacts_holo_dark.png
index 06dc777..a07b004 100644
--- a/res/drawable-hdpi/ic_contacts_holo_dark.png
+++ b/res/drawable-hdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_dial_action_search.png b/res/drawable-hdpi/ic_dial_action_search.png
deleted file mode 100644
index 898ce11..0000000
--- a/res/drawable-hdpi/ic_dial_action_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_contact_holo_dark.png b/res/drawable-hdpi/ic_menu_add_contact_holo_dark.png
index 472d5b4..d8d5c63 100644
--- a/res/drawable-hdpi/ic_menu_add_contact_holo_dark.png
+++ b/res/drawable-hdpi/ic_menu_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_contact_holo_light.png b/res/drawable-hdpi/ic_menu_add_contact_holo_light.png
index 6335d40..616dd2a 100644
--- a/res/drawable-hdpi/ic_menu_add_contact_holo_light.png
+++ b/res/drawable-hdpi/ic_menu_add_contact_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_group_holo_dark.png b/res/drawable-hdpi/ic_menu_add_group_holo_dark.png
index 7f92adc..7edb297 100644
--- a/res/drawable-hdpi/ic_menu_add_group_holo_dark.png
+++ b/res/drawable-hdpi/ic_menu_add_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_contacts_holo_light.png b/res/drawable-hdpi/ic_menu_contacts_holo_light.png
index 8a7358c..6327545 100644
--- a/res/drawable-hdpi/ic_menu_contacts_holo_light.png
+++ b/res/drawable-hdpi/ic_menu_contacts_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_see_contacts_holo_dark.png b/res/drawable-hdpi/ic_see_contacts_holo_dark.png
new file mode 100644
index 0000000..8e2182f
--- /dev/null
+++ b/res/drawable-hdpi/ic_see_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ab_stacked_solid_inverse_holo.9.png b/res/drawable-mdpi/ab_stacked_solid_inverse_holo.9.png
new file mode 100644
index 0000000..a823841
--- /dev/null
+++ b/res/drawable-mdpi/ab_stacked_solid_inverse_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ab_show_all_holo_dark.png b/res/drawable-mdpi/ic_ab_show_all_holo_dark.png
new file mode 100644
index 0000000..eaef05b
--- /dev/null
+++ b/res/drawable-mdpi/ic_ab_show_all_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ab_show_group_holo_dark.png b/res/drawable-mdpi/ic_ab_show_group_holo_dark.png
new file mode 100644
index 0000000..a461b70
--- /dev/null
+++ b/res/drawable-mdpi/ic_ab_show_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_add_contact_holo_dark.png b/res/drawable-mdpi/ic_add_contact_holo_dark.png
index 9aadd04..8118e24 100644
--- a/res/drawable-mdpi/ic_add_contact_holo_dark.png
+++ b/res/drawable-mdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_contacts_holo_dark.png b/res/drawable-mdpi/ic_contacts_holo_dark.png
index a089a67..c944456 100644
--- a/res/drawable-mdpi/ic_contacts_holo_dark.png
+++ b/res/drawable-mdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_dial_action_search.png b/res/drawable-mdpi/ic_dial_action_search.png
deleted file mode 100644
index 88cba92..0000000
--- a/res/drawable-mdpi/ic_dial_action_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_contact_holo_dark.png b/res/drawable-mdpi/ic_menu_add_contact_holo_dark.png
index 6a7af38..ae22598 100644
--- a/res/drawable-mdpi/ic_menu_add_contact_holo_dark.png
+++ b/res/drawable-mdpi/ic_menu_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_contact_holo_light.png b/res/drawable-mdpi/ic_menu_add_contact_holo_light.png
index 0a82abd..0cfb71b 100644
--- a/res/drawable-mdpi/ic_menu_add_contact_holo_light.png
+++ b/res/drawable-mdpi/ic_menu_add_contact_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_group_holo_dark.png b/res/drawable-mdpi/ic_menu_add_group_holo_dark.png
index 16ba126..29369e8 100644
--- a/res/drawable-mdpi/ic_menu_add_group_holo_dark.png
+++ b/res/drawable-mdpi/ic_menu_add_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_contacts_holo_light.png b/res/drawable-mdpi/ic_menu_contacts_holo_light.png
index 5ef1184..4a15754 100644
--- a/res/drawable-mdpi/ic_menu_contacts_holo_light.png
+++ b/res/drawable-mdpi/ic_menu_contacts_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_see_contacts_holo_dark.png b/res/drawable-mdpi/ic_see_contacts_holo_dark.png
new file mode 100644
index 0000000..ef1d2df
--- /dev/null
+++ b/res/drawable-mdpi/ic_see_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ab_stacked_solid_inverse_holo.9.png b/res/drawable-xhdpi/ab_stacked_solid_inverse_holo.9.png
new file mode 100644
index 0000000..16b9bef
--- /dev/null
+++ b/res/drawable-xhdpi/ab_stacked_solid_inverse_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ab_show_all_holo_dark.png b/res/drawable-xhdpi/ic_ab_show_all_holo_dark.png
new file mode 100644
index 0000000..bc739b1
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ab_show_all_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ab_show_group_holo_dark.png b/res/drawable-xhdpi/ic_ab_show_group_holo_dark.png
new file mode 100644
index 0000000..fb3338e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ab_show_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_add_contact_holo_dark.png b/res/drawable-xhdpi/ic_add_contact_holo_dark.png
index 2eac542..16454ea 100644
--- a/res/drawable-xhdpi/ic_add_contact_holo_dark.png
+++ b/res/drawable-xhdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_contacts_holo_dark.png b/res/drawable-xhdpi/ic_contacts_holo_dark.png
index 0384abc..fe270bf 100644
--- a/res/drawable-xhdpi/ic_contacts_holo_dark.png
+++ b/res/drawable-xhdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_dial_action_search.png b/res/drawable-xhdpi/ic_dial_action_search.png
deleted file mode 100644
index fe3aa24..0000000
--- a/res/drawable-xhdpi/ic_dial_action_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_contact_holo_dark.png b/res/drawable-xhdpi/ic_menu_add_contact_holo_dark.png
index e94b91b..6b0bff7 100644
--- a/res/drawable-xhdpi/ic_menu_add_contact_holo_dark.png
+++ b/res/drawable-xhdpi/ic_menu_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_contact_holo_light.png b/res/drawable-xhdpi/ic_menu_add_contact_holo_light.png
index a28d8f4..f018afd 100644
--- a/res/drawable-xhdpi/ic_menu_add_contact_holo_light.png
+++ b/res/drawable-xhdpi/ic_menu_add_contact_holo_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_group_holo_dark.png b/res/drawable-xhdpi/ic_menu_add_group_holo_dark.png
index d4bd681..75ba003 100644
--- a/res/drawable-xhdpi/ic_menu_add_group_holo_dark.png
+++ b/res/drawable-xhdpi/ic_menu_add_group_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_contacts_holo_light.png b/res/drawable-xhdpi/ic_menu_contacts_holo_light.png
index ac9cf65..c054505 100644
--- a/res/drawable-xhdpi/ic_menu_contacts_holo_light.png
+++ b/res/drawable-xhdpi/ic_menu_contacts_holo_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_see_contacts_holo_dark.png b/res/drawable-xhdpi/ic_see_contacts_holo_dark.png
new file mode 100644
index 0000000..279fff9
--- /dev/null
+++ b/res/drawable-xhdpi/ic_see_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable/group_source_button_background.xml b/res/drawable/group_source_button_background.xml
new file mode 100644
index 0000000..7ebf604
--- /dev/null
+++ b/res/drawable/group_source_button_background.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+ <item android:state_pressed="true" android:drawable="@drawable/action_bar_item_pressed_holo_light"/>
+ <item android:drawable="@drawable/ab_stacked_solid_inverse_holo" />
+</selector>
diff --git a/res/drawable/ic_tab_all.xml b/res/drawable/ic_tab_all.xml
new file mode 100644
index 0000000..25a3948
--- /dev/null
+++ b/res/drawable/ic_tab_all.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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/ic_ab_show_all_holo_dark" />
+</selector>
+
diff --git a/res/drawable/ic_tab_groups.xml b/res/drawable/ic_tab_groups.xml
new file mode 100644
index 0000000..c562fa3
--- /dev/null
+++ b/res/drawable/ic_tab_groups.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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/ic_ab_show_group_holo_dark" />
+</selector>
+
diff --git a/res/layout-land/group_editor_view.xml b/res/layout-land/group_editor_view.xml
new file mode 100644
index 0000000..293e529
--- /dev/null
+++ b/res/layout-land/group_editor_view.xml
@@ -0,0 +1,59 @@
+<?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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="8dip"
+ android:paddingRight="8dip"
+ android:orientation="horizontal"
+ >
+
+ <EditText
+ android:id="@+id/group_name"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:inputType="textCapWords"
+ android:imeOptions="flagNoExtractUi|flagNoFullscreen"
+ android:hint="@string/group_name_hint"
+ android:minHeight="48dip"
+ android:paddingRight="8dip"
+ />
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:layout_height="match_parent"
+ android:paddingLeft="8dip"
+ android:orientation="vertical"
+ >
+ <include
+ layout="@layout/group_editor_autocomplete_view"
+ android:id="@+id/add_member_field"/>
+ <include
+ layout="@layout/group_editor_existing_member_list"
+ android:id="@android:id/list"/>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
diff --git a/res/layout-sw580dp/group_editor_view.xml b/res/layout-sw580dp/group_editor_view.xml
index a31a36a..a16c240 100644
--- a/res/layout-sw580dp/group_editor_view.xml
+++ b/res/layout-sw580dp/group_editor_view.xml
@@ -41,7 +41,6 @@
android:layout_height="wrap_content"
android:minHeight="48dip"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold"
android:inputType="textCapWords"
android:hint="@string/group_name_hint"
android:paddingLeft="16dip"/>
diff --git a/res/layout-w470dp/contact_detail_fragment.xml b/res/layout-w470dp/contact_detail_fragment.xml
index b523ff8..415bb56 100644
--- a/res/layout-w470dp/contact_detail_fragment.xml
+++ b/res/layout-w470dp/contact_detail_fragment.xml
@@ -39,12 +39,10 @@
<ImageView android:id="@+id/photo"
android:scaleType="centerCrop"
- android:layout_width="100dip"
- android:layout_height="100dip"
+ android:layout_width="128dip"
+ android:layout_height="128dip"
android:layout_marginLeft="@dimen/detail_contact_photo_margin"
- android:layout_marginRight="@dimen/detail_contact_photo_margin"
- android:layout_marginTop="@dimen/detail_contact_photo_margin"
- android:layout_marginBottom="@dimen/detail_contact_photo_margin"/>
+ android:layout_marginTop="@dimen/detail_contact_photo_margin"/>
<ListView android:id="@android:id/list"
android:layout_width="0dip"
diff --git a/res/layout-w470dp/group_source_button.xml b/res/layout-w470dp/group_source_button.xml
index fb57e83..1acd510 100644
--- a/res/layout-w470dp/group_source_button.xml
+++ b/res/layout-w470dp/group_source_button.xml
@@ -24,9 +24,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:divider="?android:attr/dividerVertical"
- android:showDividers="end"
- android:dividerPadding="12dip"
android:orientation="horizontal"
style="?android:attr/actionButtonStyle">
@@ -34,7 +31,6 @@
android:id="@+id/group_source"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:paddingRight="5dip"
android:orientation="horizontal">
<TextView
diff --git a/res/layout/contact_tile_frequent.xml b/res/layout/contact_tile_frequent.xml
index 52b7126..43bbe9d 100644
--- a/res/layout/contact_tile_frequent.xml
+++ b/res/layout/contact_tile_frequent.xml
@@ -26,13 +26,19 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <QuickContactBadge
- android:id="@+id/contact_tile_quick"
+ <view
+ android:id="@+id/image_container"
+ class="com.android.contacts.list.ContactTileImageContainer"
android:layout_width="64dip"
android:layout_height="64dip"
- android:scaleType="centerCrop"
- android:focusable="true"
- android:layout_alignParentRight="true" />
+ android:layout_alignParentRight="true">
+ <QuickContactBadge
+ android:id="@+id/contact_tile_quick"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"
+ android:focusable="true" />
+ </view>
<LinearLayout
android:layout_width="match_parent"
@@ -73,7 +79,7 @@
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:attr/listDivider"
- android:layout_below="@id/contact_tile_quick" />
+ android:layout_below="@id/image_container" />
</RelativeLayout>
diff --git a/res/layout/contact_tile_frequent_phone.xml b/res/layout/contact_tile_frequent_phone.xml
index 7d24cef..6b920e8 100644
--- a/res/layout/contact_tile_frequent_phone.xml
+++ b/res/layout/contact_tile_frequent_phone.xml
@@ -27,14 +27,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <QuickContactBadge
- android:id="@id/contact_tile_quick"
- android:nextFocusRight="@id/contact_tile_frequent_phone"
+ <view
+ android:id="@+id/image_container"
+ class="com.android.contacts.list.ContactTileImageContainer"
android:layout_width="64dip"
android:layout_height="64dip"
- android:scaleType="centerCrop"
- android:focusable="true"
- android:layout_alignParentLeft="true" />
+ android:layout_alignParentLeft="true">
+ <QuickContactBadge
+ android:id="@id/contact_tile_quick"
+ android:nextFocusRight="@id/contact_tile_frequent_phone"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"
+ android:focusable="true" />
+ </view>
<TextView
android:id="@+id/contact_tile_name"
@@ -43,7 +49,7 @@
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="8dip"
- android:layout_toRightOf="@id/contact_tile_quick"
+ android:layout_toRightOf="@id/image_container"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
@@ -58,7 +64,7 @@
android:layout_marginLeft="8dip"
android:singleLine="true"
android:maxLength="18"
- android:layout_toRightOf="@id/contact_tile_quick"
+ android:layout_toRightOf="@id/image_container"
android:layout_below="@id/contact_tile_name" />
<TextView
@@ -80,7 +86,7 @@
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:attr/listDivider"
- android:layout_below="@id/contact_tile_quick" />
+ android:layout_below="@id/image_container" />
</RelativeLayout>
diff --git a/res/layout/contact_tile_starred.xml b/res/layout/contact_tile_starred.xml
index 3f8d91d..4116157 100644
--- a/res/layout/contact_tile_starred.xml
+++ b/res/layout/contact_tile_starred.xml
@@ -25,11 +25,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <ImageView
- android:id="@+id/contact_tile_image"
+ <view
+ class="com.android.contacts.list.ContactTileImageContainer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerCrop" />
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/contact_tile_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop" />
+ </view>
<LinearLayout
android:layout_width="match_parent"
@@ -63,6 +68,7 @@
android:paddingBottom="4dip"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
+ android:layout_marginTop="-3dip"
android:ellipsize="marquee" />
</LinearLayout>
diff --git a/res/layout/contact_tile_starred_quick_contact.xml b/res/layout/contact_tile_starred_quick_contact.xml
index 3f072d1..223f1b8 100644
--- a/res/layout/contact_tile_starred_quick_contact.xml
+++ b/res/layout/contact_tile_starred_quick_contact.xml
@@ -24,11 +24,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <ImageView
- android:id="@+id/contact_tile_image"
+ <view
+ class="com.android.contacts.list.ContactTileImageContainer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerCrop" />
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/contact_tile_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop" />
+ </view>
<LinearLayout
android:layout_width="match_parent"
@@ -61,6 +66,7 @@
android:drawablePadding="4dip"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
+ android:layout_marginTop="-3dip"
android:ellipsize="marquee" />
</LinearLayout>
diff --git a/res/layout/contact_tile_starred_secondary_target.xml b/res/layout/contact_tile_starred_secondary_target.xml
index 6543dc1..2ce59c5 100644
--- a/res/layout/contact_tile_starred_secondary_target.xml
+++ b/res/layout/contact_tile_starred_secondary_target.xml
@@ -24,11 +24,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <ImageView
- android:id="@+id/contact_tile_image"
+ <view
+ class="com.android.contacts.list.ContactTileImageContainer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerCrop" />
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/contact_tile_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop" />
+ </view>
<TextView
android:id="@+id/contact_tile_name"
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contacts_list_content.xml
index 8e1289f..dfa99f6 100644
--- a/res/layout/contacts_list_content.xml
+++ b/res/layout/contacts_list_content.xml
@@ -38,6 +38,7 @@
android:paddingTop="@dimen/contact_browser_list_top_margin"
android:layout_marginLeft="@dimen/contact_browser_list_header_left_margin"
android:layout_marginRight="@dimen/contact_browser_list_header_right_margin"
+ android:background="?android:attr/selectableItemBackground"
android:visibility="gone">
<TextView
android:id="@+id/account_filter_header"
diff --git a/res/layout/dialpad_additional_buttons.xml b/res/layout/dialpad_additional_buttons.xml
index a5e247b..f0e4a42 100644
--- a/res/layout/dialpad_additional_buttons.xml
+++ b/res/layout/dialpad_additional_buttons.xml
@@ -25,7 +25,8 @@
android:background="@drawable/dialpad_background"
android:orientation="horizontal">
- <!-- Onscreen "Search button -->
+ <!-- Onscreen "All contacts" button.
+ TODO: rename this id. -->
<ImageButton android:id="@+id/searchButton"
android:layout_width="0px"
android:layout_weight="0.30"
@@ -34,7 +35,7 @@
android:state_enabled="false"
android:background="@drawable/btn_dial"
android:contentDescription="@string/description_search_button"
- android:src="@drawable/ic_dial_action_search"/>
+ android:src="@drawable/ic_see_contacts_holo_dark"/>
<!-- Onscreen "Dial" button, diused on all platforms by
default. Its usage can be disabled using resources (see
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index 75d5938..b2784e2 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -52,6 +52,7 @@
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:src="@drawable/ic_menu_overflow"
+ android:contentDescription="@*android:string/action_menu_overflow_description"
android:background="@android:color/transparent"/>
</RelativeLayout>
diff --git a/res/layout/group_detail_fragment.xml b/res/layout/group_detail_fragment.xml
index 34eb285..d95a6db 100644
--- a/res/layout/group_detail_fragment.xml
+++ b/res/layout/group_detail_fragment.xml
@@ -20,18 +20,37 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <!--
+ This layout can contain the second row of the action bar containing a group source
+ button if applicable (this is a fake stacked action bar)
+ -->
<FrameLayout
android:id="@+id/group_source_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical" />
+ android:layout_gravity="center_vertical"/>
- <ListView
- android:id="@android:id/list"
+ <FrameLayout
android:layout_width="match_parent"
android:layout_height="0dip"
- android:layout_weight="1"
- android:fadingEdge="none"
- android:scrollbarStyle="outsideOverlay"/>
+ android:layout_weight="1">
+
+ <ListView
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fadingEdge="none"
+ android:scrollbarStyle="outsideOverlay"/>
+
+ <!--
+ Shadow overlay over the list of group members (since we have a fake stacked
+ action bar)
+ -->
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="20dip"
+ android:background="?android:attr/windowContentOverlay"/>
+
+ </FrameLayout>
</LinearLayout>
diff --git a/res/layout/group_editor_autocomplete_view.xml b/res/layout/group_editor_autocomplete_view.xml
index 46539de..8482ab5 100644
--- a/res/layout/group_editor_autocomplete_view.xml
+++ b/res/layout/group_editor_autocomplete_view.xml
@@ -22,6 +22,7 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
+ android:imeOptions="flagNoExtractUi|flagNoFullscreen"
android:hint="@string/enter_contact_name"
android:minHeight="48dip"
android:paddingLeft="@dimen/group_editor_autocomplete_left_padding"/>
\ No newline at end of file
diff --git a/res/layout/group_editor_view.xml b/res/layout/group_editor_view.xml
index e94b387..19cb82d 100644
--- a/res/layout/group_editor_view.xml
+++ b/res/layout/group_editor_view.xml
@@ -35,8 +35,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold"
android:inputType="textCapWords"
+ android:imeOptions="flagNoExtractUi|flagNoFullscreen"
android:hint="@string/group_name_hint"
android:minHeight="48dip"
android:paddingLeft="8dip"/>
diff --git a/res/layout/group_source_button.xml b/res/layout/group_source_button.xml
index 0aa9c58..49aa2db 100644
--- a/res/layout/group_source_button.xml
+++ b/res/layout/group_source_button.xml
@@ -24,8 +24,10 @@
android:id="@+id/group_source"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/selectableItemBackground"
- android:padding="10dip" >
+ android:minHeight="48dip"
+ android:background="@drawable/group_source_button_background"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip" >
<TextView
android:layout_width="0dip"
@@ -34,15 +36,21 @@
android:layout_gravity="center_vertical"
android:duplicateParentState="true"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/view_updates_from_group"/>
+ android:textColor="@color/action_bar_button_text_color"
+ android:text="@string/view_updates_from_group"
+ style="@android:style/Widget.Holo.ActionBar.TabText"/>
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:duplicateParentState="true"
- android:layout_marginLeft="7dip"
- android:layout_marginRight="7dip"
- android:layout_centerVertical="true"/>
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="32dip"
+ android:layout_height="32dip"
+ android:duplicateParentState="true"
+ android:layout_gravity="center_vertical"/>
+
+ </FrameLayout>
</LinearLayout>
diff --git a/res/layout/quickcontact_photo_container.xml b/res/layout/quickcontact_photo_container.xml
index 7df54d9..ffaf12f 100644
--- a/res/layout/quickcontact_photo_container.xml
+++ b/res/layout/quickcontact_photo_container.xml
@@ -84,6 +84,7 @@
android:id="@+id/open_details_push_layer"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:contentDescription="@string/viewContactDesription"
android:background="?android:attr/selectableItemBackground" />
</RelativeLayout>
</merge>
diff --git a/res/layout/select_dialog_item.xml b/res/layout/select_dialog_item.xml
new file mode 100644
index 0000000..ea671dd
--- /dev/null
+++ b/res/layout/select_dialog_item.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<!--
+ List item in the pop-up window that appears when tapping a contact's photo
+ in the contact editor. This is similar to the framework's select_dialog_item.xml layout
+ except the text appearance is medium.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="48dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorAlertDialogListItem"
+ android:gravity="center_vertical"
+ android:paddingLeft="14dip"
+ android:paddingRight="15dip"
+ android:ellipsize="marquee"
+/>
diff --git a/res/layout/stream_item_row_image_and_text.xml b/res/layout/stream_item_row_one_image.xml
similarity index 89%
rename from res/layout/stream_item_row_image_and_text.xml
rename to res/layout/stream_item_row_one_image.xml
index 0ee6357..03dcedf 100644
--- a/res/layout/stream_item_row_image_and_text.xml
+++ b/res/layout/stream_item_row_one_image.xml
@@ -25,7 +25,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/detail_update_section_between_items_padding"
android:orientation="horizontal"
android:weightSum="2">
@@ -48,8 +47,4 @@
</LinearLayout>
- <include
- android:id="@+id/stream_item_second_text"
- layout="@layout/stream_item_row_text_only"/>
-
</LinearLayout>
diff --git a/res/layout/stream_item_row_text_only.xml b/res/layout/stream_item_row_text.xml
similarity index 95%
rename from res/layout/stream_item_row_text_only.xml
rename to res/layout/stream_item_row_text.xml
index 9d82edd..919ee52 100644
--- a/res/layout/stream_item_row_text_only.xml
+++ b/res/layout/stream_item_row_text.xml
@@ -17,7 +17,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/detail_update_section_between_items_padding"
android:orientation="vertical">
<TextView android:id="@+id/stream_item_html"
diff --git a/res/values-sw580dp-w1000dp/dimens.xml b/res/values-sw580dp-w1000dp/dimens.xml
index 7329930..f1b607c 100644
--- a/res/values-sw580dp-w1000dp/dimens.xml
+++ b/res/values-sw580dp-w1000dp/dimens.xml
@@ -15,5 +15,6 @@
-->
<resources>
<dimen name="group_detail_border_padding">32dip</dimen>
+ <dimen name="detail_contact_photo_margin">16dip</dimen>
<dimen name="contact_detail_list_top_padding">32dip</dimen>
</resources>
diff --git a/res/values-sw580dp-w720dp/styles.xml b/res/values-sw580dp-w720dp/styles.xml
index eadb88c..5ad25c6 100644
--- a/res/values-sw580dp-w720dp/styles.xml
+++ b/res/values-sw580dp-w720dp/styles.xml
@@ -36,7 +36,7 @@
<item name="list_item_presence_icon_margin">4dip</item>
<item name="list_item_photo_size">64dip</item>
<item name="list_item_profile_photo_size">80dip</item>
- <item name="list_item_prefix_highlight_color">#729a27</item>
+ <item name="list_item_prefix_highlight_color">#99cc00</item>
<item name="list_item_header_text_indent">8dip</item>
<item name="list_item_header_text_color">@color/people_app_theme_color</item>
<item name="list_item_header_height">24dip</item>
diff --git a/res/values-sw580dp/styles.xml b/res/values-sw580dp/styles.xml
index c60afca..ee65159 100644
--- a/res/values-sw580dp/styles.xml
+++ b/res/values-sw580dp/styles.xml
@@ -36,7 +36,7 @@
<item name="list_item_presence_icon_margin">4dip</item>
<item name="list_item_photo_size">64dip</item>
<item name="list_item_profile_photo_size">80dip</item>
- <item name="list_item_prefix_highlight_color">#729a27</item>
+ <item name="list_item_prefix_highlight_color">#99cc00</item>
<item name="list_item_header_text_indent">8dip</item>
<item name="list_item_header_text_size">14sp</item>
<item name="list_item_header_text_color">@color/people_app_theme_color</item>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index f224832..561eefc 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -71,4 +71,7 @@
<!-- Color of the semi-transparent shadow box on contact tiles -->
<color name="contact_tile_shadow_box_color">#7F000000</color>
+ <!-- Color of the vertical stripe that goes on the left of a block quote inside a stream item -->
+ <color name="stream_item_stripe_color">#CCCCCC</color>
+
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 87ff84b..defd229 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -61,17 +61,20 @@
<!-- Vertical padding above and below individual stream items -->
<dimen name="detail_update_section_item_vertical_padding">16dip</dimen>
+ <!-- Vertical padding between text and images in a single stream item -->
+ <dimen name="detail_update_section_between_items_vertical_padding">8dip</dimen>
+
<!-- Horizontal padding for individual stream items -->
<dimen name="detail_update_section_item_horizontal_padding">8dip</dimen>
- <!-- Padding between columns images and/or text in a single stream item -->
+ <!-- Padding between images in a single stream item -->
<dimen name="detail_update_section_between_items_padding">1dip</dimen>
<!-- Horizontal padding between attribution and comments -->
<dimen name="detail_update_section_attribution_comments_padding">4dip</dimen>
<!-- Margin around the contact's photo on the contact card -->
- <dimen name="detail_contact_photo_margin">16dip</dimen>
+ <dimen name="detail_contact_photo_margin">8dip</dimen>
<!-- Width and height of the contact photo on the contact detail page -->
<dimen name="detail_contact_photo_size">256dip</dimen>
@@ -191,4 +194,7 @@
<!-- Vertical and horizontal padding in between contact tiles -->
<dimen name="contact_tile_divider_padding">1dip</dimen>
+ <!-- Width of the lead margin on the left of a block quote inside a stream item -->
+ <dimen name="stream_item_stripe_width">8dip</dimen>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ec341f4..06a461d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -340,19 +340,44 @@
<item quantity="other"><xliff:g id="count">%d</xliff:g> found</item>
</plurals>
- <!-- The description text for the "all contacts" tab. Space is limited for this string, so the shorter the better -->
+ <!-- The content description for the "all contacts" tab.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
<string name="contactsAllLabel">All</string>
- <!-- The description text for the groups tab. Space is limited for this string, so the shorter the better -->
+ <!-- The content description text for the groups tab.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
<string name="contactsGroupsLabel">Groups</string>
- <!-- The description text for the favorites tab. Space is limited for this string, so the shorter the better -->
+ <!-- The description text for the favorites tab.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
<string name="contactsFavoritesLabel">Favorites</string>
- <!-- The description text for the dialer tab. Space is limited for this string, so the shorter the better -->
+ <!-- The description text for the dialer tab.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
<string name="dialerIconLabel">Phone</string>
- <!-- The description text for the call log tab. Space is limited for this string, so the shorter the better -->
+ <!-- The description text for the call log tab.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
<string name="recentCallsIconLabel">Call log</string>
<string name="liveFolderAll">All contacts</string>
<string name="liveFolderFavorites">Starred contacts</string>
@@ -699,6 +724,14 @@
-->
<string name="description_plus_button">plus</string>
+ <!-- String describing a contact picture that introduces users to the contact detail screen.
+
+ Used by AccessibilityService to announce the purpose of the button.
+
+ [CHAR LIMIT=NONE]
+ -->
+ <string name="description_view_contact_detail" msgid="2795575601596468581">View contact</string>
+
<!-- Dialog title shown when (USB) storage does not exist [CHAR LIMIT=25] -->
<string name="no_sdcard_title" product="nosdcard">Storage unavailable</string>
<!-- Dialog title shown when SD Card does not exist -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 3c6694d..4317050 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -140,7 +140,7 @@
<item name="list_item_presence_icon_size">16dip</item>
<item name="list_item_photo_size">@dimen/contact_browser_list_item_photo_size</item>
<item name="list_item_profile_photo_size">70dip</item>
- <item name="list_item_prefix_highlight_color">#729a27</item>
+ <item name="list_item_prefix_highlight_color">#99cc00</item>
<item name="list_item_header_text_color">@color/people_app_theme_color</item>
<item name="list_item_header_text_size">14dip</item>
<item name="list_item_header_height">26dip</item>
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index e008516..7d9b758 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -688,16 +688,6 @@
}
}
- @Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- if (globalSearch) {
- super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- ContactsSearchManager.startSearch(this, initialQuery);
- }
- }
-
protected void updateVoicemailStatusMessage(Cursor statusCursor) {
if (statusCursor == null) {
mStatusMessageView.setVisibility(View.GONE);
diff --git a/src/com/android/contacts/ContactSaveService.java b/src/com/android/contacts/ContactSaveService.java
index 78c4b18..2df2e47 100644
--- a/src/com/android/contacts/ContactSaveService.java
+++ b/src/com/android/contacts/ContactSaveService.java
@@ -18,6 +18,7 @@
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.AccountWithDataSet;
+import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDeltaList;
import com.android.contacts.model.EntityModifier;
import com.google.android.collect.Lists;
@@ -48,6 +49,7 @@
import android.provider.ContactsContract.Groups;
import android.provider.ContactsContract.Profile;
import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.RawContactsEntity;
import android.util.Log;
import android.widget.Toast;
@@ -355,9 +357,19 @@
throw new IllegalStateException("Version consistency failed for a new contact");
}
- final EntityDeltaList newState = EntityDeltaList.fromQuery(resolver,
- sb.toString(), null, null);
+ final EntityDeltaList newState = EntityDeltaList.fromQuery(
+ isProfile
+ ? RawContactsEntity.PROFILE_CONTENT_URI
+ : RawContactsEntity.CONTENT_URI,
+ resolver, sb.toString(), null, null);
state = EntityDeltaList.mergeAfter(newState, state);
+
+ // Update the new state to use profile URIs if appropriate.
+ if (isProfile) {
+ for (EntityDelta delta : state) {
+ delta.setProfileQueryUri();
+ }
+ }
}
}
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 2f13481..f1f73ed 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -18,10 +18,8 @@
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.AccountWithDataSet;
-import com.android.i18n.phonenumbers.NumberParseException;
+import com.android.contacts.test.NeededForTesting;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
-import com.android.i18n.phonenumbers.PhoneNumberUtil.MatchType;
-import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
import android.content.Context;
import android.content.Intent;
@@ -94,6 +92,7 @@
/**
* Returns true if two objects are considered equal. Two null references are equal here.
*/
+ @NeededForTesting
public static boolean areObjectsEqual(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
@@ -105,47 +104,49 @@
*/
public static final boolean shouldCollapse(Context context, CharSequence mimetype1,
CharSequence data1, CharSequence mimetype2, CharSequence data2) {
- if (TextUtils.equals(Phone.CONTENT_ITEM_TYPE, mimetype1)
- && TextUtils.equals(Phone.CONTENT_ITEM_TYPE, mimetype2)) {
- if (data1 == data2) {
- return true;
- }
- if (data1 == null || data2 == null) {
- return false;
- }
+ // different mimetypes? don't collapse
+ if (!TextUtils.equals(mimetype1, mimetype2)) return false;
- // If the number contains semicolons, PhoneNumberUtils.compare
- // only checks the substring before that (which is fine for caller-id usually)
- // but not for collapsing numbers. so we check each segment indidually to be more strict
- // TODO: This should be replaced once we have a more robust phonenumber-library
- String[] dataParts1 = data1.toString().split(WAIT_SYMBOL_AS_STRING);
- String[] dataParts2 = data2.toString().split(WAIT_SYMBOL_AS_STRING);
- if (dataParts1.length != dataParts2.length) {
- return false;
- }
- PhoneNumberUtil util = PhoneNumberUtil.getInstance();
- for (int i = 0; i < dataParts1.length; i++) {
- try {
- PhoneNumber phoneNumber1 = util.parse(dataParts1[i], "ZZ" /* Unknown */);
- PhoneNumber phoneNumber2 = util.parse(dataParts2[i], "ZZ" /* Unknown */);
- MatchType matchType = util.isNumberMatch(phoneNumber1, phoneNumber2);
- if (matchType != MatchType.SHORT_NSN_MATCH) {
- return false;
- }
- } catch (NumberParseException e) {
- if (!TextUtils.equals(dataParts1[i], dataParts2[i])) {
- return false;
- }
- }
- }
+ // exact same string? good, bail out early
+ if (TextUtils.equals(data1, data2)) return true;
- return true;
- } else {
- if (mimetype1 == mimetype2 && data1 == data2) {
- return true;
+ // so if either is null, these two must be different
+ if (data1 == null || data2 == null) return false;
+
+ // if this is not about phone numbers, we know this is not a match (of course, some
+ // mimetypes could have more sophisticated matching is the future, e.g. addresses)
+ if (!TextUtils.equals(Phone.CONTENT_ITEM_TYPE, mimetype1)) return false;
+
+ // Now do the full phone number thing. split into parts, seperated by waiting symbol
+ // and compare them individually
+ final String[] dataParts1 = data1.toString().split(WAIT_SYMBOL_AS_STRING);
+ final String[] dataParts2 = data2.toString().split(WAIT_SYMBOL_AS_STRING);
+ if (dataParts1.length != dataParts2.length) return false;
+ final PhoneNumberUtil util = PhoneNumberUtil.getInstance();
+ for (int i = 0; i < dataParts1.length; i++) {
+ final String dataPart1 = dataParts1[i];
+ final String dataPart2 = dataParts2[i];
+
+ // substrings equal? shortcut, don't parse
+ if (TextUtils.equals(dataPart1, dataPart2)) continue;
+
+ // do a full parse of the numbers
+ switch (util.isNumberMatch(dataPart1, dataPart2)) {
+ case NOT_A_NUMBER:
+ // don't understand the numbers? let's play it safe
+ return false;
+ case NO_MATCH:
+ return false;
+ case EXACT_MATCH:
+ case SHORT_NSN_MATCH:
+ case NSN_MATCH:
+ break;
+ default:
+ throw new IllegalStateException("Unknown result value from phone number " +
+ "library");
}
- return TextUtils.equals(mimetype1, mimetype2) && TextUtils.equals(data1, data2);
}
+ return true;
}
/**
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index edf5519..6d55184 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -129,9 +129,9 @@
mActionBar.setCustomView(customSearchView, layoutParams);
// Set up tabs
- addTab(TabState.GROUPS, mContext.getString(R.string.contactsGroupsLabel));
- addTab(TabState.ALL, mContext.getString(R.string.contactsAllLabel));
- addTab(TabState.FAVORITES, mContext.getString(R.string.contactsFavoritesLabel));
+ addTab(TabState.GROUPS, R.drawable.ic_tab_groups, R.string.contactsGroupsLabel);
+ addTab(TabState.ALL, R.drawable.ic_tab_all, R.string.contactsAllLabel);
+ addTab(TabState.FAVORITES, R.drawable.ic_tab_starred, R.string.contactsFavoritesLabel);
}
public void initialize(Bundle savedState, ContactsRequest request) {
@@ -153,10 +153,11 @@
mListener = listener;
}
- private void addTab(TabState tabState, String text) {
+ private void addTab(TabState tabState, int icon, int contentDescription) {
final Tab tab = mActionBar.newTab();
tab.setTag(tabState);
- tab.setText(text);
+ tab.setIcon(icon);
+ tab.setContentDescription(contentDescription);
tab.setTabListener(mTabListener);
mActionBar.addTab(tab);
}
diff --git a/src/com/android/contacts/activities/CallLogActivity.java b/src/com/android/contacts/activities/CallLogActivity.java
index 4f1c8d9..dd81dab 100644
--- a/src/com/android/contacts/activities/CallLogActivity.java
+++ b/src/com/android/contacts/activities/CallLogActivity.java
@@ -16,7 +16,6 @@
package com.android.contacts.activities;
-import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
import com.android.contacts.calllog.CallLogFragment;
import com.android.internal.telephony.ITelephony;
@@ -99,14 +98,4 @@
}
return super.onKeyUp(keyCode, event);
}
-
- @Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- if (globalSearch) {
- super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- ContactsSearchManager.startSearch(this, initialQuery);
- }
- }
}
diff --git a/src/com/android/contacts/activities/ConfirmAddDetailActivity.java b/src/com/android/contacts/activities/ConfirmAddDetailActivity.java
index 418c8e3..3d4b70f 100644
--- a/src/com/android/contacts/activities/ConfirmAddDetailActivity.java
+++ b/src/com/android/contacts/activities/ConfirmAddDetailActivity.java
@@ -58,6 +58,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.RawContactsEntity;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
@@ -378,7 +379,10 @@
mSelection = Data.RAW_CONTACT_ID + "=?";
}
- return EntityDeltaList.fromQuery(activityTarget.getContentResolver(), mSelection,
+ // Note that this query does not need to concern itself with whether the contact is
+ // the user's profile, since the profile does not show up in the picker.
+ return EntityDeltaList.fromQuery(RawContactsEntity.CONTENT_URI,
+ activityTarget.getContentResolver(), mSelection,
new String[] { selectionArg }, null);
}
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
index 3d407ac..49d6672 100644
--- a/src/com/android/contacts/activities/ContactDetailActivity.java
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -37,6 +37,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
@@ -45,6 +46,8 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityManager;
import android.widget.CheckBox;
import android.widget.Toast;
@@ -121,11 +124,6 @@
}
@Override
- public boolean onSearchRequested() {
- return true; // Don't respond to the search key.
- }
-
- @Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
@@ -233,6 +231,13 @@
ActionBar actionBar = getActionBar();
actionBar.setTitle(displayName);
actionBar.setSubtitle(company);
+
+ if (!TextUtils.isEmpty(displayName) &&
+ AccessibilityManager.getInstance(this).isEnabled()) {
+ View decorView = getWindow().getDecorView();
+ decorView.setContentDescription(displayName);
+ decorView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ }
}
private final ContactDetailFragment.Listener mContactDetailFragmentListener =
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index c69cc04..abdde87 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -131,11 +131,6 @@
}
@Override
- public boolean onSearchRequested() {
- return true; // Don't respond to the search key.
- }
-
- @Override
public void onBackPressed() {
mFragment.save(SaveMode.CLOSE);
}
diff --git a/src/com/android/contacts/activities/DialtactsActivity.java b/src/com/android/contacts/activities/DialtactsActivity.java
index 7d96973..25f6fc2 100644
--- a/src/com/android/contacts/activities/DialtactsActivity.java
+++ b/src/com/android/contacts/activities/DialtactsActivity.java
@@ -94,8 +94,6 @@
private static final int TAB_INDEX_COUNT = 3;
- private static final int SUBACTIVITY_ACCOUNT_FILTER = 0;
-
/** Name of the dialtacts shared preferences */
static final String PREFS_DIALTACTS = "dialtacts";
static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false;
@@ -276,7 +274,7 @@
final Intent intent =
new Intent(DialtactsActivity.this, AccountFilterActivity.class);
ContactListFilter filter = mContactListFilterController.getFilter();
- startActivityForResult(intent, SUBACTIVITY_ACCOUNT_FILTER);
+ startActivityForResult(intent, AccountFilterActivity.DEFAULT_REQUEST_CODE);
return true;
}
};
@@ -518,11 +516,7 @@
private void setupDialer() {
final Tab tab = getActionBar().newTab();
- // TODO: Temporarily disable tab text labels (in all 4 tabs in this
- // activity) so that the current tabs will all fit onscreen in
- // portrait (bug 4520620). (Also note we do setText("") rather
- // leaving the text null, to work around bug 4521549.)
- tab.setText(""); // R.string.dialerIconLabel
+ tab.setContentDescription(R.string.dialerIconLabel);
tab.setTabListener(mTabListener);
tab.setIcon(R.drawable.ic_tab_dialer);
getActionBar().addTab(tab);
@@ -530,7 +524,7 @@
private void setupCallLog() {
final Tab tab = getActionBar().newTab();
- tab.setText(""); // R.string.recentCallsIconLabel
+ tab.setContentDescription(R.string.recentCallsIconLabel);
tab.setIcon(R.drawable.ic_tab_recent);
tab.setTabListener(mTabListener);
getActionBar().addTab(tab);
@@ -538,7 +532,7 @@
private void setupFavorites() {
final Tab tab = getActionBar().newTab();
- tab.setText(""); // R.string.contactsFavoritesLabel
+ tab.setContentDescription(R.string.contactsFavoritesLabel);
tab.setIcon(R.drawable.ic_tab_starred);
tab.setTabListener(mTabListener);
getActionBar().addTab(tab);
@@ -899,7 +893,7 @@
return;
}
switch (requestCode) {
- case SUBACTIVITY_ACCOUNT_FILTER: {
+ case AccountFilterActivity.DEFAULT_REQUEST_CODE: {
ContactListFilter filter = (ContactListFilter) data.getParcelableExtra(
AccountFilterActivity.KEY_EXTRA_CONTACT_LIST_FILTER);
if (filter == null) {
diff --git a/src/com/android/contacts/activities/GroupDetailActivity.java b/src/com/android/contacts/activities/GroupDetailActivity.java
index 47e02a7..2708d5d 100644
--- a/src/com/android/contacts/activities/GroupDetailActivity.java
+++ b/src/com/android/contacts/activities/GroupDetailActivity.java
@@ -169,9 +169,4 @@
}
return super.onOptionsItemSelected(item);
}
-
- @Override
- public boolean onSearchRequested() {
- return true; // Don't respond to the search key.
- }
}
diff --git a/src/com/android/contacts/activities/GroupEditorActivity.java b/src/com/android/contacts/activities/GroupEditorActivity.java
index 544cd16..7fed0f8 100644
--- a/src/com/android/contacts/activities/GroupEditorActivity.java
+++ b/src/com/android/contacts/activities/GroupEditorActivity.java
@@ -106,11 +106,6 @@
}
@Override
- public boolean onSearchRequested() {
- return true; // Don't respond to the search key.
- }
-
- @Override
public void onBackPressed() {
// If the change could not be saved, then revert to the default "back" button behavior.
if (!mFragment.save(SaveMode.CLOSE)) {
diff --git a/src/com/android/contacts/activities/JoinContactActivity.java b/src/com/android/contacts/activities/JoinContactActivity.java
index 725a9e7..b948b71 100644
--- a/src/com/android/contacts/activities/JoinContactActivity.java
+++ b/src/com/android/contacts/activities/JoinContactActivity.java
@@ -29,9 +29,6 @@
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
@@ -136,11 +133,6 @@
}
@Override
- public boolean onSearchRequested() {
- return false;
- }
-
- @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER
&& resultCode == RESULT_OK) {
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index ebf1dbd..332a953 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -108,7 +108,6 @@
private static final int SUBACTIVITY_NEW_GROUP = 2;
private static final int SUBACTIVITY_EDIT_GROUP = 3;
- private static final int SUBACTIVITY_ACCOUNT_FILTER = 4;
private static final String KEY_SEARCH_MODE = "searchMode";
@@ -492,13 +491,9 @@
tabToOpen = TabState.ALL;
break;
- // TODO: handle FREQUENT and STREQUENT according to the spec
case ContactsRequest.ACTION_FREQUENT:
case ContactsRequest.ACTION_STREQUENT:
- // For now they are treated the same as STARRED
case ContactsRequest.ACTION_STARRED:
- filter = ContactListFilter.createFilterWithType(
- ContactListFilter.FILTER_TYPE_STARRED);
tabToOpen = TabState.FAVORITES;
break;
case ContactsRequest.ACTION_VIEW_CONTACT:
@@ -1356,7 +1351,7 @@
}
case R.id.menu_contacts_filter: {
final Intent intent = new Intent(this, AccountFilterActivity.class);
- startActivityForResult(intent, SUBACTIVITY_ACCOUNT_FILTER);
+ startActivityForResult(intent, AccountFilterActivity.DEFAULT_REQUEST_CODE);
return true;
}
case R.id.menu_search: {
@@ -1433,7 +1428,7 @@
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
- case SUBACTIVITY_ACCOUNT_FILTER: {
+ case AccountFilterActivity.DEFAULT_REQUEST_CODE: {
if (resultCode == Activity.RESULT_OK) {
ContactListFilter filter = (ContactListFilter) data.getParcelableExtra(
AccountFilterActivity.KEY_EXTRA_CONTACT_LIST_FILTER);
diff --git a/src/com/android/contacts/activities/ShowOrCreateActivity.java b/src/com/android/contacts/activities/ShowOrCreateActivity.java
index 5e14db4..c60d0fb 100755
--- a/src/com/android/contacts/activities/ShowOrCreateActivity.java
+++ b/src/com/android/contacts/activities/ShowOrCreateActivity.java
@@ -17,7 +17,6 @@
package com.android.contacts.activities;
import com.android.contacts.ContactsActivity;
-import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
import com.android.contacts.util.Constants;
import com.android.contacts.util.NotifyingAsyncQueryHandler;
@@ -258,14 +257,4 @@
mParent.finish();
}
}
-
- @Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- if (globalSearch) {
- super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- ContactsSearchManager.startSearch(this, initialQuery);
- }
- }
}
diff --git a/src/com/android/contacts/detail/ContactDetailDisplayUtils.java b/src/com/android/contacts/detail/ContactDetailDisplayUtils.java
index cd4add6..f6690d6 100644
--- a/src/com/android/contacts/detail/ContactDetailDisplayUtils.java
+++ b/src/com/android/contacts/detail/ContactDetailDisplayUtils.java
@@ -22,6 +22,7 @@
import com.android.contacts.R;
import com.android.contacts.preference.ContactsPreferences;
import com.android.contacts.util.ContactBadgeUtil;
+import com.android.contacts.util.HtmlUtils;
import com.android.contacts.util.StreamItemEntry;
import com.android.contacts.util.StreamItemPhotoEntry;
import com.google.common.annotations.VisibleForTesting;
@@ -236,7 +237,7 @@
String photoUri = null;
if (!contactData.getStreamItems().isEmpty()) {
StreamItemEntry firstEntry = contactData.getStreamItems().get(0);
- snippet = Html.fromHtml(firstEntry.getText());
+ snippet = HtmlUtils.fromHtml(context, firstEntry.getText());
if (!firstEntry.getPhotos().isEmpty()) {
StreamItemPhotoEntry firstPhoto = firstEntry.getPhotos().get(0);
photoUri = firstPhoto.getPhotoUri();
@@ -266,37 +267,46 @@
List<StreamItemPhotoEntry> photos = streamItem.getPhotos();
final int photoCount = photos.size();
- // Process the photos, two at a time.
- for (int index = 0; index < photoCount; index += 2) {
- final StreamItemPhotoEntry firstPhoto = photos.get(index);
- if (index + 1 < photoCount) {
- // Put in two photos, side by side.
- final StreamItemPhotoEntry secondPhoto = photos.get(index + 1);
-
- View photoContainer = inflater.inflate(R.layout.stream_item_row_two_images,
- contentTable, false);
- loadPhoto(contactPhotoManager, streamItem, firstPhoto, photoContainer,
- R.id.stream_item_first_image, photoClickListener);
- loadPhoto(contactPhotoManager, streamItem, secondPhoto, photoContainer,
- R.id.stream_item_second_image, photoClickListener);
- contentTable.addView(photoContainer);
- } else {
- // Put in a single photo with text on the side.
- View photoContainer = inflater.inflate(
- R.layout.stream_item_row_image_and_text, contentTable, false);
- loadPhoto(contactPhotoManager, streamItem, firstPhoto, photoContainer,
- R.id.stream_item_first_image, photoClickListener);
- addStreamItemText(context, streamItem,
- photoContainer.findViewById(R.id.stream_item_second_text));
- contentTable.addView(photoContainer);
- }
- }
-
- if (photoCount % 2 == 0) {
- // Even number of photos, add the text below them. Otherwise, it should have been
- // already added next to the last photo.
- View textContainer = inflater.inflate(R.layout.stream_item_row_text_only, contentTable,
+ // This stream item only has text.
+ if (photoCount == 0) {
+ View textOnlyContainer = inflater.inflate(R.layout.stream_item_row_text, contentTable,
false);
+ addStreamItemText(context, streamItem, textOnlyContainer);
+ contentTable.addView(textOnlyContainer);
+ } else {
+ // This stream item has text and photos. Process the photos, two at a time.
+ for (int index = 0; index < photoCount; index += 2) {
+ final StreamItemPhotoEntry firstPhoto = photos.get(index);
+ if (index + 1 < photoCount) {
+ // Put in two photos, side by side.
+ final StreamItemPhotoEntry secondPhoto = photos.get(index + 1);
+ View photoContainer = inflater.inflate(R.layout.stream_item_row_two_images,
+ contentTable, false);
+ loadPhoto(contactPhotoManager, streamItem, firstPhoto, photoContainer,
+ R.id.stream_item_first_image, photoClickListener);
+ loadPhoto(contactPhotoManager, streamItem, secondPhoto, photoContainer,
+ R.id.stream_item_second_image, photoClickListener);
+ contentTable.addView(photoContainer);
+ } else {
+ // Put in a single photo
+ View photoContainer = inflater.inflate(
+ R.layout.stream_item_row_one_image, contentTable, false);
+ loadPhoto(contactPhotoManager, streamItem, firstPhoto, photoContainer,
+ R.id.stream_item_first_image, photoClickListener);
+ contentTable.addView(photoContainer);
+ }
+ }
+
+ // Add text, comments, and attribution if applicable
+ View textContainer = inflater.inflate(R.layout.stream_item_row_text, contentTable,
+ false);
+ // Add extra padding between the text and the images
+ int extraVerticalPadding = context.getResources().getDimensionPixelSize(
+ R.dimen.detail_update_section_between_items_vertical_padding);
+ textContainer.setPadding(textContainer.getPaddingLeft(),
+ textContainer.getPaddingTop() + extraVerticalPadding,
+ textContainer.getPaddingRight(),
+ textContainer.getPaddingBottom());
addStreamItemText(context, streamItem, textContainer);
contentTable.addView(textContainer);
}
@@ -338,10 +348,11 @@
R.id.stream_item_attribution);
TextView commentsView = (TextView) rootView.findViewById(R.id.stream_item_comments);
ImageGetter imageGetter = new DefaultImageGetter(context.getPackageManager());
- htmlView.setText(Html.fromHtml(streamItem.getText(), imageGetter, null));
+ htmlView.setText(HtmlUtils.fromHtml(context, streamItem.getText(), imageGetter, null));
attributionView.setText(ContactBadgeUtil.getSocialDate(streamItem, context));
if (streamItem.getComments() != null) {
- commentsView.setText(Html.fromHtml(streamItem.getComments(), imageGetter, null));
+ commentsView.setText(HtmlUtils.fromHtml(context, streamItem.getComments(), imageGetter,
+ null));
commentsView.setVisibility(View.VISIBLE);
} else {
commentsView.setVisibility(View.GONE);
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index bacc5db..775b50a 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -132,6 +132,13 @@
private static final String KEY_CONTACT_URI = "contactUri";
private static final String KEY_LIST_STATE = "liststate";
+ // TODO: Make maxLines a field in {@link DataKind}
+ private static final int WEBSITE_MAX_LINES = 1;
+ private static final int SIP_ADDRESS_MAX_LINES= 1;
+ private static final int POSTAL_ADDRESS_MAX_LINES = 10;
+ private static final int GROUP_MAX_LINES = 10;
+ private static final int NOTE_MAX_LINES = 100;
+
private Context mContext;
private View mView;
private OnScrollListener mVerticalScrollListener;
@@ -632,7 +639,7 @@
}
} else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
// Build postal entries
- entry.maxLines = 4;
+ entry.maxLines = POSTAL_ADDRESS_MAX_LINES;
entry.intent = new Intent(
Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(entry.data)));
mPostalEntries.add(entry);
@@ -665,12 +672,12 @@
} else if (Note.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
// Build note entries
entry.uri = null;
- entry.maxLines = 100;
+ entry.maxLines = NOTE_MAX_LINES;
mNoteEntries.add(entry);
} else if (Website.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
// Build Website entries
entry.uri = null;
- entry.maxLines = 1;
+ entry.maxLines = WEBSITE_MAX_LINES;
try {
WebAddress webAddress = new WebAddress(entry.data);
entry.intent = new Intent(Intent.ACTION_VIEW,
@@ -682,7 +689,7 @@
} else if (SipAddress.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
// Build SipAddress entries
entry.uri = null;
- entry.maxLines = 1;
+ entry.maxLines = SIP_ADDRESS_MAX_LINES;
if (mHasSip) {
entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
Uri.fromParts(Constants.SCHEME_SIP, entry.data, null));
@@ -747,7 +754,7 @@
entry.mimetype = GroupMembership.MIMETYPE;
entry.kind = mContext.getString(R.string.groupsLabel);
entry.data = sb.toString();
- entry.maxLines = 10;
+ entry.maxLines = GROUP_MAX_LINES;
mGroupEntries.add(entry);
}
}
diff --git a/src/com/android/contacts/detail/ContactDetailTabCarousel.java b/src/com/android/contacts/detail/ContactDetailTabCarousel.java
index 9300b54..4700078 100644
--- a/src/com/android/contacts/detail/ContactDetailTabCarousel.java
+++ b/src/com/android/contacts/detail/ContactDetailTabCarousel.java
@@ -146,6 +146,7 @@
if (mScrollToCurrentTab) {
mScrollToCurrentTab = false;
scrollTo(mCurrentTab == TAB_INDEX_ABOUT ? 0 : mAllowedHorizontalScrollLength, 0);
+ updateAlphaLayers();
}
}
diff --git a/src/com/android/contacts/dialpad/DigitsEditText.java b/src/com/android/contacts/dialpad/DigitsEditText.java
index 580a44a..753afd4 100644
--- a/src/com/android/contacts/dialpad/DigitsEditText.java
+++ b/src/com/android/contacts/dialpad/DigitsEditText.java
@@ -21,6 +21,7 @@
import android.text.InputType;
import android.util.AttributeSet;
import android.view.MotionEvent;
+import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
@@ -54,4 +55,18 @@
}
return ret;
}
+
+ @Override
+ public void sendAccessibilityEventUnchecked(AccessibilityEvent event) {
+ if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED) {
+ // AsYouTypeFormatter frequently replaces digits with formatted ones, which makes
+ // tts too verbose. Let's ignore the whole event.
+ return;
+ } else if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) {
+ // The parent EditText class lets tts read "edit box" when this View has a focus, which
+ // confuses users on app launch (issue 5275935).
+ return;
+ }
+ super.sendAccessibilityEventUnchecked(event);
+ }
}
\ No newline at end of file
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 9abcef1..2e54642 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -479,9 +479,26 @@
// For user profile, change the contacts query URI
mIsUserProfile = data.isUserProfile();
+ boolean localProfileExists = false;
+
if (mIsUserProfile) {
for (EntityDelta state : mState) {
+ // For profile contacts, we need a different query URI
state.setProfileQueryUri();
+ // Try to find a local profile contact
+ if (state.getValues().getAsString(RawContacts.ACCOUNT_TYPE) == null) {
+ localProfileExists = true;
+ }
+ }
+ // Editor should always present a local profile for editing
+ if (!localProfileExists) {
+ final ContentValues values = new ContentValues();
+ values.putNull(RawContacts.ACCOUNT_NAME);
+ values.putNull(RawContacts.ACCOUNT_TYPE);
+ values.putNull(RawContacts.DATA_SET);
+ EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
+ insert.setProfileQueryUri();
+ mState.add(insert);
}
}
mRequestFocus = true;
diff --git a/src/com/android/contacts/editor/PhotoActionPopup.java b/src/com/android/contacts/editor/PhotoActionPopup.java
index ac2d64f..cca6f9d 100644
--- a/src/com/android/contacts/editor/PhotoActionPopup.java
+++ b/src/com/android/contacts/editor/PhotoActionPopup.java
@@ -69,7 +69,7 @@
context.getString(resId)));
}
final ListAdapter adapter = new ArrayAdapter<ChoiceListItem>(context,
- android.R.layout.select_dialog_item, choices);
+ R.layout.select_dialog_item, choices);
final ListPopupWindow listPopupWindow = new ListPopupWindow(context);
final OnItemClickListener clickListener = new OnItemClickListener() {
diff --git a/src/com/android/contacts/format/DisplayNameFormatter.java b/src/com/android/contacts/format/DisplayNameFormatter.java
index e525217..2099c53 100644
--- a/src/com/android/contacts/format/DisplayNameFormatter.java
+++ b/src/com/android/contacts/format/DisplayNameFormatter.java
@@ -20,9 +20,6 @@
import com.android.contacts.widget.TextWithHighlightingFactory;
import android.database.CharArrayBuffer;
-import android.graphics.Typeface;
-import android.provider.ContactsContract;
-import android.text.Spannable;
import android.widget.TextView;
/**
@@ -50,10 +47,6 @@
return mAlternateNameBuffer;
}
- public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
- mTextWithHighlightingFactory = factory;
- }
-
public void setUnknownNameText(CharSequence unknownNameText) {
mUnknownNameText = unknownNameText;
}
diff --git a/src/com/android/contacts/group/GroupEditorFragment.java b/src/com/android/contacts/group/GroupEditorFragment.java
index fdb3cd4..96e0c8a 100644
--- a/src/com/android/contacts/group/GroupEditorFragment.java
+++ b/src/com/android/contacts/group/GroupEditorFragment.java
@@ -180,9 +180,6 @@
private LayoutInflater mLayoutInflater;
private TextView mGroupNameView;
- private ImageView mAccountIcon;
- private TextView mAccountTypeTextView;
- private TextView mAccountNameTextView;
private AutoCompleteTextView mAutoCompleteTextView;
private String mAccountName;
@@ -404,23 +401,25 @@
}
mGroupNameView = (TextView) editorView.findViewById(R.id.group_name);
- mAccountIcon = (ImageView) editorView.findViewById(R.id.account_icon);
- mAccountTypeTextView = (TextView) editorView.findViewById(R.id.account_type);
- mAccountNameTextView = (TextView) editorView.findViewById(R.id.account_name);
mAutoCompleteTextView = (AutoCompleteTextView) editorView.findViewById(
R.id.add_member_field);
mListView = (ListView) editorView.findViewById(android.R.id.list);
mListView.setAdapter(mMemberListAdapter);
- // Setup the account header
- CharSequence accountTypeDisplayLabel = accountType.getDisplayLabel(mContext);
- if (!TextUtils.isEmpty(mAccountName)) {
- mAccountNameTextView.setText(
- mContext.getString(R.string.from_account_format, mAccountName));
+ // Setup the account header, only when exists.
+ if (editorView.findViewById(R.id.account_header) != null) {
+ CharSequence accountTypeDisplayLabel = accountType.getDisplayLabel(mContext);
+ ImageView accountIcon = (ImageView) editorView.findViewById(R.id.account_icon);
+ TextView accountTypeTextView = (TextView) editorView.findViewById(R.id.account_type);
+ TextView accountNameTextView = (TextView) editorView.findViewById(R.id.account_name);
+ if (!TextUtils.isEmpty(mAccountName)) {
+ accountNameTextView.setText(
+ mContext.getString(R.string.from_account_format, mAccountName));
+ }
+ accountTypeTextView.setText(accountTypeDisplayLabel);
+ accountIcon.setImageDrawable(accountType.getDisplayIcon(mContext));
}
- mAccountTypeTextView.setText(accountTypeDisplayLabel);
- mAccountIcon.setImageDrawable(accountType.getDisplayIcon(mContext));
// Setup the autocomplete adapter (for contacts to suggest to add to the group) based on the
// account name and type. For groups that cannot have membership edited, there will be no
diff --git a/src/com/android/contacts/list/AccountFilterActivity.java b/src/com/android/contacts/list/AccountFilterActivity.java
index 8e0f9b8..aa1fe27 100644
--- a/src/com/android/contacts/list/AccountFilterActivity.java
+++ b/src/com/android/contacts/list/AccountFilterActivity.java
@@ -17,7 +17,6 @@
package com.android.contacts.list;
import com.android.contacts.ContactsActivity;
-import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypeManager;
@@ -31,14 +30,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.Loader;
-import android.database.Cursor;
import android.graphics.drawable.Drawable;
-import android.net.Uri;
import android.os.Bundle;
-import android.provider.BaseColumns;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.RawContacts;
-import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -62,6 +55,15 @@
private static final int SUBACTIVITY_CUSTOMIZE_FILTER = 0;
+ /**
+ * Request code for this Activity, which will be used with
+ * {@link Activity#startActivityForResult(Intent, int)}.
+ *
+ * This is useful when we want to share one request code among multiple Activities and
+ * Fragments.
+ */
+ public static final int DEFAULT_REQUEST_CODE = 10001;
+
public static final String KEY_EXTRA_CONTACT_LIST_FILTER = "contactListFilter";
private static final int FILTER_LOADER_ID = 0;
@@ -201,16 +203,6 @@
}
}
- @Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- if (globalSearch) {
- super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- ContactsSearchManager.startSearch(this, initialQuery);
- }
- }
-
private static class FilterListAdapter extends BaseAdapter {
private final List<ContactListFilter> mFilters;
private final LayoutInflater mLayoutInflater;
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index df2f0cc..e361a19 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -921,14 +921,6 @@
}
/**
- * Processes a user request to start search. This may be triggered by the
- * search key, a menu item or some other user action.
- */
- public void startSearch(String initialQuery) {
- ContactsSearchManager.startSearch(getActivity(), initialQuery, mRequest);
- }
-
- /**
* Processes a result returned by the contact picker.
*/
public void onPickerResult(Intent data) {
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 7e81dcd..a6e241f 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -21,7 +21,6 @@
import com.android.contacts.R;
import com.android.contacts.format.DisplayNameFormatter;
import com.android.contacts.format.PrefixHighlighter;
-import com.android.contacts.widget.TextWithHighlightingFactory;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -33,6 +32,9 @@
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
@@ -46,6 +48,11 @@
import android.widget.QuickContactBadge;
import android.widget.TextView;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* A custom view for an item in the contact list.
* The view contains the contact's photo, a set of text views (for name, status, etc...) and
@@ -271,10 +278,6 @@
mCallButtonClickListener = callButtonClickListener;
}
- public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
- mDisplayNameFormatter.setTextWithHighlightingFactory(factory);
- }
-
public void setUnknownNameText(CharSequence unknownNameText) {
mDisplayNameFormatter.setUnknownNameText(unknownNameText);
}
@@ -1094,8 +1097,25 @@
setSnippet(null);
return;
}
+ String snippet;
+ String columnContent = cursor.getString(summarySnippetColumnIndex);
- String snippet = cursor.getString(summarySnippetColumnIndex);
+ // Do client side snippeting if provider didn't do it
+ Bundle extras = cursor.getExtras();
+ if (extras.getBoolean(ContactsContract.DEFERRED_SNIPPETING)) {
+ int displayNameIndex = cursor.getColumnIndex(Contacts.DISPLAY_NAME);
+
+ snippet = ContactsContract.snippetize(columnContent,
+ displayNameIndex < 0 ? null : cursor.getString(displayNameIndex),
+ extras.getString(ContactsContract.DEFERRED_SNIPPETING_QUERY),
+ DefaultContactListAdapter.SNIPPET_START_MATCH,
+ DefaultContactListAdapter.SNIPPET_END_MATCH,
+ DefaultContactListAdapter.SNIPPET_ELLIPSIS,
+ DefaultContactListAdapter.SNIPPET_MAX_TOKENS);
+ } else {
+ snippet = columnContent;
+ }
+
if (snippet != null) {
int from = 0;
int to = snippet.length();
diff --git a/src/com/android/contacts/list/ContactListPinnedHeaderView.java b/src/com/android/contacts/list/ContactListPinnedHeaderView.java
index 5e95e4d..913bb75 100644
--- a/src/com/android/contacts/list/ContactListPinnedHeaderView.java
+++ b/src/com/android/contacts/list/ContactListPinnedHeaderView.java
@@ -86,6 +86,7 @@
mHeaderTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mHeaderTextSize);
mHeaderTextView.setTypeface(mHeaderTextView.getTypeface(), Typeface.BOLD);
mHeaderTextView.setGravity(Gravity.CENTER_VERTICAL);
+ mHeaderTextView.setAllCaps(true);
addView(mHeaderTextView);
mHeaderDivider = new View(mContext);
mHeaderDivider.setBackgroundColor(mHeaderUnderlineColor);
diff --git a/src/com/android/contacts/list/ContactPickerFragment.java b/src/com/android/contacts/list/ContactPickerFragment.java
index 5d0f692..43081e5 100644
--- a/src/com/android/contacts/list/ContactPickerFragment.java
+++ b/src/com/android/contacts/list/ContactPickerFragment.java
@@ -210,12 +210,6 @@
}
@Override
- public void startSearch(String initialQuery) {
- ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
- ACTIVITY_REQUEST_CODE_PICKER, getContactsRequest());
- }
-
- @Override
public void onPickerResult(Intent data) {
mListener.onPickContactAction(data.getData());
}
diff --git a/src/com/android/contacts/list/ContactTileImageContainer.java b/src/com/android/contacts/list/ContactTileImageContainer.java
new file mode 100644
index 0000000..e1a791b
--- /dev/null
+++ b/src/com/android/contacts/list/ContactTileImageContainer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+
+/**
+ * Custom container for ImageView or ContactBadge inside {@link ContactTileView}.
+ *
+ * This improves the performance of favorite tabs by not passing the layout request to the parent
+ * views, assuming that once measured this will not need to resize itself.
+ */
+public class ContactTileImageContainer extends FrameLayout {
+
+ public ContactTileImageContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void requestLayout() {
+ forceLayout();
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/list/ContactTileView.java b/src/com/android/contacts/list/ContactTileView.java
index 4562864..137f6e7 100644
--- a/src/com/android/contacts/list/ContactTileView.java
+++ b/src/com/android/contacts/list/ContactTileView.java
@@ -151,12 +151,4 @@
public interface Listener {
void onClick(ContactTileView contactTileView);
}
-
- @Override
- public void requestLayout() {
- // We will assume that once measured this will not need to resize
- // itself, so there is no need to pass the layout request to the parent
- // view (ListView).
- forceLayout();
- }
}
diff --git a/src/com/android/contacts/list/ContactsSectionIndexer.java b/src/com/android/contacts/list/ContactsSectionIndexer.java
index 5ecb31c..c260667 100644
--- a/src/com/android/contacts/list/ContactsSectionIndexer.java
+++ b/src/com/android/contacts/list/ContactsSectionIndexer.java
@@ -16,6 +16,7 @@
package com.android.contacts.list;
+import android.text.TextUtils;
import android.widget.SectionIndexer;
import java.util.Arrays;
@@ -29,6 +30,7 @@
private String[] mSections;
private int[] mPositions;
private int mCount;
+ private static final String BLANK_HEADER_STRING = " ";
/**
* Constructor.
@@ -52,9 +54,9 @@
mPositions = new int[counts.length];
int position = 0;
for (int i = 0; i < counts.length; i++) {
- if (mSections[i] == null) {
- mSections[i] = " ";
- } else {
+ if (TextUtils.isEmpty(mSections[i])) {
+ mSections[i] = BLANK_HEADER_STRING;
+ } else if (!mSections[i].equals(BLANK_HEADER_STRING)) {
mSections[i] = mSections[i].trim();
}
diff --git a/src/com/android/contacts/list/CustomContactListFilterActivity.java b/src/com/android/contacts/list/CustomContactListFilterActivity.java
index 1ac1d32..bbfbf32 100644
--- a/src/com/android/contacts/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -17,7 +17,6 @@
package com.android.contacts.list;
import com.android.contacts.ContactsActivity;
-import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypeManager;
@@ -896,16 +895,6 @@
}
@Override
- public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
- boolean globalSearch) {
- if (globalSearch) {
- super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- ContactsSearchManager.startSearch(this, initialQuery);
- }
- }
-
- @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 0129013..608d3ad 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -18,6 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.editor.ContactEditorFragment;
+import android.app.Activity;
import android.content.CursorLoader;
import android.content.Intent;
import android.database.Cursor;
@@ -25,6 +26,7 @@
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Button;
@@ -51,6 +53,19 @@
private View mPaddingView;
+ private class FilterHeaderClickListener implements OnClickListener {
+ @Override
+ public void onClick(View view) {
+ final Activity activity = getActivity();
+ if (activity != null) {
+ final Intent intent = new Intent(activity, AccountFilterActivity.class);
+ activity.startActivityForResult(
+ intent, AccountFilterActivity.DEFAULT_REQUEST_CODE);
+ }
+ }
+ }
+ private OnClickListener mFilterHeaderClickListener = new FilterHeaderClickListener();
+
public DefaultContactBrowseListFragment() {
setPhotoLoaderEnabled(true);
setSectionHeaderDisplayEnabled(true);
@@ -87,6 +102,7 @@
mAccountFilterHeaderView = (TextView) getView().findViewById(R.id.account_filter_header);
mAccountFilterHeaderContainer =
getView().findViewById(R.id.account_filter_header_container);
+ mAccountFilterHeaderContainer.setOnClickListener(mFilterHeaderClickListener);
mCounterHeaderView = (TextView) getView().findViewById(R.id.contacts_count);
// Create an empty user profile header and hide it for now (it will be visible if the
diff --git a/src/com/android/contacts/list/DefaultContactListAdapter.java b/src/com/android/contacts/list/DefaultContactListAdapter.java
index f202522..2a8d665 100644
--- a/src/com/android/contacts/list/DefaultContactListAdapter.java
+++ b/src/com/android/contacts/list/DefaultContactListAdapter.java
@@ -85,6 +85,7 @@
}
builder.appendQueryParameter(SearchSnippetColumns.SNIPPET_ARGS_PARAM_KEY,
SNIPPET_ARGS);
+ builder.appendQueryParameter(SearchSnippetColumns.DEFERRED_SNIPPETING_KEY,"1");
loader.setUri(builder.build());
loader.setProjection(FILTER_PROJECTION);
}
diff --git a/src/com/android/contacts/list/JoinContactListFragment.java b/src/com/android/contacts/list/JoinContactListFragment.java
index 59b29ed..7931699 100644
--- a/src/com/android/contacts/list/JoinContactListFragment.java
+++ b/src/com/android/contacts/list/JoinContactListFragment.java
@@ -163,15 +163,6 @@
}
@Override
- public void startSearch(String initialQuery) {
- ContactsRequest request = new ContactsRequest();
- request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT);
- request.setDirectorySearchEnabled(false);
- ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
- ACTIVITY_REQUEST_CODE_PICKER, request);
- }
-
- @Override
public void onPickerResult(Intent data) {
mListener.onPickContactAction(data.getData());
}
diff --git a/src/com/android/contacts/list/PhoneNumberListAdapter.java b/src/com/android/contacts/list/PhoneNumberListAdapter.java
index cac89b1..a86e082 100644
--- a/src/com/android/contacts/list/PhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/PhoneNumberListAdapter.java
@@ -90,15 +90,6 @@
+ "directoryId: " + directoryId + ")");
}
- final ContactListFilter filter = getFilter();
- if (filter != null &&
- (filter.filterType != ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS &&
- filter.filterType != ContactListFilter.FILTER_TYPE_ACCOUNT &&
- filter.filterType != ContactListFilter.FILTER_TYPE_CUSTOM)) {
- throw new IllegalArgumentException("Unexpected filter type came " +
- "(type: " + filter.filterType + ", toString: " + filter + ")");
- }
-
if (isSearchMode()) {
String query = getQueryString();
Builder builder = Phone.CONTENT_FILTER_URI.buildUpon();
@@ -122,7 +113,7 @@
}
loader.setProjection(PHONES_PROJECTION);
- configureSelection(loader, directoryId, filter);
+ configureSelection(loader, directoryId, getFilter());
}
loader.setUri(uri);
@@ -145,9 +136,6 @@
final List<String> selectionArgs = new ArrayList<String>();
switch (filter.filterType) {
- case ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS: {
- break;
- }
case ContactListFilter.FILTER_TYPE_CUSTOM: {
selection.append(Contacts.IN_VISIBLE_GROUP + "=1");
selection.append(" AND " + Contacts.HAS_PHONE_NUMBER + "=1");
@@ -169,20 +157,17 @@
selection.append(")");
break;
}
- case ContactListFilter.FILTER_TYPE_GROUP: {
- selection.append(Data.MIMETYPE + "=?"
- + " AND " + GroupMembership.GROUP_ROW_ID + "=?");
- selectionArgs.add(GroupMembership.CONTENT_ITEM_TYPE);
- selectionArgs.add(String.valueOf(filter.groupId));
- break;
- }
-
- case ContactListFilter.FILTER_TYPE_SINGLE_CONTACT:
- case ContactListFilter.FILTER_TYPE_STARRED:
+ case ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS:
+ case ContactListFilter.FILTER_TYPE_DEFAULT:
+ break; // No selection needed.
case ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY:
+ break; // This adapter is always "phone only", so no selection needed either.
default:
- throw new IllegalArgumentException("Unexpected filter type came " +
- "(type: " + filter.filterType + ", toString: " + filter + ")");
+ Log.w(TAG, "Unsupported filter type came " +
+ "(type: " + filter.filterType + ", toString: " + filter + ")" +
+ " showing all contacts.");
+ // No selection.
+ break;
}
loader.setSelection(selection.toString());
loader.setSelectionArgs(selectionArgs.toArray(new String[0]));
diff --git a/src/com/android/contacts/list/PhoneNumberPickerFragment.java b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
index 4819ded..88e5ecf 100644
--- a/src/com/android/contacts/list/PhoneNumberPickerFragment.java
+++ b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
@@ -29,8 +29,8 @@
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.widget.Adapter;
import android.widget.TextView;
/**
@@ -56,6 +56,21 @@
private static final String KEY_FILTER = "filter";
+ // A complete copy from DefaultContactBrowserListFragment
+ // TODO: should be able to share logic around filter header.
+ private class FilterHeaderClickListener implements OnClickListener {
+ @Override
+ public void onClick(View view) {
+ final Activity activity = getActivity();
+ if (activity != null) {
+ final Intent intent = new Intent(activity, AccountFilterActivity.class);
+ activity.startActivityForResult(
+ intent, AccountFilterActivity.DEFAULT_REQUEST_CODE);
+ }
+ }
+ }
+ private OnClickListener mFilterHeaderClickListener = new FilterHeaderClickListener();
+
public PhoneNumberPickerFragment() {
setQuickContactEnabled(false);
setPhotoLoaderEnabled(true);
@@ -82,6 +97,7 @@
mAccountFilterHeaderView = (TextView) getView().findViewById(R.id.account_filter_header);
mAccountFilterHeaderContainer =
getView().findViewById(R.id.account_filter_header_container);
+ mAccountFilterHeaderContainer.setOnClickListener(mFilterHeaderClickListener);
updateFilterHeaderView();
}
@@ -237,12 +253,6 @@
}
@Override
- public void startSearch(String initialQuery) {
- ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
- ACTIVITY_REQUEST_CODE_PICKER, getContactsRequest());
- }
-
- @Override
public void onPickerResult(Intent data) {
mListener.onPickPhoneNumberAction(data.getData());
}
diff --git a/src/com/android/contacts/model/EntityDeltaList.java b/src/com/android/contacts/model/EntityDeltaList.java
index 9b7bdc6..5a9355b 100644
--- a/src/com/android/contacts/model/EntityDeltaList.java
+++ b/src/com/android/contacts/model/EntityDeltaList.java
@@ -21,6 +21,7 @@
import android.content.Entity;
import android.content.EntityIterator;
import android.content.ContentProviderOperation.Builder;
+import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.ContactsContract.AggregationExceptions;
@@ -63,10 +64,10 @@
* given query parameters. This closes the {@link EntityIterator} when
* finished, so it doesn't subscribe to updates.
*/
- public static EntityDeltaList fromQuery(ContentResolver resolver, String selection,
- String[] selectionArgs, String sortOrder) {
+ public static EntityDeltaList fromQuery(Uri entityUri, ContentResolver resolver,
+ String selection, String[] selectionArgs, String sortOrder) {
final EntityIterator iterator = RawContacts.newEntityIterator(resolver.query(
- RawContactsEntity.CONTENT_URI, null, selection, selectionArgs,
+ entityUri, null, selection, selectionArgs,
sortOrder));
try {
return fromIterator(iterator);
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
index dd44310..9d064a5 100644
--- a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
+++ b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
@@ -21,6 +21,7 @@
import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.util.ContactBadgeUtil;
+import com.android.contacts.util.HtmlUtils;
import com.android.contacts.util.StreamItemEntry;
import android.app.PendingIntent;
@@ -36,7 +37,6 @@
import android.net.Uri;
import android.provider.ContactsContract.QuickContact;
import android.provider.ContactsContract.StreamItems;
-import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
@@ -208,7 +208,7 @@
} else {
// TODO: Rotate between all the stream items?
StreamItemEntry streamItem = streamItems.get(0);
- CharSequence status = Html.fromHtml(streamItem.getText());
+ CharSequence status = HtmlUtils.fromHtml(context, streamItem.getText());
if (status.length() <= SHORT_SNIPPET_LENGTH) {
sb.append("\n");
} else {
diff --git a/src/com/android/contacts/util/HtmlUtils.java b/src/com/android/contacts/util/HtmlUtils.java
new file mode 100644
index 0000000..faaa9c2
--- /dev/null
+++ b/src/com/android/contacts/util/HtmlUtils.java
@@ -0,0 +1,108 @@
+package com.android.contacts.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.text.Html;
+import android.text.Html.ImageGetter;
+import android.text.Html.TagHandler;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.TextUtils;
+import android.text.style.ImageSpan;
+import android.text.style.QuoteSpan;
+
+import com.android.contacts.R;
+
+/**
+ * Provides static functions to perform custom HTML to text conversions.
+ * Specifically, it adjusts the color and padding of the vertical
+ * stripe on block quotes and alignment of inlined images.
+ */
+public class HtmlUtils {
+
+ /**
+ * Converts HTML string to a {@link Spanned} text, adjusting formatting.
+ */
+ public static Spanned fromHtml(Context context, String text) {
+ if (TextUtils.isEmpty(text)) {
+ return null;
+ }
+ Spanned spanned = Html.fromHtml(text);
+ postprocess(context, spanned);
+ return spanned;
+ }
+
+ /**
+ * Converts HTML string to a {@link Spanned} text, adjusting formatting and using a custom
+ * image getter.
+ */
+ public static CharSequence fromHtml(Context context, String text, ImageGetter imageGetter,
+ TagHandler tagHandler) {
+ if (TextUtils.isEmpty(text)) {
+ return null;
+ }
+ Spanned spanned = Html.fromHtml(text, imageGetter, tagHandler);
+ postprocess(context, spanned);
+ return spanned;
+ }
+
+ /**
+ * Replaces some spans with custom versions of those.
+ */
+ private static void postprocess(Context context, Spanned spanned) {
+ if (!(spanned instanceof SpannableStringBuilder)) {
+ return;
+ }
+
+ int length = spanned.length();
+
+ SpannableStringBuilder builder = (SpannableStringBuilder)spanned;
+ QuoteSpan[] quoteSpans = spanned.getSpans(0, length, QuoteSpan.class);
+ if (quoteSpans != null && quoteSpans.length != 0) {
+ Resources resources = context.getResources();
+ int color = resources.getColor(R.color.stream_item_stripe_color);
+ int width = resources.getDimensionPixelSize(R.dimen.stream_item_stripe_width);
+ for (int i = 0; i < quoteSpans.length; i++) {
+ replaceSpan(builder, quoteSpans[i], new StreamItemQuoteSpan(color, width));
+ }
+ }
+
+ ImageSpan[] imageSpans = spanned.getSpans(0, length, ImageSpan.class);
+ if (imageSpans != null) {
+ for (int i = 0; i < imageSpans.length; i++) {
+ ImageSpan span = imageSpans[i];
+ replaceSpan(builder, span, new ImageSpan(span.getDrawable(),
+ ImageSpan.ALIGN_BASELINE));
+ }
+ }
+ }
+
+ /**
+ * Replaces one span with the other.
+ */
+ private static void replaceSpan(SpannableStringBuilder builder, Object originalSpan,
+ Object newSpan) {
+ builder.setSpan(newSpan,
+ builder.getSpanStart(originalSpan),
+ builder.getSpanEnd(originalSpan),
+ builder.getSpanFlags(originalSpan));
+ builder.removeSpan(originalSpan);
+ }
+
+ public static class StreamItemQuoteSpan extends QuoteSpan {
+ private final int mWidth;
+
+ public StreamItemQuoteSpan(int color, int width) {
+ super(color);
+ this.mWidth = width;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getLeadingMargin(boolean first) {
+ return mWidth;
+ }
+ }
+}
diff --git a/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
index f8e497d..becc133 100644
--- a/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
@@ -313,7 +313,7 @@
mPlayer.setAudioStreamType(PLAYBACK_STREAM);
mPlayer.prepare();
return null;
- } catch (IOException e) {
+ } catch (Exception e) {
return e;
}
}
diff --git a/tests/src/com/android/contacts/ContactsUtilsTests.java b/tests/src/com/android/contacts/ContactsUtilsTests.java
index e8deb11..97a2c8e 100644
--- a/tests/src/com/android/contacts/ContactsUtilsTests.java
+++ b/tests/src/com/android/contacts/ContactsUtilsTests.java
@@ -53,74 +53,132 @@
}
public void testShouldCollapse() throws Exception {
- checkShouldCollapse("1", true, null, null, null, null);
- checkShouldCollapse("2", true, "a", "b", "a", "b");
+ assertCollapses("1", true, null, null, null, null);
+ assertCollapses("2", true, "a", "b", "a", "b");
- checkShouldCollapse("11", false, "a", null, null, null);
- checkShouldCollapse("12", false, null, "a", null, null);
- checkShouldCollapse("13", false, null, null, "a", null);
- checkShouldCollapse("14", false, null, null, null, "a");
+ assertCollapses("11", false, "a", null, null, null);
+ assertCollapses("12", false, null, "a", null, null);
+ assertCollapses("13", false, null, null, "a", null);
+ assertCollapses("14", false, null, null, null, "a");
- checkShouldCollapse("21", false, "a", "b", null, null);
- checkShouldCollapse("22", false, "a", "b", "a", null);
- checkShouldCollapse("23", false, "a", "b", null, "b");
- checkShouldCollapse("24", false, "a", "b", "a", "x");
- checkShouldCollapse("25", false, "a", "b", "x", "b");
+ assertCollapses("21", false, "a", "b", null, null);
+ assertCollapses("22", false, "a", "b", "a", null);
+ assertCollapses("23", false, "a", "b", null, "b");
+ assertCollapses("24", false, "a", "b", "a", "x");
+ assertCollapses("25", false, "a", "b", "x", "b");
- checkShouldCollapse("31", false, null, null, "a", "b");
- checkShouldCollapse("32", false, "a", null, "a", "b");
- checkShouldCollapse("33", false, null, "b", "a", "b");
- checkShouldCollapse("34", false, "a", "x", "a", "b");
- checkShouldCollapse("35", false, "x", "b", "a", "b");
+ assertCollapses("31", false, null, null, "a", "b");
+ assertCollapses("32", false, "a", null, "a", "b");
+ assertCollapses("33", false, null, "b", "a", "b");
+ assertCollapses("34", false, "a", "x", "a", "b");
+ assertCollapses("35", false, "x", "b", "a", "b");
- checkShouldCollapse("41", true, Phone.CONTENT_ITEM_TYPE, null, Phone.CONTENT_ITEM_TYPE,
+ assertCollapses("41", true, Phone.CONTENT_ITEM_TYPE, null, Phone.CONTENT_ITEM_TYPE,
null);
- checkShouldCollapse("42", true, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE, "1");
+ assertCollapses("42", true, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE, "1");
- checkShouldCollapse("51", false, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE,
+ assertCollapses("51", false, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE,
"2");
- checkShouldCollapse("52", false, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE,
+ assertCollapses("52", false, Phone.CONTENT_ITEM_TYPE, "1", Phone.CONTENT_ITEM_TYPE,
null);
- checkShouldCollapse("53", false, Phone.CONTENT_ITEM_TYPE, null, Phone.CONTENT_ITEM_TYPE,
+ assertCollapses("53", false, Phone.CONTENT_ITEM_TYPE, null, Phone.CONTENT_ITEM_TYPE,
"2");
// Test phone numbers
- checkShouldCollapse("60", true,
+ assertCollapses("60", true,
Phone.CONTENT_ITEM_TYPE, "1234567",
Phone.CONTENT_ITEM_TYPE, "1234567");
- checkShouldCollapse("61", false,
+ assertCollapses("61", false,
Phone.CONTENT_ITEM_TYPE, "1234567",
Phone.CONTENT_ITEM_TYPE, "1234568");
- checkShouldCollapse("62", true,
+ assertCollapses("62", true,
Phone.CONTENT_ITEM_TYPE, "1234567;0",
Phone.CONTENT_ITEM_TYPE, "1234567;0");
- checkShouldCollapse("63", false,
+ assertCollapses("63", false,
Phone.CONTENT_ITEM_TYPE, "1234567;89321",
- Phone.CONTENT_ITEM_TYPE, "1234567;321");
- checkShouldCollapse("64", true,
+ Phone.CONTENT_ITEM_TYPE, "1234567;89322");
+ assertCollapses("64", true,
Phone.CONTENT_ITEM_TYPE, "1234567;89321",
Phone.CONTENT_ITEM_TYPE, "1234567;89321");
- checkShouldCollapse("65", false,
+ assertCollapses("65", false,
Phone.CONTENT_ITEM_TYPE, "1234567;0111111111",
Phone.CONTENT_ITEM_TYPE, "1234567;");
- checkShouldCollapse("66", false,
+ assertCollapses("66", false,
Phone.CONTENT_ITEM_TYPE, "12345675426;91970xxxxx",
Phone.CONTENT_ITEM_TYPE, "12345675426");
- checkShouldCollapse("67", false,
+ assertCollapses("67", false,
Phone.CONTENT_ITEM_TYPE, "12345675426;23456xxxxx",
Phone.CONTENT_ITEM_TYPE, "12345675426;234567xxxx");
- checkShouldCollapse("68", true,
+ assertCollapses("68", true,
Phone.CONTENT_ITEM_TYPE, "1234567;1234567;1234567",
Phone.CONTENT_ITEM_TYPE, "1234567;1234567;1234567");
- checkShouldCollapse("69", false,
+ assertCollapses("69", false,
Phone.CONTENT_ITEM_TYPE, "1234567;1234567;1234567",
Phone.CONTENT_ITEM_TYPE, "1234567;1234567");
+
+ // test some numbers with country and area code
+ assertCollapses("70", true,
+ Phone.CONTENT_ITEM_TYPE, "+49 (89) 12345678",
+ Phone.CONTENT_ITEM_TYPE, "+49 (89) 12345678");
+ assertCollapses("71", true,
+ Phone.CONTENT_ITEM_TYPE, "+49 (89) 12345678",
+ Phone.CONTENT_ITEM_TYPE, "+49 (89)12345678");
+ assertCollapses("72", true,
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092) 1234",
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092)1234");
+ assertCollapses("73", true,
+ Phone.CONTENT_ITEM_TYPE, "0049 (8092) 1234",
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234");
+ assertCollapses("74", false,
+ Phone.CONTENT_ITEM_TYPE, "+49 (89) 12345678",
+ Phone.CONTENT_ITEM_TYPE, "+49 (89) 12345679");
+
+ // test some numbers with wait symbol and area code
+ assertCollapses("80", true,
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092) 1234;89321",
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234;89321");
+ assertCollapses("81", false,
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092) 1234;89321",
+ Phone.CONTENT_ITEM_TYPE, "+49/80921235;89321");
+ assertCollapses("82", false,
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092) 1234;89322",
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234;89321");
+ assertCollapses("83", true,
+ Phone.CONTENT_ITEM_TYPE, "1234567;+49 (8092) 1234",
+ Phone.CONTENT_ITEM_TYPE, "1234567;+49/80921234");
+
+ // this makes sure that if if two segments are identical, we don't even try to parse
+ // (and therefore allow invalid phone numbers)
+ assertCollapses("84", true,
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234;a89",
+ Phone.CONTENT_ITEM_TYPE, "+49 (8092) 1234;a89");
+ assertCollapses("85", false,
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234;a89",
+ Phone.CONTENT_ITEM_TYPE, "+49/80921234;b89");
}
- private void checkShouldCollapse(String message, boolean expected, CharSequence mimetype1,
+ private void assertCollapses(String message, boolean expected, CharSequence mimetype1,
CharSequence data1, CharSequence mimetype2, CharSequence data2) {
assertEquals(message, expected,
ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2, data2));
+ assertEquals(message, expected,
+ ContactsUtils.shouldCollapse(mContext, mimetype2, data2, mimetype1, data1));
+
+ if (data1 == data2 && data1 != null) {
+ // make sure we also do a test where object equality is not given
+ final CharSequence data2_newref = data2 + "";
+
+ // this just makes sure the test is working
+ assertFalse(data1 == data2_newref);
+
+ // we have two different instances, now make sure we get the same result as before
+ assertEquals(message, expected,
+ ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2,
+ data2_newref));
+ assertEquals(message, expected,
+ ContactsUtils.shouldCollapse(mContext, mimetype2, data2_newref, mimetype1,
+ data1));
+ }
}
public void testAreIntentActionEqual() throws Exception {
diff --git a/tests/src/com/android/contacts/detail/ContactDetailDisplayUtilsTest.java b/tests/src/com/android/contacts/detail/ContactDetailDisplayUtilsTest.java
index 487eec9..3d383ff 100644
--- a/tests/src/com/android/contacts/detail/ContactDetailDisplayUtilsTest.java
+++ b/tests/src/com/android/contacts/detail/ContactDetailDisplayUtilsTest.java
@@ -108,7 +108,7 @@
*/
private View addStreamItemText(StreamItemEntry streamItem) {
return ContactDetailDisplayUtils.addStreamItemText(getContext(), streamItem,
- mLayoutInflater.inflate(R.layout.stream_item_row_text_only, null));
+ mLayoutInflater.inflate(R.layout.stream_item_row_text, null));
}
private StreamItemEntryBuilder getTestBuilder() {
diff --git a/tests/src/com/android/contacts/format/DisplayNameFormatterTest.java b/tests/src/com/android/contacts/format/DisplayNameFormatterTest.java
index 24714cd..4dc932b 100644
--- a/tests/src/com/android/contacts/format/DisplayNameFormatterTest.java
+++ b/tests/src/com/android/contacts/format/DisplayNameFormatterTest.java
@@ -125,20 +125,6 @@
SpannedTestUtils.checkHtmlText("unknown", mView);
}
- public void testSetDisplayName_Highlighting() {
- mDisplayNameFormatter.setTextWithHighlightingFactory(new TestTextWithHighlightingFactory());
- setNames("John Doe", "Sue Anne");
- setDisplayNameWithHighlighting();
- SpannedTestUtils.checkHtmlText("<i>John Doe</i> <i>Sue Anne</i>", mView);
- }
-
- public void testSetDisplayName_HighlightingAndBoldFirstName() {
- mDisplayNameFormatter.setTextWithHighlightingFactory(new TestTextWithHighlightingFactory());
- setNames("John Doe", "Doe John");
- setDisplayNameWithHighlighting();
- SpannedTestUtils.checkHtmlText("<i>John Doe</i> <i>Doe John</i>", mView);
- }
-
/**
* Sets the name and alternate name on the formatter.
*
diff --git a/tests/src/com/android/contacts/list/ContactListItemViewTest.java b/tests/src/com/android/contacts/list/ContactListItemViewTest.java
index 8372f96..aaf7521 100644
--- a/tests/src/com/android/contacts/list/ContactListItemViewTest.java
+++ b/tests/src/com/android/contacts/list/ContactListItemViewTest.java
@@ -18,7 +18,6 @@
import com.android.contacts.activities.PeopleActivity;
import com.android.contacts.format.SpannedTestUtils;
-import com.android.contacts.format.TestTextWithHighlightingFactory;
import com.android.contacts.util.IntegrationTestUtils;
import android.database.Cursor;
@@ -37,7 +36,7 @@
@LargeTest
public class ContactListItemViewTest extends ActivityInstrumentationTestCase2<PeopleActivity> {
/** The HTML code used to mark the start of the highlighted part. */
- private static final String START = "<font color =\"#729a27\">";
+ private static final String START = "<font color =\"#99cc00\">";
/** The HTML code used to mark the end of the highlighted part. */
private static final String END = "</font>";
@@ -106,18 +105,6 @@
view.getNameTextView());
}
- public void testShowDisplayName_WithHighlight() {
- Cursor cursor = createCursor("John Doe", "Doe John");
- ContactListItemView view = createView();
-
- view.setTextWithHighlightingFactory(new TestTextWithHighlightingFactory());
- view.showDisplayName(cursor, 0, 1, true,
- ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY);
-
- SpannedTestUtils.checkHtmlText("<i>John Doe</i> <i>Doe John</i>",
- view.getNameTextView());
- }
-
public void testSetSnippet_Prefix() {
ContactListItemView view = createView();
view.setHighlightedPrefix("TEST".toCharArray());