java电话本备份_Android VCard联系人备份恢复(导入/导出)详解

1 /*

2 * Copyright (C) 2006 The Android Open Source Project3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 *http://www.apache.org/licenses/LICENSE-2.0

9 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */

16

17 packagea_vcard.android.provider;18

19 //import com.android.internal.R;20

21 //import android.content.ContentResolver;22 //import android.content.ContentUris;23 //import android.content.ContentValues;24 //import android.content.Context;25 //import android.content.Intent;26 //import android.database.Cursor;27 //import android.graphics.Bitmap;28 //import android.graphics.BitmapFactory;29 //import android.net.Uri;30 //import android.text.TextUtils;31 //import android.util.Log;32 //import android.widget.ImageView;33

34 //import java.io.ByteArrayInputStream;35 //import java.io.InputStream;

36

37 /**

38 * The Contacts provider stores all information about contacts.39 */

40 public classContacts {41 private static final String TAG = "Contacts";42

43 public static final String AUTHORITY = "contacts";44

45 ///**46 //* The content://style URL for this provider47 //*/48 //public static final Uri CONTENT_URI =49 //Uri.parse("content://" + AUTHORITY);

50

51 /**Signifies an email address row that is stored in the ContactMethods table*/

52 public static final int KIND_EMAIL = 1;53 /**Signifies a postal address row that is stored in the ContactMethods table*/

54 public static final int KIND_POSTAL = 2;55 /**Signifies an IM address row that is stored in the ContactMethods table*/

56 public static final int KIND_IM = 3;57 /**Signifies an Organization row that is stored in the Organizations table*/

58 public static final int KIND_ORGANIZATION = 4;59 /**Signifies an Phone row that is stored in the Phones table*/

60 public static final int KIND_PHONE = 5;61

62 /**

63 * no public constructor since this is a utility class64 */

65 privateContacts() {}66

67 ///**68 //* Columns from the Settings table that other columns join into themselves.69 //*/70 //public interface SettingsColumns {71 ///**72 //* The _SYNC_ACCOUNT to which this setting corresponds. This may be null.73 //*

Type: TEXT

74 //*/75 //public static final String _SYNC_ACCOUNT = "_sync_account";76 //

77 ///**78 //* The key of this setting.79 //*

Type: TEXT

80 //*/81 //public static final String KEY = "key";82 //

83 ///**84 //* The value of this setting.85 //*

Type: TEXT

86 //*/87 //public static final String VALUE = "value";88 //}89 //

90 ///**91 //* The settings over all of the people92 //*/93 //public static final class Settings implements BaseColumns, SettingsColumns {94 ///**95 //* no public constructor since this is a utility class96 //*/97 //private Settings() {}98 //

99 ///**100 //* The content://style URL for this table101 //*/102 //public static final Uri CONTENT_URI =103 //Uri.parse("content://contacts/settings");104 //

105 ///**106 //* The directory twig for this sub-table107 //*/108 //public static final String CONTENT_DIRECTORY = "settings";109 //

110 ///**111 //* The default sort order for this table112 //*/113 //public static final String DEFAULT_SORT_ORDER = "key ASC";114 //

115 ///**116 //* A setting that is used to indicate if we should sync down all groups for the117 //* specified account. For this setting the _SYNC_ACCOUNT column must be set.118 //* If this isn't set then we will only sync the groups whose SHOULD_SYNC column119 //* is set to true.120 //*

121 //* This is a boolean setting. It is true if it is set and it is anything other than the122 //* emptry string or "0".123 //*/124 //public static final String SYNC_EVERYTHING = "syncEverything";125 //

126 //public static String getSetting(ContentResolver cr, String account, String key) {127 // //For now we only support a single account and the UI doesn't know what128 // //the account name is, so we're using a global setting for SYNC_EVERYTHING.129 // //Some day when we add multiple accounts to the UI this should honor the account130 // //that was asked for.131 //String selectString;132 //String[] selectArgs;133 //if (false) {134 //selectString = (account == null)135 //? "_sync_account is null AND key=?"136 //: "_sync_account=? AND key=?";137 //selectArgs = (account == null)138 //? new String[]{key}139 //: new String[]{account, key};140 //} else {141 //selectString = "key=?";142 //selectArgs = new String[] {key};143 //}144 //Cursor cursor = cr.query(Settings.CONTENT_URI, new String[]{VALUE},145 //selectString, selectArgs, null);146 //try {147 //if (!cursor.moveToNext()) return null;148 //return cursor.getString(0);149 //} finally {150 //cursor.close();151 //}152 //}153 //

154 //public static void setSetting(ContentResolver cr, String account, String key,155 //String value) {156 //ContentValues values = new ContentValues();157 // //For now we only support a single account and the UI doesn't know what158 // //the account name is, so we're using a global setting for SYNC_EVERYTHING.159 // //Some day when we add multiple accounts to the UI this should honor the account160 // //that was asked for.161 // //values.put(_SYNC_ACCOUNT, account);162 //values.put(KEY, key);163 //values.put(VALUE, value);164 //cr.update(Settings.CONTENT_URI, values, null, null);165 //}166 //}167 //168 /**

169 * Columns from the People table that other tables join into themselves.170 */

171 public interfacePeopleColumns {172 /**

173 * The person's name.174 *

Type: TEXT

175 */

176 public static final String NAME = "name";177

178 /**

179 * Phonetic equivalent of the person's name, in a locale-dependent180 * character set (e.g. hiragana for Japanese).181 * Used for pronunciation and/or collation in some languages.182 *

Type: TEXT

183 */

184 public static final String PHONETIC_NAME = "phonetic_name";185

186 /**

187 * The display name. If name is not null name, else if number is not null number,188 * else if email is not null email.189 *

Type: TEXT

190 */

191 public static final String DISPLAY_NAME = "display_name";192

193 /**

194 * The field for sorting list phonetically. The content of this field195 * may not be human readable but phonetically sortable.196 *

Type: TEXT

197 * @hide Used only in Contacts application for now.198 */

199 public static final String SORT_STRING = "sort_string";200

201 /**

202 * Notes about the person.203 *

Type: TEXT

204 */

205 public static final String NOTES = "notes";206

207 /**

208 * The number of times a person has been contacted209 *

Type: INTEGER

210 */

211 public static final String TIMES_CONTACTED = "times_contacted";212

213 /**

214 * The last time a person was contacted.215 *

Type: INTEGER

216 */

217 public static final String LAST_TIME_CONTACTED = "last_time_contacted";218

219 /**

220 * A custom ringtone associated with a person. Not always present.221 *

Type: TEXT (URI to the ringtone)

222 */

223 public static final String CUSTOM_RINGTONE = "custom_ringtone";224

225 /**

226 * Whether the person should always be sent to voicemail. Not always227 * present.228 *

Type: INTEGER (0 for false, 1 for true)

229 */

230 public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";231

232 /**

233 * Is the contact starred?234 *

Type: INTEGER (boolean)

235 */

236 public static final String STARRED = "starred";237

238 /**

239 * The server version of the photo240 *

Type: TEXT (the version number portion of the photo URI)

241 */

242 public static final String PHOTO_VERSION = "photo_version";243 }244 //

245 ///**246 //* This table contains people.247 //*/248 //public static final class People implements BaseColumns, SyncConstValue, PeopleColumns,249 //PhonesColumns, PresenceColumns {250 ///**251 //* no public constructor since this is a utility class252 //*/253 //private People() {}254 //

255 ///**256 //* The content://style URL for this table257 //*/258 //public static final Uri CONTENT_URI =259 //Uri.parse("content://contacts/people");260 //

261 ///**262 //* The content://style URL for filtering people by name. The filter263 //* argument should be passed as an additional path segment after this URI.264 //*/265 //public static final Uri CONTENT_FILTER_URI =266 //Uri.parse("content://contacts/people/filter");267 //

268 ///**269 //* The content://style URL for the table that holds the deleted270 //* contacts.271 //*/272 //public static final Uri DELETED_CONTENT_URI =273 //Uri.parse("content://contacts/deleted_people");274 //

275 ///**276 //* The content://style URL for filtering people that have a specific277 //* E-mail or IM address. The filter argument should be passed as an278 //* additional path segment after this URI. This matches any people with279 //* at least one E-mail or IM {@link ContactMethods} that match the280 //* filter.281 //*282 //* Not exposed because we expect significant changes in the contacts283 //* schema and do not want to have to support this.284 //* @hide285 //*/286 //public static final Uri WITH_EMAIL_OR_IM_FILTER_URI =287 //Uri.parse("content://contacts/people/with_email_or_im_filter");288 //

289 ///**290 //* The MIME type of {@link #CONTENT_URI} providing a directory of291 //* people.292 //*/293 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";294 //

295 ///**296 //* The MIME type of a {@link #CONTENT_URI} subdirectory of a single297 //* person.298 //*/299 //public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";300 //

301 ///**302 //* The default sort order for this table303 //*/304 //public static final String DEFAULT_SORT_ORDER = People.NAME + " ASC";305 //

306 ///**307 //* The ID of the persons preferred phone number.308 //*

Type: INTEGER (foreign key to phones table on the _ID field)

309 //*/310 //public static final String PRIMARY_PHONE_ID = "primary_phone";311 //

312 ///**313 //* The ID of the persons preferred email.314 //*

Type: INTEGER (foreign key to contact_methods table on the315 //* _ID field)

316 //*/317 //public static final String PRIMARY_EMAIL_ID = "primary_email";318 //

319 ///**320 //* The ID of the persons preferred organization.321 //*

Type: INTEGER (foreign key to organizations table on the322 //* _ID field)

323 //*/324 //public static final String PRIMARY_ORGANIZATION_ID = "primary_organization";325 //

326 ///**327 //* Mark a person as having been contacted.328 //*329 //* @param resolver the ContentResolver to use330 //* @param personId the person who was contacted331 //*/332 //public static void markAsContacted(ContentResolver resolver, long personId) {333 //Uri uri = ContentUris.withAppendedId(CONTENT_URI, personId);334 //uri = Uri.withAppendedPath(uri, "update_contact_time");335 //ContentValues values = new ContentValues();336 // //There is a trigger in place that will update TIMES_CONTACTED when337 // //LAST_TIME_CONTACTED is modified.338 //values.put(LAST_TIME_CONTACTED, System.currentTimeMillis());339 //resolver.update(uri, values, null, null);340 //}341 //

342 ///**343 //* @hide Used in vCard parser code.344 //*/345 //public static long tryGetMyContactsGroupId(ContentResolver resolver) {346 //Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,347 //Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null);348 //if (groupsCursor != null) {349 //try {350 //if (groupsCursor.moveToFirst()) {351 //return groupsCursor.getLong(0);352 //}353 //} finally {354 //groupsCursor.close();355 //}356 //}357 //return 0;358 //}359 //

360 ///**361 //* Adds a person to the My Contacts group.362 //*363 //* @param resolver the resolver to use364 //* @param personId the person to add to the group365 //* @return the URI of the group membership row366 //* @throws IllegalStateException if the My Contacts group can't be found367 //*/368 //public static Uri addToMyContactsGroup(ContentResolver resolver, long personId) {369 //long groupId = tryGetMyContactsGroupId(resolver);370 //if (groupId == 0) {371 //throw new IllegalStateException("Failed to find the My Contacts group");372 //}373 //

374 //return addToGroup(resolver, personId, groupId);375 //}376 //

377 ///**378 //* Adds a person to a group referred to by name.379 //*380 //* @param resolver the resolver to use381 //* @param personId the person to add to the group382 //* @param groupName the name of the group to add the contact to383 //* @return the URI of the group membership row384 //* @throws IllegalStateException if the group can't be found385 //*/386 //public static Uri addToGroup(ContentResolver resolver, long personId, String groupName) {387 //long groupId = 0;388 //Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,389 //Groups.NAME + "=?", new String[] { groupName }, null);390 //if (groupsCursor != null) {391 //try {392 //if (groupsCursor.moveToFirst()) {393 //groupId = groupsCursor.getLong(0);394 //}395 //} finally {396 //groupsCursor.close();397 //}398 //}399 //

400 //if (groupId == 0) {401 //throw new IllegalStateException("Failed to find the My Contacts group");402 //}403 //

404 //return addToGroup(resolver, personId, groupId);405 //}406 //

407 ///**408 //* Adds a person to a group.409 //*410 //* @param resolver the resolver to use411 //* @param personId the person to add to the group412 //* @param groupId the group to add the person to413 //* @return the URI of the group membership row414 //*/415 //public static Uri addToGroup(ContentResolver resolver, long personId, long groupId) {416 //ContentValues values = new ContentValues();417 //values.put(GroupMembership.PERSON_ID, personId);418 //values.put(GroupMembership.GROUP_ID, groupId);419 //return resolver.insert(GroupMembership.CONTENT_URI, values);420 //}421 //

422 //private static final String[] GROUPS_PROJECTION = new String[] {423 //Groups._ID,424 //};425 //

426 ///**427 //* Creates a new contacts and adds it to the "My Contacts" group.428 //*429 //* @param resolver the ContentResolver to use430 //* @param values the values to use when creating the contact431 //* @return the URI of the contact, or null if the operation fails432 //*/433 //public static Uri createPersonInMyContactsGroup(ContentResolver resolver,434 //ContentValues values) {435 //

436 //Uri contactUri = resolver.insert(People.CONTENT_URI, values);437 //if (contactUri == null) {438 //Log.e(TAG, "Failed to create the contact");439 //return null;440 //}441 //

442 //if (addToMyContactsGroup(resolver, ContentUris.parseId(contactUri)) == null) {443 //resolver.delete(contactUri, null, null);444 //return null;445 //}446 //return contactUri;447 //}448 //

449 //public static Cursor queryGroups(ContentResolver resolver, long person) {450 //return resolver.query(GroupMembership.CONTENT_URI, null, "person=?",451 //new String[]{String.valueOf(person)}, Groups.DEFAULT_SORT_ORDER);452 //}453 //

454 ///**455 //* Set the photo for this person. data may be null456 //* @param cr the ContentResolver to use457 //* @param person the Uri of the person whose photo is to be updated458 //* @param data the byte[] that represents the photo459 //*/460 //public static void setPhotoData(ContentResolver cr, Uri person, byte[] data) {461 //Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);462 //ContentValues values = new ContentValues();463 //values.put(Photos.DATA, data);464 //cr.update(photoUri, values, null, null);465 //}466 //

467 ///**468 //* Opens an InputStream for the person's photo and returns the photo as a Bitmap.469 //* If the person's photo isn't present returns the placeholderImageResource instead.470 //* @param person the person whose photo should be used471 //*/472 //public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri person) {473 //Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);474 //Cursor cursor = cr.query(photoUri, new String[]{Photos.DATA}, null, null, null);475 //try {476 //if (!cursor.moveToNext()) {477 //return null;478 //}479 //byte[] data = cursor.getBlob(0);480 //if (data == null) {481 //return null;482 //}483 //return new ByteArrayInputStream(data);484 //} finally {485 //cursor.close();486 //}487 //}488 //

489 ///**490 //* Opens an InputStream for the person's photo and returns the photo as a Bitmap.491 //* If the person's photo isn't present returns the placeholderImageResource instead.492 //* @param context the Context493 //* @param person the person whose photo should be used494 //* @param placeholderImageResource the image resource to use if the person doesn't495 //* have a photo496 //* @param options the decoding options, can be set to null497 //*/498 //public static Bitmap loadContactPhoto(Context context, Uri person,499 //int placeholderImageResource, BitmapFactory.Options options) {500 //if (person == null) {501 //return loadPlaceholderPhoto(placeholderImageResource, context, options);502 //}503 //

504 //InputStream stream = openContactPhotoInputStream(context.getContentResolver(), person);505 //Bitmap bm = stream != null ? BitmapFactory.decodeStream(stream, null, options) : null;506 //if (bm == null) {507 //bm = loadPlaceholderPhoto(placeholderImageResource, context, options);508 //}509 //return bm;510 //}511 //

512 //private static Bitmap loadPlaceholderPhoto(int placeholderImageResource, Context context,513 //BitmapFactory.Options options) {514 //if (placeholderImageResource == 0) {515 //return null;516 //}517 //return BitmapFactory.decodeResource(context.getResources(),518 //placeholderImageResource, options);519 //}

520

521 /**

522 * A sub directory of a single person that contains all of their Phones.523 */

524 public static final class Phones implementsBaseColumns, PhonesColumns,525 PeopleColumns {526 /**

527 * no public constructor since this is a utility class528 */

529 privatePhones() {}530

531 /**

532 * The directory twig for this sub-table533 */

534 public static final String CONTENT_DIRECTORY = "phones";535

536 /**

537 * The default sort order for this table538 */

539 public static final String DEFAULT_SORT_ORDER = "number ASC";540 }541

542 /**

543 * A subdirectory of a single person that contains all of their544 * ContactMethods.545 */

546 public static final classContactMethods547 implementsBaseColumns, ContactMethodsColumns, PeopleColumns {548 /**

549 * no public constructor since this is a utility class550 */

551 privateContactMethods() {}552

553 /**

554 * The directory twig for this sub-table555 */

556 public static final String CONTENT_DIRECTORY = "contact_methods";557

558 /**

559 * The default sort order for this table560 */

561 public static final String DEFAULT_SORT_ORDER = "data ASC";562 }563

564 ///**565 //* The extensions for a person566 //*/567 //public static class Extensions implements BaseColumns, ExtensionsColumns {568 ///**569 //* no public constructor since this is a utility class570 //*/571 //private Extensions() {}572 //

573 ///**574 //* The directory twig for this sub-table575 //*/576 //public static final String CONTENT_DIRECTORY = "extensions";577 //

578 ///**579 //* The default sort order for this table580 //*/581 //public static final String DEFAULT_SORT_ORDER = "name ASC";582 //

583 ///**584 //* The ID of the person this phone number is assigned to.585 //*

Type: INTEGER (long)

586 //*/587 //public static final String PERSON_ID = "person";588 //}589 //}590 //

591 ///**592 //* Columns from the groups table.593 //*/594 //public interface GroupsColumns {595 ///**596 //* The group name.597 //*

Type: TEXT

598 //*/599 //public static final String NAME = "name";600 //

601 ///**602 //* Notes about the group.603 //*

Type: TEXT

604 //*/605 //public static final String NOTES = "notes";606 //

607 ///**608 //* Whether this group should be synced if the SYNC_EVERYTHING settings is false609 //* for this group's account.610 //*

Type: INTEGER (boolean)

611 //*/612 //public static final String SHOULD_SYNC = "should_sync";613 //

614 ///**615 //* The ID of this group if it is a System Group, null otherwise.616 //*

Type: TEXT

617 //*/618 //public static final String SYSTEM_ID = "system_id";619 //}620 //

621 ///**622 //* This table contains the groups for an account.623 //*/624 //public static final class Groups625 //implements BaseColumns, SyncConstValue, GroupsColumns {626 ///**627 //* no public constructor since this is a utility class628 //*/629 //private Groups() {}630 //

631 ///**632 //* The content://style URL for this table633 //*/634 //public static final Uri CONTENT_URI =635 //Uri.parse("content://contacts/groups");636 //

637 ///**638 //* The content://style URL for the table that holds the deleted639 //* groups.640 //*/641 //public static final Uri DELETED_CONTENT_URI =642 //Uri.parse("content://contacts/deleted_groups");643 //

644 ///**645 //* The MIME type of {@link #CONTENT_URI} providing a directory of646 //* groups.647 //*/648 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroup";649 //

650 ///**651 //* The MIME type of a {@link #CONTENT_URI} subdirectory of a single652 //* group.653 //*/654 //public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroup";655 //

656 ///**657 //* The default sort order for this table658 //*/659 //public static final String DEFAULT_SORT_ORDER = NAME + " ASC";660 //

661 ///**662 //*663 //*/664 //public static final String GROUP_ANDROID_STARRED = "Starred in Android";665 //

666 ///**667 //* The "My Contacts" system group.668 //*/669 //public static final String GROUP_MY_CONTACTS = "Contacts";670 //}671 //672 /**

673 * Columns from the Phones table that other columns join into themselves.674 */

675 public interfacePhonesColumns {676 /**

677 * The type of the the phone number.678 *

Type: INTEGER (one of the constants below)

679 */

680 public static final String TYPE = "type";681

682 public static final int TYPE_CUSTOM = 0;683 public static final int TYPE_HOME = 1;684 public static final int TYPE_MOBILE = 2;685 public static final int TYPE_WORK = 3;686 public static final int TYPE_FAX_WORK = 4;687 public static final int TYPE_FAX_HOME = 5;688 public static final int TYPE_PAGER = 6;689 public static final int TYPE_OTHER = 7;690

691 /**

692 * The user provided label for the phone number, only used if TYPE is TYPE_CUSTOM.693 *

Type: TEXT

694 */

695 public static final String LABEL = "label";696

697 /**

698 * The phone number as the user entered it.699 *

Type: TEXT

700 */

701 public static final String NUMBER = "number";702

703 /**

704 * The normalized phone number705 *

Type: TEXT

706 */

707 public static final String NUMBER_KEY = "number_key";708

709 /**

710 * Whether this is the primary phone number711 *

Type: INTEGER (if set, non-0 means true)

712 */

713 public static final String ISPRIMARY = "isprimary";714 }715 //

716 ///**717 //* This table stores phone numbers and a reference to the person that the718 //* contact method belongs to. Phone numbers are stored separately from719 //* other contact methods to make caller ID lookup more efficient.720 //*/721 //public static final class Phones722 //implements BaseColumns, PhonesColumns, PeopleColumns {723 ///**724 //* no public constructor since this is a utility class725 //*/726 //private Phones() {}727 //

728 //public static final CharSequence getDisplayLabel(Context context, int type,729 //CharSequence label, CharSequence[] labelArray) {730 //CharSequence display = "";731 //

732 //if (type != People.Phones.TYPE_CUSTOM) {733 //CharSequence[] labels = labelArray != null? labelArray734 //: context.getResources().getTextArray(735 //com.android.internal.R.array.phoneTypes);736 //try {737 //display = labels[type - 1];738 //} catch (ArrayIndexOutOfBoundsException e) {739 //display = labels[People.Phones.TYPE_HOME - 1];740 //}741 //} else {742 //if (!TextUtils.isEmpty(label)) {743 //display = label;744 //}745 //}746 //return display;747 //}748 //

749 //public static final CharSequence getDisplayLabel(Context context, int type,750 //CharSequence label) {751 //return getDisplayLabel(context, type, label, null);752 //}753 //

754 ///**755 //* The content://style URL for this table756 //*/757 //public static final Uri CONTENT_URI =758 //Uri.parse("content://contacts/phones");759 //

760 ///**761 //* The content://style URL for filtering phone numbers762 //*/763 //public static final Uri CONTENT_FILTER_URL =764 //Uri.parse("content://contacts/phones/filter");765 //

766 ///**767 //* The MIME type of {@link #CONTENT_URI} providing a directory of768 //* phones.769 //*/770 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";771 //

772 ///**773 //* The MIME type of a {@link #CONTENT_URI} subdirectory of a single774 //* phone.775 //*/776 //public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";777 //

778 ///**779 //* The default sort order for this table780 //*/781 //public static final String DEFAULT_SORT_ORDER = "name ASC";782 //

783 ///**784 //* The ID of the person this phone number is assigned to.785 //*

Type: INTEGER (long)

786 //*/787 //public static final String PERSON_ID = "person";788 //}789 //

790 //public static final class GroupMembership implements BaseColumns, GroupsColumns {791 ///**792 //* no public constructor since this is a utility class793 //*/794 //private GroupMembership() {}795 //

796 ///**797 //* The content://style URL for this table798 //*/799 //public static final Uri CONTENT_URI =800 //Uri.parse("content://contacts/groupmembership");801 //

802 ///**803 //* The content://style URL for this table804 //*/805 //public static final Uri RAW_CONTENT_URI =806 //Uri.parse("content://contacts/groupmembershipraw");807 //

808 ///**809 //* The directory twig for this sub-table810 //*/811 //public static final String CONTENT_DIRECTORY = "groupmembership";812 ///**813 //* The MIME type of {@link #CONTENT_URI} providing a directory of all814 //* person groups.815 //*/816 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroupmembership";817 //

818 ///**819 //* The MIME type of a {@link #CONTENT_URI} subdirectory of a single820 //* person group.821 //*/822 //public static final String CONTENT_ITEM_TYPE =823 //"vnd.android.cursor.item/contactsgroupmembership";824 //

825 ///**826 //* The default sort order for this table827 //*/828 //public static final String DEFAULT_SORT_ORDER = "group_id ASC";829 //

830 ///**831 //* The row id of the accounts group.832 //*

Type: TEXT

833 //*/834 //public static final String GROUP_ID = "group_id";835 //

836 ///**837 //* The sync id of the group.838 //*

Type: TEXT

839 //*/840 //public static final String GROUP_SYNC_ID = "group_sync_id";841 //

842 ///**843 //* The account of the group.844 //*

Type: TEXT

845 //*/846 //public static final String GROUP_SYNC_ACCOUNT = "group_sync_account";847 //

848 ///**849 //* The row id of the person.850 //*

Type: TEXT

851 //*/852 //public static final String PERSON_ID = "person";853 //}854 //855 /**

856 * Columns from the ContactMethods table that other tables join into857 * themseleves.858 */

859 public interfaceContactMethodsColumns {860 /**

861 * The kind of the the contact method. For example, email address,862 * postal address, etc.863 *

Type: INTEGER (one of the values below)

864 */

865 public static final String KIND = "kind";866

867 /**

868 * The type of the contact method, must be one of the types below.869 *

Type: INTEGER (one of the values below)

870 */

871 public static final String TYPE = "type";872 public static final int TYPE_CUSTOM = 0;873 public static final int TYPE_HOME = 1;874 public static final int TYPE_WORK = 2;875 public static final int TYPE_OTHER = 3;876

877 /**

878 * @hide This is temporal. TYPE_MOBILE should be added to TYPE in the future.879 */

880 public static final int MOBILE_EMAIL_TYPE_INDEX = 2;881

882 /**

883 * @hide This is temporal. TYPE_MOBILE should be added to TYPE in the future.884 * This is not "mobile" but "CELL" since vCard uses it for identifying mobile phone.885 */

886 public static final String MOBILE_EMAIL_TYPE_NAME = "_AUTO_CELL";887

888 /**

889 * The user defined label for the the contact method.890 *

Type: TEXT

891 */

892 public static final String LABEL = "label";893

894 /**

895 * The data for the contact method.896 *

Type: TEXT

897 */

898 public static final String DATA = "data";899

900 /**

901 * Auxiliary data for the contact method.902 *

Type: TEXT

903 */

904 public static final String AUX_DATA = "aux_data";905

906 /**

907 * Whether this is the primary organization908 *

Type: INTEGER (if set, non-0 means true)

909 */

910 public static final String ISPRIMARY = "isprimary";911 }912 //

913 ///**914 //* This table stores all non-phone contact methods and a reference to the915 //* person that the contact method belongs to.916 //*/917 //public static final class ContactMethods918 //implements BaseColumns, ContactMethodsColumns, PeopleColumns {919 ///**920 //* The column with latitude data for postal locations921 //*

Type: REAL

922 //*/923 //public static final String POSTAL_LOCATION_LATITUDE = DATA;924 //

925 ///**926 //* The column with longitude data for postal locations927 //*

Type: REAL

928 //*/929 //public static final String POSTAL_LOCATION_LONGITUDE = AUX_DATA;930 //

931 ///**932 //* The predefined IM protocol types. The protocol can either be non-present, one933 //* of these types, or a free-form string. These cases are encoded in the AUX_DATA934 //* column as:935 //* - null936 //* - pre:937 //* - custom:938 //*/939 //public static final int PROTOCOL_AIM = 0;940 //public static final int PROTOCOL_MSN = 1;941 //public static final int PROTOCOL_YAHOO = 2;942 //public static final int PROTOCOL_SKYPE = 3;943 //public static final int PROTOCOL_QQ = 4;944 //public static final int PROTOCOL_GOOGLE_TALK = 5;945 //public static final int PROTOCOL_ICQ = 6;946 //public static final int PROTOCOL_JABBER = 7;947 //

948 //public static String encodePredefinedImProtocol(int protocol) {949 //return "pre:" + protocol;950 //}951 //

952 //public static String encodeCustomImProtocol(String protocolString) {953 //return "custom:" + protocolString;954 //}955 //

956 //public static Object decodeImProtocol(String encodedString) {957 //if (encodedString == null) {958 //return null;959 //}960 //

961 //if (encodedString.startsWith("pre:")) {962 //return Integer.parseInt(encodedString.substring(4));963 //}964 //

965 //if (encodedString.startsWith("custom:")) {966 //return encodedString.substring(7);967 //}968 //

969 //throw new IllegalArgumentException(970 //"the value is not a valid encoded protocol, " + encodedString);971 //}972 //

973 ///**974 //* This looks up the provider name defined in975 //* {@link android.provider.Im.ProviderNames} from the predefined IM protocol id.976 //* This is used for interacting with the IM application.977 //*978 //* @param protocol the protocol ID979 //* @return the provider name the IM app uses for the given protocol, or null if no980 //* provider is defined for the given protocol981 //* @hide982 //*/983 //public static String lookupProviderNameFromId(int protocol) {984 //switch (protocol) {985 //case PROTOCOL_GOOGLE_TALK:986 //return Im.ProviderNames.GTALK;987 //case PROTOCOL_AIM:988 //return Im.ProviderNames.AIM;989 //case PROTOCOL_MSN:990 //return Im.ProviderNames.MSN;991 //case PROTOCOL_YAHOO:992 //return Im.ProviderNames.YAHOO;993 //case PROTOCOL_ICQ:994 //return Im.ProviderNames.ICQ;995 //case PROTOCOL_JABBER:996 //return Im.ProviderNames.JABBER;997 //case PROTOCOL_SKYPE:998 //return Im.ProviderNames.SKYPE;999 //case PROTOCOL_QQ:1000 //return Im.ProviderNames.QQ;1001 //}1002 //return null;1003 //}1004 //

1005 ///**1006 //* no public constructor since this is a utility class1007 //*/1008 //private ContactMethods() {}1009 //

1010 //public static final CharSequence getDisplayLabel(Context context, int kind,1011 //int type, CharSequence label) {1012 //CharSequence display = "";1013 //switch (kind) {1014 //case KIND_EMAIL: {1015 //if (type != People.ContactMethods.TYPE_CUSTOM) {1016 //CharSequence[] labels = context.getResources().getTextArray(1017 //com.android.internal.R.array.emailAddressTypes);1018 //try {1019 //display = labels[type - 1];1020 //} catch (ArrayIndexOutOfBoundsException e) {1021 //display = labels[ContactMethods.TYPE_HOME - 1];1022 //}1023 //} else {1024 //if (!TextUtils.isEmpty(label)) {1025 //if (label.toString().equals(MOBILE_EMAIL_TYPE_NAME)) {1026 //display =1027 //context.getString(1028 //com.android.internal.R.string.mobileEmailTypeName);1029 //} else {1030 //display = label;1031 //}1032 //}1033 //}1034 //break;1035 //}1036 //

1037 //case KIND_POSTAL: {1038 //if (type != People.ContactMethods.TYPE_CUSTOM) {1039 //CharSequence[] labels = context.getResources().getTextArray(1040 //com.android.internal.R.array.postalAddressTypes);1041 //try {1042 //display = labels[type - 1];1043 //} catch (ArrayIndexOutOfBoundsException e) {1044 //display = labels[ContactMethods.TYPE_HOME - 1];1045 //}1046 //} else {1047 //if (!TextUtils.isEmpty(label)) {1048 //display = label;1049 //}1050 //}1051 //break;1052 //}1053 //

1054 //default:1055 //display = context.getString(R.string.untitled);1056 //}1057 //return display;1058 //}1059 //

1060 ///**1061 //* Add a longitude and latitude location to a postal address.1062 //*1063 //* @param context the context to use when updating the database1064 //* @param postalId the address to update1065 //* @param latitude the latitude for the address1066 //* @param longitude the longitude for the address1067 //*/1068 //public void addPostalLocation(Context context, long postalId,1069 //double latitude, double longitude) {1070 //final ContentResolver resolver = context.getContentResolver();1071 // //Insert the location1072 //ContentValues values = new ContentValues(2);1073 //values.put(POSTAL_LOCATION_LATITUDE, latitude);1074 //values.put(POSTAL_LOCATION_LONGITUDE, longitude);1075 //Uri loc = resolver.insert(CONTENT_URI, values);1076 //long locId = ContentUris.parseId(loc);1077 //

1078 // //Update the postal address1079 //values.clear();1080 //values.put(AUX_DATA, locId);1081 //resolver.update(ContentUris.withAppendedId(CONTENT_URI, postalId), values, null, null);1082 //}1083 //

1084 ///**1085 //* The content://style URL for this table1086 //*/1087 //public static final Uri CONTENT_URI =1088 //Uri.parse("content://contacts/contact_methods");1089 //

1090 ///**1091 //* The content://style URL for sub-directory of e-mail addresses.1092 //*/1093 //public static final Uri CONTENT_EMAIL_URI =1094 //Uri.parse("content://contacts/contact_methods/email");1095 //

1096 ///**1097 //* The MIME type of {@link #CONTENT_URI} providing a directory of1098 //* phones.1099 //*/1100 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact-methods";1101 //

1102 ///**1103 //* The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of\1104 //* multiple {@link Contacts#KIND_EMAIL} entries.1105 //*/1106 //public static final String CONTENT_EMAIL_TYPE = "vnd.android.cursor.dir/email";1107 //

1108 ///**1109 //* The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of\1110 //* multiple {@link Contacts#KIND_POSTAL} entries.1111 //*/1112 //public static final String CONTENT_POSTAL_TYPE = "vnd.android.cursor.dir/postal-address";1113 //

1114 ///**1115 //* The MIME type of a {@link #CONTENT_URI} sub-directory of a single1116 //* {@link Contacts#KIND_EMAIL} entry.1117 //*/1118 //public static final String CONTENT_EMAIL_ITEM_TYPE = "vnd.android.cursor.item/email";1119 //

1120 ///**1121 //* The MIME type of a {@link #CONTENT_URI} sub-directory of a single1122 //* {@link Contacts#KIND_POSTAL} entry.1123 //*/1124 //public static final String CONTENT_POSTAL_ITEM_TYPE1125 //= "vnd.android.cursor.item/postal-address";1126 //

1127 ///**1128 //* The MIME type of a {@link #CONTENT_URI} sub-directory of a single1129 //* {@link Contacts#KIND_IM} entry.1130 //*/1131 //public static final String CONTENT_IM_ITEM_TYPE = "vnd.android.cursor.item/jabber-im";1132 //

1133 ///**1134 //* The default sort order for this table1135 //*/1136 //public static final String DEFAULT_SORT_ORDER = "name ASC";1137 //

1138 ///**1139 //* The ID of the person this contact method is assigned to.1140 //*

Type: INTEGER (long)

1141 //*/1142 //public static final String PERSON_ID = "person";1143 //}1144 //

1145 ///**1146 //* The IM presence columns with some contacts specific columns mixed in.1147 //*/1148 //public interface PresenceColumns extends Im.CommonPresenceColumns {1149 ///**1150 //* The IM service the presence is coming from. Formatted using either1151 //* {@link Contacts.ContactMethods#encodePredefinedImProtocol} or1152 //* {@link Contacts.ContactMethods#encodeCustomImProtocol}.1153 //*

Type: STRING

1154 //*/1155 //public static final String IM_PROTOCOL = "im_protocol";1156 //

1157 ///**1158 //* The IM handle the presence item is for. The handle is scoped to1159 //* the {@link #IM_PROTOCOL}.1160 //*

Type: STRING

1161 //*/1162 //public static final String IM_HANDLE = "im_handle";1163 //

1164 ///**1165 //* The IM account for the local user that the presence data came from.1166 //*

Type: STRING

1167 //*/1168 //public static final String IM_ACCOUNT = "im_account";1169 //}1170 //

1171 ///**1172 //* Contains presence information about contacts.1173 //* @hide1174 //*/1175 //public static final class Presence1176 //implements BaseColumns, PresenceColumns, PeopleColumns {1177 ///**1178 //* The content://style URL for this table1179 //*/1180 //public static final Uri CONTENT_URI =1181 //Uri.parse("content://contacts/presence");1182 //

1183 ///**1184 //* The ID of the person this presence item is assigned to.1185 //*

Type: INTEGER (long)

1186 //*/1187 //public static final String PERSON_ID = "person";1188 //

1189 ///**1190 //* Gets the resource ID for the proper presence icon.1191 //*1192 //* @param status the status to get the icon for1193 //* @return the resource ID for the proper presence icon1194 //*/1195 //public static final int getPresenceIconResourceId(int status) {1196 //switch (status) {1197 //case Contacts.People.AVAILABLE:1198 //return com.android.internal.R.drawable.presence_online;1199 //

1200 //case Contacts.People.IDLE:1201 //case Contacts.People.AWAY:1202 //return com.android.internal.R.drawable.presence_away;1203 //

1204 //case Contacts.People.DO_NOT_DISTURB:1205 //return com.android.internal.R.drawable.presence_busy;1206 //

1207 //case Contacts.People.INVISIBLE:1208 //return com.android.internal.R.drawable.presence_invisible;1209 //

1210 //case Contacts.People.OFFLINE:1211 //default:1212 //return com.android.internal.R.drawable.presence_offline;1213 //}1214 //}1215 //

1216 ///**1217 //* Sets a presence icon to the proper graphic1218 //*1219 //* @param icon the icon to to set1220 //* @param serverStatus that status1221 //*/1222 //public static final void setPresenceIcon(ImageView icon, int serverStatus) {1223 //icon.setImageResource(getPresenceIconResourceId(serverStatus));1224 //}1225 //}1226 //1227 /**

1228 * Columns from the Organizations table that other columns join into themselves.1229 */

1230 public interfaceOrganizationColumns {1231 /**

1232 * The type of the organizations.1233 *

Type: INTEGER (one of the constants below)

1234 */

1235 public static final String TYPE = "type";1236

1237 public static final int TYPE_CUSTOM = 0;1238 public static final int TYPE_WORK = 1;1239 public static final int TYPE_OTHER = 2;1240

1241 /**

1242 * The user provided label, only used if TYPE is TYPE_CUSTOM.1243 *

Type: TEXT

1244 */

1245 public static final String LABEL = "label";1246

1247 /**

1248 * The name of the company for this organization.1249 *

Type: TEXT

1250 */

1251 public static final String COMPANY = "company";1252

1253 /**

1254 * The title within this organization.1255 *

Type: TEXT

1256 */

1257 public static final String TITLE = "title";1258

1259 /**

1260 * The person this organization is tied to.1261 *

Type: TEXT

1262 */

1263 public static final String PERSON_ID = "person";1264

1265 /**

1266 * Whether this is the primary organization1267 *

Type: INTEGER (if set, non-0 means true)

1268 */

1269 public static final String ISPRIMARY = "isprimary";1270 }1271 //

1272 ///**1273 //* A sub directory of a single person that contains all of their Phones.1274 //*/1275 //public static final class Organizations implements BaseColumns, OrganizationColumns {1276 ///**1277 //* no public constructor since this is a utility class1278 //*/1279 //private Organizations() {}1280 //

1281 //public static final CharSequence getDisplayLabel(Context context, int type,1282 //CharSequence label) {1283 //CharSequence display = "";1284 //

1285 //if (type != TYPE_CUSTOM) {1286 //CharSequence[] labels = context.getResources().getTextArray(1287 //com.android.internal.R.array.organizationTypes);1288 //try {1289 //display = labels[type - 1];1290 //} catch (ArrayIndexOutOfBoundsException e) {1291 //display = labels[Organizations.TYPE_WORK - 1];1292 //}1293 //} else {1294 //if (!TextUtils.isEmpty(label)) {1295 //display = label;1296 //}1297 //}1298 //return display;1299 //}1300 //

1301 ///**1302 //* The content://style URL for this table1303 //*/1304 //public static final Uri CONTENT_URI =1305 //Uri.parse("content://contacts/organizations");1306 //

1307 ///**1308 //* The directory twig for this sub-table1309 //*/1310 //public static final String CONTENT_DIRECTORY = "organizations";1311 //

1312 ///**1313 //* The default sort order for this table1314 //*/1315 //public static final String DEFAULT_SORT_ORDER = "company, title, isprimary ASC";1316 //}1317 //

1318 ///**1319 //* Columns from the Photos table that other columns join into themselves.1320 //*/1321 //public interface PhotosColumns {1322 ///**1323 //* The _SYNC_VERSION of the photo that was last downloaded1324 //*

Type: TEXT

1325 //*/1326 //public static final String LOCAL_VERSION = "local_version";1327 //

1328 ///**1329 //* The person this photo is associated with.1330 //*

Type: TEXT

1331 //*/1332 //public static final String PERSON_ID = "person";1333 //

1334 ///**1335 //* non-zero if a download is required and the photo isn't marked as a bad resource.1336 //* You must specify this in the columns in order to use it in the where clause.1337 //*

Type: INTEGER(boolean)

1338 //*/1339 //public static final String DOWNLOAD_REQUIRED = "download_required";1340 //

1341 ///**1342 //* non-zero if this photo is known to exist on the server1343 //*

Type: INTEGER(boolean)

1344 //*/1345 //public static final String EXISTS_ON_SERVER = "exists_on_server";1346 //

1347 ///**1348 //* Contains the description of the upload or download error from1349 //* the previous attempt. If null then the previous attempt succeeded.1350 //*

Type: TEXT

1351 //*/1352 //public static final String SYNC_ERROR = "sync_error";1353 //

1354 ///**1355 //* The image data, or null if there is no image.1356 //*

Type: BLOB

1357 //*/1358 //public static final String DATA = "data";1359 //

1360 //}1361 //

1362 ///**1363 //* The photos over all of the people1364 //*/1365 //public static final class Photos implements BaseColumns, PhotosColumns, SyncConstValue {1366 ///**1367 //* no public constructor since this is a utility class1368 //*/1369 //private Photos() {}1370 //

1371 ///**1372 //* The content://style URL for this table1373 //*/1374 //public static final Uri CONTENT_URI =1375 //Uri.parse("content://contacts/photos");1376 //

1377 ///**1378 //* The directory twig for this sub-table1379 //*/1380 //public static final String CONTENT_DIRECTORY = "photo";1381 //

1382 ///**1383 //* The default sort order for this table1384 //*/1385 //public static final String DEFAULT_SORT_ORDER = "person ASC";1386 //}1387 //

1388 //public interface ExtensionsColumns {1389 ///**1390 //* The name of this extension. May not be null. There may be at most one row for each name.1391 //*

Type: TEXT

1392 //*/1393 //public static final String NAME = "name";1394 //

1395 ///**1396 //* The value of this extension. May not be null.1397 //*

Type: TEXT

1398 //*/1399 //public static final String VALUE = "value";1400 //}1401 //

1402 ///**1403 //* The extensions for a person1404 //*/1405 //public static final class Extensions implements BaseColumns, ExtensionsColumns {1406 ///**1407 //* no public constructor since this is a utility class1408 //*/1409 //private Extensions() {}1410 //

1411 ///**1412 //* The content://style URL for this table1413 //*/1414 //public static final Uri CONTENT_URI =1415 //Uri.parse("content://contacts/extensions");1416 //

1417 ///**1418 //* The MIME type of {@link #CONTENT_URI} providing a directory of1419 //* phones.1420 //*/1421 //public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_extensions";1422 //

1423 ///**1424 //* The MIME type of a {@link #CONTENT_URI} subdirectory of a single1425 //* phone.1426 //*/1427 //public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_extensions";1428 ///**1429 //* The default sort order for this table1430 //*/1431 //public static final String DEFAULT_SORT_ORDER = "person, name ASC";1432 //

1433 ///**1434 //* The ID of the person this phone number is assigned to.1435 //*

Type: INTEGER (long)

1436 //*/1437 //public static final String PERSON_ID = "person";1438 //}1439 //

1440 ///**1441 //* Contains helper classes used to create or manage {@link android.content.Intent Intents}1442 //* that involve contacts.1443 //*/1444 //public static final class Intents {1445 ///**1446 //* This is the intent that is fired when a search suggestion is clicked on.1447 //*/1448 //public static final String SEARCH_SUGGESTION_CLICKED =1449 //"android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";1450 //

1451 ///**1452 //* This is the intent that is fired when a search suggestion for dialing a number1453 //* is clicked on.1454 //*/1455 //public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =1456 //"android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";1457 //

1458 ///**1459 //* This is the intent that is fired when a search suggestion for creating a contact1460 //* is clicked on.1461 //*/1462 //public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =1463 //"android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";1464 //

1465 ///**1466 //* Starts an Activity that lets the user pick a contact to attach an image to.1467 //* After picking the contact it launches the image cropper in face detection mode.1468 //*/1469 //public static final String ATTACH_IMAGE =1470 //"com.android.contacts.action.ATTACH_IMAGE";1471 //

1472 ///**1473 //* Takes as input a data URI with a mailto: or tel: scheme. If a single1474 //* contact exists with the given data it will be shown. If no contact1475 //* exists, a dialog will ask the user if they want to create a new1476 //* contact with the provided details filled in. If multiple contacts1477 //* share the data the user will be prompted to pick which contact they1478 //* want to view.1479 //*

1480 //* For mailto: URIs, the scheme specific portion must be a1481 //* raw email address, such as one built using1482 //* {@link Uri#fromParts(String, String, String)}.1483 //*

1484 //* For tel: URIs, the scheme specific portion is compared1485 //* to existing numbers using the standard caller ID lookup algorithm.1486 //* The number must be properly encoded, for example using1487 //* {@link Uri#fromParts(String, String, String)}.1488 //*

1489 //* Any extras from the {@link Insert} class will be passed along to the1490 //* create activity if there are no contacts to show.1491 //*

1492 //* Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip1493 //* prompting the user when the contact doesn't exist.1494 //*/1495 //public static final String SHOW_OR_CREATE_CONTACT =1496 //"com.android.contacts.action.SHOW_OR_CREATE_CONTACT";1497 //

1498 ///**1499 //* Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new1500 //* contact if no matching contact found. Otherwise, default behavior is1501 //* to prompt user with dialog before creating.1502 //*

1503 //* Type: BOOLEAN1504 //*/1505 //public static final String EXTRA_FORCE_CREATE =1506 //"com.android.contacts.action.FORCE_CREATE";1507 //

1508 ///**1509 //* Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact1510 //* description to be shown when prompting user about creating a new1511 //* contact.1512 //*

1513 //* Type: STRING1514 //*/1515 //public static final String EXTRA_CREATE_DESCRIPTION =1516 //"com.android.contacts.action.CREATE_DESCRIPTION";1517 //

1518 ///**1519 //* Intents related to the Contacts app UI.1520 //*/1521 //public static final class UI {1522 ///**1523 //* The action for the default contacts list tab.1524 //*/1525 //public static final String LIST_DEFAULT =1526 //"com.android.contacts.action.LIST_DEFAULT";1527 //

1528 ///**1529 //* The action for the contacts list tab.1530 //*/1531 //public static final String LIST_GROUP_ACTION =1532 //"com.android.contacts.action.LIST_GROUP";1533 //

1534 ///**1535 //* When in LIST_GROUP_ACTION mode, this is the group to display.1536 //*/1537 //public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";1538 //

1539 ///**1540 //* The action for the all contacts list tab.1541 //*/1542 //public static final String LIST_ALL_CONTACTS_ACTION =1543 //"com.android.contacts.action.LIST_ALL_CONTACTS";1544 //

1545 ///**1546 //* The action for the contacts with phone numbers list tab.1547 //*/1548 //public static final String LIST_CONTACTS_WITH_PHONES_ACTION =1549 //"com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";1550 //

1551 ///**1552 //* The action for the starred contacts list tab.1553 //*/1554 //public static final String LIST_STARRED_ACTION =1555 //"com.android.contacts.action.LIST_STARRED";1556 //

1557 ///**1558 //* The action for the frequent contacts list tab.1559 //*/1560 //public static final String LIST_FREQUENT_ACTION =1561 //"com.android.contacts.action.LIST_FREQUENT";1562 //

1563 ///**1564 //* The action for the "strequent" contacts list tab. It first lists the starred1565 //* contacts in alphabetical order and then the frequent contacts in descending1566 //* order of the number of times they have been contacted.1567 //*/1568 //public static final String LIST_STREQUENT_ACTION =1569 //"com.android.contacts.action.LIST_STREQUENT";1570 //

1571 ///**1572 //* A key for to be used as an intent extra to set the activity1573 //* title to a custom String value.1574 //*/1575 //public static final String TITLE_EXTRA_KEY =1576 //"com.android.contacts.extra.TITLE_EXTRA";1577 //

1578 ///**1579 //* Activity Action: Display a filtered list of contacts1580 //*

1581 //* Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for1582 //* filtering1583 //*

1584 //* Output: Nothing.1585 //*/1586 //public static final String FILTER_CONTACTS_ACTION =1587 //"com.android.contacts.action.FILTER_CONTACTS";1588 //

1589 ///**1590 //* Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}1591 //* intents to supply the text on which to filter.1592 //*/1593 //public static final String FILTER_TEXT_EXTRA_KEY =1594 //"com.android.contacts.extra.FILTER_TEXT";1595 //}1596 //

1597 ///**1598 //* Convenience class that contains string constants used1599 //* to create contact {@link android.content.Intent Intents}.1600 //*/1601 //public static final class Insert {1602 ///** The action code to use when adding a contact */1603 //public static final String ACTION = Intent.ACTION_INSERT;1604 //

1605 ///**1606 //* If present, forces a bypass of quick insert mode.1607 //*/1608 //public static final String FULL_MODE = "full_mode";1609 //

1610 ///**1611 //* The extra field for the contact name.1612 //*

Type: String

1613 //*/1614 //public static final String NAME = "name";1615 //

1616 ///**1617 //* The extra field for the contact phonetic name.1618 //*

Type: String

1619 //*/1620 //public static final String PHONETIC_NAME = "phonetic_name";1621 //

1622 ///**1623 //* The extra field for the contact company.1624 //*

Type: String

1625 //*/1626 //public static final String COMPANY = "company";1627 //

1628 ///**1629 //* The extra field for the contact job title.1630 //*

Type: String

1631 //*/1632 //public static final String JOB_TITLE = "job_title";1633 //

1634 ///**1635 //* The extra field for the contact notes.1636 //*

Type: String

1637 //*/1638 //public static final String NOTES = "notes";1639 //

1640 ///**1641 //* The extra field for the contact phone number.1642 //*

Type: String

1643 //*/1644 //public static final String PHONE = "phone";1645 //

1646 ///**1647 //* The extra field for the contact phone number type.1648 //*

Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},1649 //* or a string specifying a custom label.

1650 //*/1651 //public static final String PHONE_TYPE = "phone_type";1652 //

1653 ///**1654 //* The extra field for the phone isprimary flag.1655 //*

Type: boolean

1656 //*/1657 //public static final String PHONE_ISPRIMARY = "phone_isprimary";1658 //

1659 ///**1660 //* The extra field for an optional second contact phone number.1661 //*

Type: String

1662 //*/1663 //public static final String SECONDARY_PHONE = "secondary_phone";1664 //

1665 ///**1666 //* The extra field for an optional second contact phone number type.1667 //*

Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},1668 //* or a string specifying a custom label.

1669 //*/1670 //public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";1671 //

1672 ///**1673 //* The extra field for an optional third contact phone number.1674 //*

Type: String

1675 //*/1676 //public static final String TERTIARY_PHONE = "tertiary_phone";1677 //

1678 ///**1679 //* The extra field for an optional third contact phone number type.1680 //*

Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},1681 //* or a string specifying a custom label.

