diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-27 15:31:13 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-27 15:31:13 -0700 |
commit | 2c91a62e1feac99603a0752d4a43aba7aa494d2c (patch) | |
tree | 74768db85ee09275b65aafdebd72bc40dbbb0f5a | |
parent | a5b2743e914aef330bf8fe045092f36dc38ac545 (diff) | |
parent | d463e03b381c5e45cecc30074cea24d93d90e8a6 (diff) | |
download | ContactsProvider-2c91a62e1feac99603a0752d4a43aba7aa494d2c.tar.gz |
Merge commit 'korg/cupcake'
-rw-r--r-- | res/values-cs/strings.xml | 19 | ||||
-rw-r--r-- | res/values-de/strings.xml | 19 | ||||
-rw-r--r-- | res/values-es/strings.xml | 19 | ||||
-rw-r--r-- | res/values-fr/strings.xml | 19 | ||||
-rw-r--r-- | res/values-it/strings.xml | 19 | ||||
-rw-r--r-- | res/values-ja/strings.xml | 19 | ||||
-rw-r--r-- | res/values-ko/strings.xml | 19 | ||||
-rw-r--r-- | res/values-nl/strings.xml | 19 | ||||
-rw-r--r-- | res/values-pl/strings.xml | 19 | ||||
-rw-r--r-- | res/values-ru/strings.xml | 19 | ||||
-rw-r--r-- | res/values-zh-rCN/strings.xml | 19 | ||||
-rw-r--r-- | res/values-zh-rTW/strings.xml | 19 | ||||
-rw-r--r-- | res/values/strings.xml | 10 | ||||
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider.java | 80 |
14 files changed, 295 insertions, 23 deletions
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml new file mode 100644 index 00000000..3602cb5f --- /dev/null +++ b/res/values-cs/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Úložiště kontaktů"</string> +</resources> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml new file mode 100644 index 00000000..1543aaa2 --- /dev/null +++ b/res/values-de/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Kontakte-Speicher"</string> +</resources> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml new file mode 100644 index 00000000..d2283223 --- /dev/null +++ b/res/values-es/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Información de los contactos"</string> +</resources> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml new file mode 100644 index 00000000..8417247a --- /dev/null +++ b/res/values-fr/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Liste des contacts"</string> +</resources> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml new file mode 100644 index 00000000..07e72ae2 --- /dev/null +++ b/res/values-it/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Archiviazione contatti"</string> +</resources> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml new file mode 100644 index 00000000..b7c79a87 --- /dev/null +++ b/res/values-ja/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"アドレス帳"</string> +</resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml new file mode 100644 index 00000000..f5f37d6a --- /dev/null +++ b/res/values-ko/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"주소록 저장소"</string> +</resources> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml new file mode 100644 index 00000000..3c3f3d63 --- /dev/null +++ b/res/values-nl/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Opslag contacten"</string> +</resources> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml new file mode 100644 index 00000000..fc4e7d8c --- /dev/null +++ b/res/values-pl/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Spis kontaktów"</string> +</resources> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml new file mode 100644 index 00000000..f57220f1 --- /dev/null +++ b/res/values-ru/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"Хранилище контактов"</string> +</resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml new file mode 100644 index 00000000..581d3be7 --- /dev/null +++ b/res/values-zh-rCN/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"存储联系人信息"</string> +</resources> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml new file mode 100644 index 00000000..82b01553 --- /dev/null +++ b/res/values-zh-rTW/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_label">"聯絡人儲存空間"</string> +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 55eaedcd..45637dd7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -19,14 +19,4 @@ <!-- This is the label for the application that stores contacts data --> <string name="app_label">Contacts Storage</string> - <!-- Strings for search suggestions --> - <string name="dialNumber">Dial number</string> - <string name="createNewContact">New contact</string> - <string name="usingNumber">Using <xliff:g id="number">%s</xliff:g></string> - - <!-- This string appears (on two lines) when you type a number into contacts search, to let you dial the phone number you typed. The first line will be in bigger type than the second. --> - <string name="dial_number_using">Dial number\nusing <xliff:g id="number" example="555">%s</xliff:g></string> - - <!-- This string appears (on two lines) when you type a number into contacts search, to let you create a contact whose phone number is the number you typed. The first line will be in bigger type than the second. --> - <string name="create_contact_using">Create contact\nusing <xliff:g id="number" example="555">%s</xliff:g></string> </resources> diff --git a/src/com/android/providers/contacts/ContactsProvider.java b/src/com/android/providers/contacts/ContactsProvider.java index 7a324155..e25ef394 100644 --- a/src/com/android/providers/contacts/ContactsProvider.java +++ b/src/com/android/providers/contacts/ContactsProvider.java @@ -26,6 +26,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.SharedPreferences; import android.content.UriMatcher; +import android.content.res.Resources; import android.database.Cursor; import android.database.CursorJoiner; import android.database.DatabaseUtils; @@ -754,6 +755,8 @@ public class ContactsProvider extends AbstractSyncableContentProvider { SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); Uri notificationUri = Contacts.CONTENT_URI; + StringBuilder whereClause; + String groupBy = null; // Generate the body of the query int match = sURIMatcher.match(url); @@ -869,6 +872,28 @@ public class ContactsProvider extends AbstractSyncableContentProvider { break; } + case PEOPLE_WITH_EMAIL_OR_IM_FILTER: + String email = url.getPathSegments().get(2); + whereClause = new StringBuilder(); + + // Match any E-mail or IM contact methods where data exactly + // matches the provided string. + whereClause.append(ContactMethods.DATA); + whereClause.append("="); + DatabaseUtils.appendEscapedSQLString(whereClause, email); + whereClause.append(" AND (kind = " + Contacts.KIND_EMAIL + + " OR kind = " + Contacts.KIND_IM + ")"); + qb.appendWhere(whereClause.toString()); + + qb.setTables("people INNER JOIN contact_methods on (people._id = contact_methods.person)"); + qb.setProjectionMap(sPeopleWithEmailOrImProjectionMap); + + // Prevent returning the same person for multiple matches + groupBy = "contact_methods.person"; + + qb.setDistinct(true); + break; + case PHOTOS_ID: qb.appendWhere("_id="+url.getPathSegments().get(1)); // Fall through. @@ -920,7 +945,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { final SQLiteDatabase db = getDatabase(); Cursor c = db.rawQueryWithFactory(null, query, null, sPeopleTable); if ((c != null) && !isTemporary()) { - c.setNotificationUri(getContext().getContentResolver(), url); + c.setNotificationUri(getContext().getContentResolver(), notificationUri); } return c; } @@ -951,7 +976,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { final SQLiteDatabase db = getDatabase(); Cursor c = db.rawQueryWithFactory(null, query, null, sPeopleTable); if ((c != null) && !isTemporary()) { - c.setNotificationUri(getContext().getContentResolver(), url); + c.setNotificationUri(getContext().getContentResolver(), notificationUri); } return c; } @@ -1091,7 +1116,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { break; case CONTACTMETHODS_EMAIL_FILTER: String pattern = url.getPathSegments().get(2); - StringBuilder whereClause = new StringBuilder(); + whereClause = new StringBuilder(); // TODO This is going to be REALLY slow. Come up with // something faster. @@ -1232,7 +1257,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { // run the query final SQLiteDatabase db = getDatabase(); Cursor c = qb.query(db, projectionIn, selection, selectionArgs, - null, null, sort); + groupBy, null, sort); if ((c != null) && !isTemporary()) { c.setNotificationUri(getContext().getContentResolver(), notificationUri); } @@ -1297,18 +1322,33 @@ public class ContactsProvider extends AbstractSyncableContentProvider { SearchManager.SUGGEST_COLUMN_INTENT_ACTION, }; -/* - * TODO: figure out how to localize things so myFaves can read the constants when sub classing - */ + Resources r = getContext().getResources(); + String s; + int i; + ArrayList dialNumber = new ArrayList(); - dialNumber.add("Dial number"); - dialNumber.add("Using " + searchClause); + s = r.getString(com.android.internal.R.string.dial_number_using, searchClause); + i = s.indexOf('\n'); + if (i < 0) { + dialNumber.add(s); + dialNumber.add(""); + } else { + dialNumber.add(s.substring(0, i)); + dialNumber.add(s.substring(i + 1)); + } dialNumber.add("tel:" + searchClause); - dialNumber.add(Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED); + dialNumber.add(Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED); ArrayList createContact = new ArrayList(); - createContact.add("Create contact"); - createContact.add("Using " + searchClause); + s = r.getString(com.android.internal.R.string.create_contact_using, searchClause); + i = s.indexOf('\n'); + if (i < 0) { + createContact.add(s); + createContact.add(""); + } else { + createContact.add(s.substring(0, i)); + createContact.add(s.substring(i + 1)); + } createContact.add("tel:" + searchClause); createContact.add(Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED); @@ -3699,6 +3739,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { private static final int PEOPLE_OWNER = PEOPLE_BASE + 19; private static final int PEOPLE_UPDATE_CONTACT_TIME = PEOPLE_BASE + 20; private static final int PEOPLE_PHONES_WITH_PRESENCE = PEOPLE_BASE + 21; + private static final int PEOPLE_WITH_EMAIL_OR_IM_FILTER = PEOPLE_BASE + 22; private static final int DELETED_BASE = 1000; private static final int DELETED_PEOPLE = DELETED_BASE; @@ -3769,6 +3810,7 @@ public class ContactsProvider extends AbstractSyncableContentProvider { private static final HashMap<String, String> sGroupsProjectionMap; private static final HashMap<String, String> sPeopleProjectionMap; private static final HashMap<String, String> sPeopleWithPhotoProjectionMap; + private static final HashMap<String, String> sPeopleWithEmailOrImProjectionMap; /** Used to force items to the top of a times_contacted list */ private static final HashMap<String, String> sStrequentStarredProjectionMap; private static final HashMap<String, String> sCallsProjectionMap; @@ -3876,6 +3918,8 @@ public class ContactsProvider extends AbstractSyncableContentProvider { matcher.addURI(CONTACTS_AUTHORITY, "people/filter/*", PEOPLE_FILTER); matcher.addURI(CONTACTS_AUTHORITY, "people/with_phones_filter/*", PEOPLE_WITH_PHONES_FILTER); + matcher.addURI(CONTACTS_AUTHORITY, "people/with_email_or_im_filter/*", + PEOPLE_WITH_EMAIL_OR_IM_FILTER); matcher.addURI(CONTACTS_AUTHORITY, "people/#", PEOPLE_ID); matcher.addURI(CONTACTS_AUTHORITY, "people/#/extensions", PEOPLE_EXTENSIONS); matcher.addURI(CONTACTS_AUTHORITY, "people/#/extensions/#", PEOPLE_EXTENSIONS_ID); @@ -4003,6 +4047,14 @@ public class ContactsProvider extends AbstractSyncableContentProvider { map.put("photo_data", "photos.data AS photo_data"); sPeopleWithPhotoProjectionMap = map; + // People with E-mail or IM projection map + map = new HashMap<String, String>(); + map.put(People._ID, "people._id AS " + People._ID); + map.put(ContactMethods.DATA, "contact_methods." + ContactMethods.DATA + " AS " + ContactMethods.DATA); + map.put(ContactMethods.KIND, "contact_methods." + ContactMethods.KIND + " AS " + ContactMethods.KIND); + map.putAll(peopleColumns); + sPeopleWithEmailOrImProjectionMap = map; + // Groups projection map map = new HashMap<String, String>(); map.put(Groups._ID, Groups._ID); @@ -4133,7 +4185,9 @@ public class ContactsProvider extends AbstractSyncableContentProvider { map = new HashMap<String, String>(); map.put(LiveFolders._ID, "people._id AS " + LiveFolders._ID); map.put(LiveFolders.NAME, DISPLAY_NAME_SQL + " AS " + LiveFolders.NAME); - map.put(LiveFolders.ICON_BITMAP, Photos.DATA + " AS " + LiveFolders.ICON_BITMAP); + // TODO: Put contact photo back when we have a way to display a default icon + // for contacts without a photo + // map.put(LiveFolders.ICON_BITMAP, Photos.DATA + " AS " + LiveFolders.ICON_BITMAP); sLiveFoldersProjectionMap = map; // Order by statements |