1682 //*/1683 //public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";1684 //

1685 ///**1686 //* The extra field for the contact email address.1687 //*

Type: String

1688 //*/1689 //public static final String EMAIL = "email";1690 //

1691 ///**1692 //* The extra field for the contact email type.1693 //*

Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}1694 //* or a string specifying a custom label.

1695 //*/1696 //public static final String EMAIL_TYPE = "email_type";1697 //

1698 ///**1699 //* The extra field for the email isprimary flag.1700 //*

Type: boolean

1701 //*/1702 //public static final String EMAIL_ISPRIMARY = "email_isprimary";1703 //

1704 ///**1705 //* The extra field for an optional second contact email address.1706 //*

Type: String

1707 //*/1708 //public static final String SECONDARY_EMAIL = "secondary_email";1709 //

1710 ///**1711 //* The extra field for an optional second contact email type.1712 //*

Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}1713 //* or a string specifying a custom label.

1714 //*/1715 //public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";1716 //

1717 ///**1718 //* The extra field for an optional third contact email address.1719 //*

Type: String

1720 //*/1721 //public static final String TERTIARY_EMAIL = "tertiary_email";1722 //

1723 ///**1724 //* The extra field for an optional third contact email type.1725 //*

Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}1726 //* or a string specifying a custom label.

1727 //*/1728 //public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";1729 //

1730 ///**1731 //* The extra field for the contact postal address.1732 //*

Type: String

1733 //*/1734 //public static final String POSTAL = "postal";1735 //

1736 ///**1737 //* The extra field for the contact postal address type.1738 //*

Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}1739 //* or a string specifying a custom label.

1740 //*/1741 //public static final String POSTAL_TYPE = "postal_type";1742 //

1743 ///**1744 //* The extra field for the postal isprimary flag.1745 //*

Type: boolean

1746 //*/1747 //public static final String POSTAL_ISPRIMARY = "postal_isprimary";1748 //

1749 ///**1750 //* The extra field for an IM handle.1751 //*

Type: String

1752 //*/1753 //public static final String IM_HANDLE = "im_handle";1754 //

1755 ///**1756 //* The extra field for the IM protocol1757 //*

Type: the result of {@link Contacts.ContactMethods#encodePredefinedImProtocol}1758 //* or {@link Contacts.ContactMethods#encodeCustomImProtocol}.

1759 //*/1760 //public static final String IM_PROTOCOL = "im_protocol";1761 //

1762 ///**1763 //* The extra field for the IM isprimary flag.1764 //*

Type: boolean

1765 //*/1766 //public static final String IM_ISPRIMARY = "im_isprimary";1767 //}1768 //}

1769 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值