Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 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 at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * 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 and |
| 14 | * limitations under the License |
| 15 | */ |
| 16 | |
| 17 | package android.provider; |
| 18 | |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 19 | import android.accounts.Account; |
Fred Quintana | 0f4e1ab | 2009-07-09 17:20:59 -0700 | [diff] [blame] | 20 | import android.content.ContentProviderClient; |
| 21 | import android.content.ContentProviderOperation; |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 22 | import android.content.ContentResolver; |
| 23 | import android.content.ContentUris; |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 24 | import android.content.Context; |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 25 | import android.content.Intent; |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 26 | import android.content.res.Resources; |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 27 | import android.database.Cursor; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 28 | import android.graphics.BitmapFactory; |
| 29 | import android.net.Uri; |
Fred Quintana | 0f4e1ab | 2009-07-09 17:20:59 -0700 | [diff] [blame] | 30 | import android.os.RemoteException; |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 31 | import android.provider.ContactsContract.CommonDataKinds.GroupMembership; |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 32 | import android.text.TextUtils; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 33 | |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 34 | import java.io.ByteArrayInputStream; |
| 35 | import java.io.InputStream; |
| 36 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 37 | /** |
| 38 | * The contract between the contacts provider and applications. Contains definitions |
| 39 | * for the supported URIs and columns. |
| 40 | * |
Dmitri Plotnikov | 5f123bd | 2009-05-28 18:06:31 -0700 | [diff] [blame] | 41 | * @hide |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 42 | */ |
| 43 | public final class ContactsContract { |
| 44 | /** The authority for the contacts provider */ |
| 45 | public static final String AUTHORITY = "com.android.contacts"; |
| 46 | /** A content:// style uri to the authority for the contacts provider */ |
| 47 | public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); |
| 48 | |
Fred Quintana | 0f4e1ab | 2009-07-09 17:20:59 -0700 | [diff] [blame] | 49 | public interface SyncStateColumns extends SyncStateContract.Columns { |
| 50 | } |
| 51 | |
| 52 | public static final class SyncState { |
| 53 | /** |
| 54 | * This utility class cannot be instantiated |
| 55 | */ |
| 56 | private SyncState() {} |
| 57 | |
| 58 | public static final String CONTENT_DIRECTORY = |
| 59 | SyncStateContract.Constants.CONTENT_DIRECTORY; |
| 60 | |
| 61 | /** |
| 62 | * The content:// style URI for this table |
| 63 | */ |
| 64 | public static final Uri CONTENT_URI = |
| 65 | Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY); |
| 66 | |
| 67 | /** |
| 68 | * @see android.provider.SyncStateContract.Helpers#get |
| 69 | */ |
| 70 | public static byte[] get(ContentProviderClient provider, Account account) |
| 71 | throws RemoteException { |
| 72 | return SyncStateContract.Helpers.get(provider, CONTENT_URI, account); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @see android.provider.SyncStateContract.Helpers#set |
| 77 | */ |
| 78 | public static void set(ContentProviderClient provider, Account account, byte[] data) |
| 79 | throws RemoteException { |
| 80 | SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @see android.provider.SyncStateContract.Helpers#newSetOperation |
| 85 | */ |
| 86 | public static ContentProviderOperation newSetOperation(Account account, byte[] data) { |
| 87 | return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data); |
| 88 | } |
| 89 | } |
| 90 | |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 91 | /** |
| 92 | * Generic columns for use by sync adapters. The specific functions of |
| 93 | * these columns are private to the sync adapter. Other clients of the API |
| 94 | * should not attempt to either read or write this column. |
| 95 | */ |
| 96 | private interface BaseSyncColumns { |
| 97 | |
| 98 | /** Generic column for use by sync adapters. */ |
| 99 | public static final String SYNC1 = "sync1"; |
| 100 | /** Generic column for use by sync adapters. */ |
| 101 | public static final String SYNC2 = "sync2"; |
| 102 | /** Generic column for use by sync adapters. */ |
| 103 | public static final String SYNC3 = "sync3"; |
| 104 | /** Generic column for use by sync adapters. */ |
| 105 | public static final String SYNC4 = "sync4"; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Columns that appear when each row of a table belongs to a specific |
| 110 | * account, including sync information that an account may need. |
| 111 | */ |
| 112 | private interface SyncColumns extends BaseSyncColumns { |
| 113 | /** |
| 114 | * The name of the account instance to which this row belongs. |
| 115 | * <P>Type: TEXT</P> |
| 116 | */ |
| 117 | public static final String ACCOUNT_NAME = "account_name"; |
| 118 | |
| 119 | /** |
| 120 | * The type of account to which this row belongs, which when paired with |
| 121 | * {@link #ACCOUNT_NAME} identifies a specific account. |
| 122 | * <P>Type: TEXT</P> |
| 123 | */ |
| 124 | public static final String ACCOUNT_TYPE = "account_type"; |
| 125 | |
| 126 | /** |
| 127 | * String that uniquely identifies this row to its source account. |
| 128 | * <P>Type: TEXT</P> |
| 129 | */ |
| 130 | public static final String SOURCE_ID = "sourceid"; |
| 131 | |
| 132 | /** |
| 133 | * Version number that is updated whenever this row or its related data |
| 134 | * changes. |
| 135 | * <P>Type: INTEGER</P> |
| 136 | */ |
| 137 | public static final String VERSION = "version"; |
| 138 | |
| 139 | /** |
| 140 | * Flag indicating that {@link #VERSION} has changed, and this row needs |
| 141 | * to be synchronized by its owning account. |
| 142 | * <P>Type: INTEGER (boolean)</P> |
| 143 | */ |
| 144 | public static final String DIRTY = "dirty"; |
| 145 | } |
| 146 | |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 147 | public interface ContactOptionsColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 148 | /** |
| 149 | * The number of times a person has been contacted |
| 150 | * <P>Type: INTEGER</P> |
| 151 | */ |
| 152 | public static final String TIMES_CONTACTED = "times_contacted"; |
| 153 | |
| 154 | /** |
| 155 | * The last time a person was contacted. |
| 156 | * <P>Type: INTEGER</P> |
| 157 | */ |
| 158 | public static final String LAST_TIME_CONTACTED = "last_time_contacted"; |
| 159 | |
| 160 | /** |
| 161 | * Is the contact starred? |
| 162 | * <P>Type: INTEGER (boolean)</P> |
| 163 | */ |
| 164 | public static final String STARRED = "starred"; |
| 165 | |
| 166 | /** |
Dmitri Plotnikov | 693d50e | 2009-06-22 14:57:31 -0700 | [diff] [blame] | 167 | * A custom ringtone associated with a person. Not always present. |
| 168 | * <P>Type: TEXT (URI to the ringtone)</P> |
| 169 | */ |
| 170 | public static final String CUSTOM_RINGTONE = "custom_ringtone"; |
| 171 | |
| 172 | /** |
| 173 | * Whether the person should always be sent to voicemail. Not always |
| 174 | * present. |
| 175 | * <P>Type: INTEGER (0 for false, 1 for true)</P> |
| 176 | */ |
| 177 | public static final String SEND_TO_VOICEMAIL = "send_to_voicemail"; |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 180 | private interface ContactsColumns { |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 181 | /** |
| 182 | * The display name for the contact. |
| 183 | * <P>Type: TEXT</P> |
| 184 | */ |
| 185 | public static final String DISPLAY_NAME = "display_name"; |
Dmitri Plotnikov | 693d50e | 2009-06-22 14:57:31 -0700 | [diff] [blame] | 186 | |
| 187 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 188 | * Reference to the row in the data table holding the photo. |
| 189 | * <P>Type: INTEGER REFERENCES data(_id)</P> |
| 190 | */ |
| 191 | public static final String PHOTO_ID = "photo_id"; |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 192 | |
| 193 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 194 | * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 195 | * any {@link GroupMembership} for this contact. |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 196 | */ |
| 197 | public static final String IN_VISIBLE_GROUP = "in_visible_group"; |
Dmitri Plotnikov | 55048a9 | 2009-07-24 10:25:34 -0700 | [diff] [blame] | 198 | |
| 199 | /** |
| 200 | * Contact presence status. See {@link android.provider.Im.CommonPresenceColumns} |
| 201 | * for individual status definitions. |
| 202 | */ |
| 203 | public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS; |
| 204 | |
| 205 | /** |
Dmitri Plotnikov | 074fbfe | 2009-08-11 13:50:21 -0700 | [diff] [blame] | 206 | * An indicator of whether this contact has at least one phone number. "1" if there is |
| 207 | * at least one phone number, "0" otherwise. |
Dmitri Plotnikov | 55048a9 | 2009-07-24 10:25:34 -0700 | [diff] [blame] | 208 | * <P>Type: INTEGER</P> |
| 209 | */ |
Dmitri Plotnikov | 074fbfe | 2009-08-11 13:50:21 -0700 | [diff] [blame] | 210 | public static final String HAS_PHONE_NUMBER = "has_phone_number"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 214 | * Constants for the contacts table, which contains a record per group |
| 215 | * of raw contact representing the same person. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 216 | */ |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 217 | public static class Contacts implements BaseColumns, ContactsColumns, |
Dmitri Plotnikov | c9ec66b | 2009-08-05 12:11:22 -0700 | [diff] [blame] | 218 | ContactOptionsColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 219 | /** |
| 220 | * This utility class cannot be instantiated |
| 221 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 222 | private Contacts() {} |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 223 | |
| 224 | /** |
| 225 | * The content:// style URI for this table |
| 226 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 227 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts"); |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 228 | |
| 229 | /** |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 230 | * The content:// style URI for this table joined with useful data from |
Dmitri Plotnikov | 02c5b45 | 2009-07-22 15:13:08 -0700 | [diff] [blame] | 231 | * {@link Data}. |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 232 | */ |
| 233 | public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 234 | "contacts_summary"); |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 235 | |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 236 | /** |
| 237 | * The content:// style URI used for "type-to-filter" functionality on the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 238 | * {@link #CONTENT_SUMMARY_URI} URI. The filter string will be used to match |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 239 | * various parts of the contact name. The filter argument should be passed |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 240 | * as an additional path segment after this URI. |
| 241 | */ |
| 242 | public static final Uri CONTENT_SUMMARY_FILTER_URI = Uri.withAppendedPath( |
| 243 | CONTENT_SUMMARY_URI, "filter"); |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 244 | |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 245 | /** |
| 246 | * The content:// style URI for this table joined with useful data from |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 247 | * {@link Data}, filtered to include only starred contacts |
| 248 | * and the most frequently contacted contacts. |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 249 | */ |
| 250 | public static final Uri CONTENT_SUMMARY_STREQUENT_URI = Uri.withAppendedPath( |
| 251 | CONTENT_SUMMARY_URI, "strequent"); |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 252 | |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 253 | /** |
| 254 | * The content:// style URI used for "type-to-filter" functionality on the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 255 | * {@link #CONTENT_SUMMARY_STREQUENT_URI} URI. The filter string will be used to match |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 256 | * various parts of the contact name. The filter argument should be passed |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 257 | * as an additional path segment after this URI. |
| 258 | */ |
| 259 | public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = Uri.withAppendedPath( |
| 260 | CONTENT_SUMMARY_STREQUENT_URI, "filter"); |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 261 | |
Evan Millar | b926375 | 2009-07-15 11:32:19 -0700 | [diff] [blame] | 262 | public static final Uri CONTENT_SUMMARY_GROUP_URI = Uri.withAppendedPath( |
| 263 | CONTENT_SUMMARY_URI, "group"); |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 264 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 265 | * The MIME type of {@link #CONTENT_URI} providing a directory of |
| 266 | * people. |
| 267 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 268 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 269 | |
| 270 | /** |
| 271 | * The MIME type of a {@link #CONTENT_URI} subdirectory of a single |
| 272 | * person. |
| 273 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 274 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 275 | |
| 276 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 277 | * A sub-directory of a single contact that contains all of the constituent raw contact |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 278 | * {@link Data} rows. |
| 279 | */ |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 280 | public static final class Data implements BaseColumns, DataColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 281 | /** |
| 282 | * no public constructor since this is a utility class |
| 283 | */ |
| 284 | private Data() {} |
| 285 | |
| 286 | /** |
| 287 | * The directory twig for this sub-table |
| 288 | */ |
| 289 | public static final String CONTENT_DIRECTORY = "data"; |
| 290 | } |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 291 | |
| 292 | /** |
| 293 | * A sub-directory of a single contact aggregate that contains all aggregation suggestions |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 294 | * (other contacts). The aggregation suggestions are computed based on approximate |
| 295 | * data matches with this contact. |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 296 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 297 | public static final class AggregationSuggestions implements BaseColumns, ContactsColumns { |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 298 | /** |
| 299 | * No public constructor since this is a utility class |
| 300 | */ |
| 301 | private AggregationSuggestions() {} |
| 302 | |
| 303 | /** |
| 304 | * The directory twig for this sub-table |
| 305 | */ |
| 306 | public static final String CONTENT_DIRECTORY = "suggestions"; |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 307 | } |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 308 | |
| 309 | /** |
| 310 | * Returns a URI that can be used to retrieve the contact's default photo. |
| 311 | * |
| 312 | * @param contactUri the contact whose photo should be used |
| 313 | */ |
| 314 | public static Uri getPhotoUri(ContentResolver cr, Uri contactUri) { |
Dmitri Plotnikov | 1c1629d | 2009-08-20 08:13:46 -0700 | [diff] [blame^] | 315 | |
| 316 | // TODO remove try/catch block as soon as eclair-dev is merged in eclair |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 317 | try { |
Dmitri Plotnikov | 1c1629d | 2009-08-20 08:13:46 -0700 | [diff] [blame^] | 318 | long photoId = -1; |
| 319 | Cursor cursor = cr.query(contactUri, new String[] {Contacts.PHOTO_ID}, |
| 320 | null, null, null); |
| 321 | try { |
| 322 | if (!cursor.moveToNext()) { |
| 323 | return null; |
| 324 | } |
| 325 | |
| 326 | if (cursor.isNull(0)) { |
| 327 | return null; |
| 328 | } |
| 329 | |
| 330 | photoId = cursor.getLong(0); |
| 331 | } finally { |
| 332 | cursor.close(); |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 333 | } |
| 334 | |
Dmitri Plotnikov | 1c1629d | 2009-08-20 08:13:46 -0700 | [diff] [blame^] | 335 | return ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, photoId); |
| 336 | } catch (Exception e) { |
| 337 | return null; |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 338 | } |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Opens an InputStream for the person's default photo and returns the |
| 343 | * photo as a Bitmap stream. |
| 344 | * |
| 345 | * @param contactUri the contact whose photo should be used |
| 346 | */ |
| 347 | public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri contactUri) { |
| 348 | Uri photoUri = getPhotoUri(cr, contactUri); |
Dmitri Plotnikov | 1c1629d | 2009-08-20 08:13:46 -0700 | [diff] [blame^] | 349 | if (photoUri == null) { |
| 350 | return null; |
| 351 | } |
Dmitri Plotnikov | 3c513ed | 2009-08-19 15:56:30 -0700 | [diff] [blame] | 352 | Cursor cursor = cr.query(photoUri, |
| 353 | new String[]{ContactsContract.CommonDataKinds.Photo.PHOTO}, null, null, null); |
| 354 | try { |
| 355 | if (!cursor.moveToNext()) { |
| 356 | return null; |
| 357 | } |
| 358 | byte[] data = cursor.getBlob(0); |
| 359 | if (data == null) { |
| 360 | return null; |
| 361 | } |
| 362 | return new ByteArrayInputStream(data); |
| 363 | } finally { |
| 364 | cursor.close(); |
| 365 | } |
| 366 | } |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 367 | } |
| 368 | |
Dmitri Plotnikov | 2365ded | 2009-07-27 09:36:09 -0700 | [diff] [blame] | 369 | private interface RawContactsColumns { |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 370 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 371 | * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this |
| 372 | * data belongs to. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 373 | * <P>Type: INTEGER</P> |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 374 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 375 | public static final String CONTACT_ID = "contact_id"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 376 | |
| 377 | /** |
Dmitri Plotnikov | 2365ded | 2009-07-27 09:36:09 -0700 | [diff] [blame] | 378 | * Flag indicating that this {@link RawContacts} entry and its children has |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 379 | * been restricted to specific platform apps. |
| 380 | * <P>Type: INTEGER (boolean)</P> |
| 381 | * |
| 382 | * @hide until finalized in future platform release |
| 383 | */ |
| 384 | public static final String IS_RESTRICTED = "is_restricted"; |
| 385 | |
| 386 | /** |
| 387 | * The aggregation mode for this contact. |
| 388 | * <P>Type: INTEGER</P> |
| 389 | */ |
| 390 | public static final String AGGREGATION_MODE = "aggregation_mode"; |
Dmitri Plotnikov | d5f56d1 | 2009-07-27 09:26:05 -0700 | [diff] [blame] | 391 | |
| 392 | /** |
| 393 | * The "deleted" flag: "0" by default, "1" if the row has been marked |
| 394 | * for deletion. When {@link android.content.ContentResolver#delete} is |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 395 | * called on a raw contact, it is marked for deletion and removed from its |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 396 | * aggregate contact. The sync adaptor deletes the raw contact on the server and |
Dmitri Plotnikov | d5f56d1 | 2009-07-27 09:26:05 -0700 | [diff] [blame] | 397 | * then calls ContactResolver.delete once more, this time passing the |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 398 | * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. |
Dmitri Plotnikov | d5f56d1 | 2009-07-27 09:26:05 -0700 | [diff] [blame] | 399 | * <P>Type: INTEGER</P> |
| 400 | */ |
| 401 | public static final String DELETED = "deleted"; |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | /** |
Dmitri Plotnikov | 2365ded | 2009-07-27 09:36:09 -0700 | [diff] [blame] | 405 | * Constants for the raw_contacts table, which contains the base contact |
| 406 | * information per sync source. Sync adapters and contact management apps |
| 407 | * are the primary consumers of this API. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 408 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 409 | public static final class RawContacts implements BaseColumns, RawContactsColumns, |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 410 | ContactOptionsColumns, SyncColumns { |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 411 | /** |
| 412 | * This utility class cannot be instantiated |
| 413 | */ |
Dmitri Plotnikov | 2365ded | 2009-07-27 09:36:09 -0700 | [diff] [blame] | 414 | private RawContacts() { |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 418 | * The content:// style URI for this table |
| 419 | */ |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 420 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts"); |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 421 | |
| 422 | /** |
| 423 | * The content:// style URL for filtering people by email address. The |
| 424 | * filter argument should be passed as an additional path segment after |
| 425 | * this URI. |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 426 | * |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 427 | * @hide |
| 428 | */ |
Dmitri Plotnikov | d4e0b57 | 2009-08-06 20:19:29 -0700 | [diff] [blame] | 429 | @Deprecated |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 430 | public static final Uri CONTENT_FILTER_EMAIL_URI = |
| 431 | Uri.withAppendedPath(CONTENT_URI, "filter_email"); |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 432 | |
| 433 | /** |
| 434 | * The MIME type of {@link #CONTENT_URI} providing a directory of |
| 435 | * people. |
| 436 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 437 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 438 | |
| 439 | /** |
| 440 | * The MIME type of a {@link #CONTENT_URI} subdirectory of a single |
| 441 | * person. |
| 442 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 443 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 444 | |
| 445 | /** |
Dmitri Plotnikov | d5f56d1 | 2009-07-27 09:26:05 -0700 | [diff] [blame] | 446 | * Query parameter that can be passed with the {@link #CONTENT_URI} URI |
| 447 | * to the {@link android.content.ContentResolver#delete} method to |
| 448 | * indicate that the raw contact can be deleted physically, rather than |
| 449 | * merely marked as deleted. |
| 450 | */ |
| 451 | public static final String DELETE_PERMANENTLY = "delete_permanently"; |
| 452 | |
| 453 | /** |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 454 | * Aggregation mode: aggregate asynchronously. |
| 455 | */ |
| 456 | public static final int AGGREGATION_MODE_DEFAULT = 0; |
| 457 | |
| 458 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 459 | * Aggregation mode: aggregate at the time the raw contact is inserted/updated. |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 460 | */ |
| 461 | public static final int AGGREGATION_MODE_IMMEDITATE = 1; |
| 462 | |
| 463 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 464 | * Aggregation mode: never aggregate this raw contact (note that the raw contact will not |
Dmitri Plotnikov | c991bfc | 2009-07-14 17:27:31 -0700 | [diff] [blame] | 465 | * have a corresponding Aggregate and therefore will not be included in Aggregates |
| 466 | * query results.) |
| 467 | */ |
| 468 | public static final int AGGREGATION_MODE_DISABLED = 2; |
| 469 | |
| 470 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 471 | * A sub-directory of a single raw contact that contains all of their {@link Data} rows. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 472 | * To access this directory append |
| 473 | */ |
| 474 | public static final class Data implements BaseColumns, DataColumns { |
| 475 | /** |
| 476 | * no public constructor since this is a utility class |
| 477 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 478 | private Data() { |
| 479 | } |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 480 | |
| 481 | /** |
| 482 | * The directory twig for this sub-table |
| 483 | */ |
| 484 | public static final String CONTENT_DIRECTORY = "data"; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | private interface DataColumns { |
| 489 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 490 | * The package name to use when creating {@link Resources} objects for |
| 491 | * this data row. This value is only designed for use when building user |
| 492 | * interfaces, and should not be used to infer the owner. |
| 493 | */ |
| 494 | public static final String RES_PACKAGE = "res_package"; |
| 495 | |
| 496 | /** |
| 497 | * The MIME type of the item represented by this row. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 498 | */ |
| 499 | public static final String MIMETYPE = "mimetype"; |
| 500 | |
| 501 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 502 | * A reference to the {@link RawContacts#_ID} |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 503 | * that this data belongs to. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 504 | */ |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 505 | public static final String RAW_CONTACT_ID = "raw_contact_id"; |
| 506 | |
Evan Millar | ab5742d | 2009-06-02 16:21:45 -0700 | [diff] [blame] | 507 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 508 | * Whether this is the primary entry of its kind for the raw contact it belongs to |
Evan Millar | ab5742d | 2009-06-02 16:21:45 -0700 | [diff] [blame] | 509 | * <P>Type: INTEGER (if set, non-0 means true)</P> |
| 510 | */ |
| 511 | public static final String IS_PRIMARY = "is_primary"; |
| 512 | |
| 513 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 514 | * Whether this is the primary entry of its kind for the aggregate |
| 515 | * contact it belongs to. Any data record that is "super primary" must |
| 516 | * also be "primary". |
Evan Millar | ab5742d | 2009-06-02 16:21:45 -0700 | [diff] [blame] | 517 | * <P>Type: INTEGER (if set, non-0 means true)</P> |
| 518 | */ |
| 519 | public static final String IS_SUPER_PRIMARY = "is_super_primary"; |
| 520 | |
Jeff Sharkey | 28b68e5 | 2009-06-10 15:26:58 -0700 | [diff] [blame] | 521 | /** |
Fred Quintana | c933fb6 | 2009-06-11 12:14:40 -0700 | [diff] [blame] | 522 | * The version of this data record. This is a read-only value. The data column is |
| 523 | * guaranteed to not change without the version going up. This value is monotonically |
| 524 | * increasing. |
| 525 | * <P>Type: INTEGER</P> |
| 526 | */ |
| 527 | public static final String DATA_VERSION = "data_version"; |
| 528 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 529 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 530 | public static final String DATA1 = "data1"; |
| 531 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 532 | public static final String DATA2 = "data2"; |
| 533 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 534 | public static final String DATA3 = "data3"; |
| 535 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 536 | public static final String DATA4 = "data4"; |
| 537 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 538 | public static final String DATA5 = "data5"; |
| 539 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 540 | public static final String DATA6 = "data6"; |
| 541 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 542 | public static final String DATA7 = "data7"; |
| 543 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 544 | public static final String DATA8 = "data8"; |
| 545 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 546 | public static final String DATA9 = "data9"; |
| 547 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 548 | public static final String DATA10 = "data10"; |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 549 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 550 | public static final String DATA11 = "data11"; |
| 551 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 552 | public static final String DATA12 = "data12"; |
| 553 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 554 | public static final String DATA13 = "data13"; |
| 555 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 556 | public static final String DATA14 = "data14"; |
| 557 | /** Generic data column, the meaning is {@link #MIMETYPE} specific */ |
| 558 | public static final String DATA15 = "data15"; |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 559 | |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 560 | /** Generic column for use by sync adapters. */ |
| 561 | public static final String SYNC1 = "data_sync1"; |
| 562 | /** Generic column for use by sync adapters. */ |
| 563 | public static final String SYNC2 = "data_sync2"; |
| 564 | /** Generic column for use by sync adapters. */ |
| 565 | public static final String SYNC3 = "data_sync3"; |
| 566 | /** Generic column for use by sync adapters. */ |
| 567 | public static final String SYNC4 = "data_sync4"; |
| 568 | |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 569 | /** |
Dmitri Plotnikov | 507f160 | 2009-08-10 17:37:36 -0700 | [diff] [blame] | 570 | * An optional insert, update or delete URI parameter that determines if |
| 571 | * the corresponding raw contact should be marked as dirty. The default |
Dmitri Plotnikov | 91e4e85 | 2009-08-03 18:06:29 -0700 | [diff] [blame] | 572 | * value is true. |
| 573 | */ |
| 574 | public static final String MARK_AS_DIRTY = "mark_as_dirty"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 578 | * Constants for the data table, which contains data points tied to a raw contact. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 579 | * For example, a phone number or email address. Each row in this table contains a type |
| 580 | * definition and some generic columns. Each data type can define the meaning for each of |
| 581 | * the generic columns. |
| 582 | */ |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 583 | public static final class Data implements BaseColumns, DataColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 584 | /** |
| 585 | * This utility class cannot be instantiated |
| 586 | */ |
| 587 | private Data() {} |
| 588 | |
| 589 | /** |
| 590 | * The content:// style URI for this table |
| 591 | */ |
| 592 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data"); |
| 593 | |
| 594 | /** |
| 595 | * The MIME type of {@link #CONTENT_URI} providing a directory of data. |
| 596 | */ |
| 597 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data"; |
| 598 | } |
| 599 | |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 600 | private interface PhoneLookupColumns { |
| 601 | /** |
| 602 | * The phone number as the user entered it. |
| 603 | * <P>Type: TEXT</P> |
| 604 | */ |
| 605 | public static final String NUMBER = "number"; |
| 606 | |
| 607 | /** |
| 608 | * The type of phone number, for example Home or Work. |
| 609 | * <P>Type: INTEGER</P> |
| 610 | */ |
| 611 | public static final String TYPE = "type"; |
| 612 | |
| 613 | /** |
| 614 | * The user defined label for the phone number. |
| 615 | * <P>Type: TEXT</P> |
| 616 | */ |
| 617 | public static final String LABEL = "label"; |
| 618 | } |
| 619 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 620 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 621 | * A table that represents the result of looking up a phone number, for |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 622 | * example for caller ID. To perform a lookup you must append the number you |
| 623 | * want to find to {@link #CONTENT_FILTER_URI}. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 624 | */ |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 625 | public static final class PhoneLookup implements BaseColumns, PhoneLookupColumns, |
| 626 | ContactsColumns, ContactOptionsColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 627 | /** |
| 628 | * This utility class cannot be instantiated |
| 629 | */ |
| 630 | private PhoneLookup() {} |
| 631 | |
| 632 | /** |
| 633 | * The content:// style URI for this table. Append the phone number you want to lookup |
| 634 | * to this URI and query it to perform a lookup. For example: |
| 635 | * |
| 636 | * {@code |
| 637 | * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); |
| 638 | * } |
| 639 | */ |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 640 | public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI, |
| 641 | "phone_lookup"); |
| 642 | } |
| 643 | |
| 644 | /** |
| 645 | * Additional data mixed in with {@link Im.CommonPresenceColumns} to link |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 646 | * back to specific {@link ContactsContract.Contacts#_ID} entries. |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 647 | */ |
| 648 | private interface PresenceColumns { |
Dmitri Plotnikov | 55048a9 | 2009-07-24 10:25:34 -0700 | [diff] [blame] | 649 | |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 650 | /** |
Dmitri Plotnikov | 55048a9 | 2009-07-24 10:25:34 -0700 | [diff] [blame] | 651 | * The unique ID for a row. |
| 652 | * <P>Type: INTEGER (long)</P> |
| 653 | */ |
| 654 | public static final String _ID = "presence_id"; |
| 655 | |
| 656 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 657 | * Reference to the {@link RawContacts#_ID} this presence references. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 658 | * <P>Type: INTEGER</P> |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 659 | */ |
Dmitri Plotnikov | d4e0b57 | 2009-08-06 20:19:29 -0700 | [diff] [blame] | 660 | public static final String RAW_CONTACT_ID = "presence_raw_contact_id"; |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 661 | |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 662 | /** |
| 663 | * Reference to the {@link Data#_ID} entry that owns this presence. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 664 | * <P>Type: INTEGER</P> |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 665 | */ |
Dmitri Plotnikov | d4e0b57 | 2009-08-06 20:19:29 -0700 | [diff] [blame] | 666 | public static final String DATA_ID = "presence_data_id"; |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 667 | |
| 668 | /** |
| 669 | * The IM service the presence is coming from. Formatted using either |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 670 | * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or |
| 671 | * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}. |
| 672 | * <P>Type: TEXT</P> |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 673 | */ |
| 674 | public static final String IM_PROTOCOL = "im_protocol"; |
| 675 | |
| 676 | /** |
| 677 | * The IM handle the presence item is for. The handle is scoped to the |
| 678 | * {@link #IM_PROTOCOL}. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 679 | * <P>Type: TEXT</P> |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 680 | */ |
| 681 | public static final String IM_HANDLE = "im_handle"; |
| 682 | |
| 683 | /** |
| 684 | * The IM account for the local user that the presence data came from. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 685 | * <P>Type: TEXT</P> |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 686 | */ |
| 687 | public static final String IM_ACCOUNT = "im_account"; |
| 688 | } |
| 689 | |
Dmitri Plotnikov | 55048a9 | 2009-07-24 10:25:34 -0700 | [diff] [blame] | 690 | public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns { |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 691 | /** |
| 692 | * This utility class cannot be instantiated |
| 693 | */ |
| 694 | private Presence() { |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * The content:// style URI for this table |
| 699 | */ |
| 700 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); |
| 701 | |
| 702 | /** |
| 703 | * Gets the resource ID for the proper presence icon. |
| 704 | * |
| 705 | * @param status the status to get the icon for |
| 706 | * @return the resource ID for the proper presence icon |
| 707 | */ |
| 708 | public static final int getPresenceIconResourceId(int status) { |
| 709 | switch (status) { |
| 710 | case AVAILABLE: |
| 711 | return android.R.drawable.presence_online; |
| 712 | case IDLE: |
| 713 | case AWAY: |
| 714 | return android.R.drawable.presence_away; |
| 715 | case DO_NOT_DISTURB: |
| 716 | return android.R.drawable.presence_busy; |
| 717 | case INVISIBLE: |
| 718 | return android.R.drawable.presence_invisible; |
| 719 | case OFFLINE: |
| 720 | default: |
| 721 | return android.R.drawable.presence_offline; |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | /** |
Evan Millar | c043752 | 2009-06-23 17:31:05 -0700 | [diff] [blame] | 726 | * Returns the precedence of the status code the higher number being the higher precedence. |
| 727 | * |
| 728 | * @param status The status code. |
| 729 | * @return An integer representing the precedence, 0 being the lowest. |
| 730 | */ |
| 731 | public static final int getPresencePrecedence(int status) { |
| 732 | // Keep this function here incase we want to enforce a different precedence than the |
| 733 | // natural order of the status constants. |
| 734 | return status; |
| 735 | } |
| 736 | |
| 737 | /** |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 738 | * The MIME type of {@link #CONTENT_URI} providing a directory of |
| 739 | * presence details. |
| 740 | */ |
| 741 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence"; |
| 742 | |
| 743 | /** |
| 744 | * The MIME type of a {@link #CONTENT_URI} subdirectory of a single |
| 745 | * presence detail. |
| 746 | */ |
| 747 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 748 | } |
| 749 | |
| 750 | /** |
| 751 | * Container for definitions of common data types stored in the {@link Data} table. |
| 752 | */ |
| 753 | public static final class CommonDataKinds { |
| 754 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 755 | * The {@link Data#RES_PACKAGE} value for common data that should be |
| 756 | * shown using a default style. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 757 | */ |
| 758 | public static final String PACKAGE_COMMON = "common"; |
| 759 | |
| 760 | /** |
| 761 | * Columns common across the specific types. |
| 762 | */ |
| 763 | private interface BaseCommonColumns { |
| 764 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 765 | * The package name to use when creating {@link Resources} objects for |
| 766 | * this data row. This value is only designed for use when building user |
| 767 | * interfaces, and should not be used to infer the owner. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 768 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 769 | public static final String RES_PACKAGE = "res_package"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 770 | |
| 771 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 772 | * The MIME type of the item represented by this row. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 773 | */ |
| 774 | public static final String MIMETYPE = "mimetype"; |
| 775 | |
| 776 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 777 | * The {@link RawContacts#_ID} that this data belongs to. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 778 | */ |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 779 | public static final String RAW_CONTACT_ID = "raw_contact_id"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | /** |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 783 | * The base types that all "Typed" data kinds support. |
| 784 | */ |
| 785 | public interface BaseTypes { |
| 786 | |
| 787 | /** |
| 788 | * A custom type. The custom label should be supplied by user. |
| 789 | */ |
| 790 | public static int TYPE_CUSTOM = 0; |
| 791 | } |
| 792 | |
| 793 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 794 | * Columns common across the specific types. |
| 795 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 796 | private interface CommonColumns extends BaseTypes{ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 797 | /** |
| 798 | * The type of data, for example Home or Work. |
| 799 | * <P>Type: INTEGER</P> |
| 800 | */ |
| 801 | public static final String TYPE = "data1"; |
| 802 | |
| 803 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 804 | * The data for the contact method. |
| 805 | * <P>Type: TEXT</P> |
| 806 | */ |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 807 | public static final String DATA = "data2"; |
| 808 | |
| 809 | /** |
| 810 | * The user defined label for the the contact method. |
| 811 | * <P>Type: TEXT</P> |
| 812 | */ |
| 813 | public static final String LABEL = "data3"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | /** |
| 817 | * Parts of the name. |
| 818 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 819 | public static final class StructuredName implements BaseCommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 820 | private StructuredName() {} |
| 821 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 822 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 823 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name"; |
| 824 | |
| 825 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 826 | * The given name for the contact. |
| 827 | * <P>Type: TEXT</P> |
| 828 | */ |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 829 | public static final String GIVEN_NAME = "data1"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 830 | |
| 831 | /** |
| 832 | * The family name for the contact. |
| 833 | * <P>Type: TEXT</P> |
| 834 | */ |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 835 | public static final String FAMILY_NAME = "data2"; |
| 836 | |
| 837 | /** |
| 838 | * The contact's honorific prefix, e.g. "Sir" |
| 839 | * <P>Type: TEXT</P> |
| 840 | */ |
| 841 | public static final String PREFIX = "data3"; |
| 842 | |
| 843 | /** |
| 844 | * The contact's middle name |
| 845 | * <P>Type: TEXT</P> |
| 846 | */ |
| 847 | public static final String MIDDLE_NAME = "data4"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 848 | |
| 849 | /** |
| 850 | * The contact's honorific suffix, e.g. "Jr" |
| 851 | */ |
| 852 | public static final String SUFFIX = "data5"; |
| 853 | |
| 854 | /** |
| 855 | * The phonetic version of the given name for the contact. |
| 856 | * <P>Type: TEXT</P> |
| 857 | */ |
| 858 | public static final String PHONETIC_GIVEN_NAME = "data6"; |
| 859 | |
| 860 | /** |
| 861 | * The phonetic version of the additional name for the contact. |
| 862 | * <P>Type: TEXT</P> |
| 863 | */ |
| 864 | public static final String PHONETIC_MIDDLE_NAME = "data7"; |
| 865 | |
| 866 | /** |
| 867 | * The phonetic version of the family name for the contact. |
| 868 | * <P>Type: TEXT</P> |
| 869 | */ |
| 870 | public static final String PHONETIC_FAMILY_NAME = "data8"; |
| 871 | |
| 872 | /** |
| 873 | * The name that should be used to display the contact. |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 874 | * <i>Unstructured component of the name should be consistent with |
| 875 | * its structured representation.</i> |
| 876 | * <p> |
| 877 | * Type: TEXT |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 878 | */ |
| 879 | public static final String DISPLAY_NAME = "data9"; |
| 880 | } |
| 881 | |
| 882 | /** |
| 883 | * A nickname. |
| 884 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 885 | public static final class Nickname implements CommonColumns, BaseCommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 886 | private Nickname() {} |
| 887 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 888 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 889 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname"; |
| 890 | |
Evan Millar | 78e79ad | 2009-06-08 10:24:44 -0700 | [diff] [blame] | 891 | public static final int TYPE_DEFAULT = 1; |
| 892 | public static final int TYPE_OTHER_NAME = 2; |
| 893 | public static final int TYPE_MAINDEN_NAME = 3; |
| 894 | public static final int TYPE_SHORT_NAME = 4; |
| 895 | public static final int TYPE_INITIALS = 5; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 896 | |
| 897 | /** |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 898 | * The name itself |
| 899 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 900 | public static final String NAME = DATA; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | /** |
| 904 | * Common data definition for telephone numbers. |
| 905 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 906 | public static final class Phone implements BaseCommonColumns, CommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 907 | private Phone() {} |
| 908 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 909 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 910 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone"; |
| 911 | |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 912 | /** |
| 913 | * The MIME type of {@link #CONTENT_URI} providing a directory of |
| 914 | * phones. |
| 915 | */ |
| 916 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone"; |
| 917 | |
| 918 | /** |
| 919 | * The content:// style URI for all data records of the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 920 | * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 921 | * associated raw contact and aggregate contact data. |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 922 | */ |
| 923 | public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, |
| 924 | "phones"); |
| 925 | |
| 926 | /** |
| 927 | * The content:// style URI for filtering data records of the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 928 | * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 929 | * associated raw contact and aggregate contact data. The filter argument should |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 930 | * be passed as an additional path segment after this URI. |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 931 | */ |
| 932 | public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, |
| 933 | "filter"); |
| 934 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 935 | public static final int TYPE_HOME = 1; |
| 936 | public static final int TYPE_MOBILE = 2; |
| 937 | public static final int TYPE_WORK = 3; |
| 938 | public static final int TYPE_FAX_WORK = 4; |
| 939 | public static final int TYPE_FAX_HOME = 5; |
| 940 | public static final int TYPE_PAGER = 6; |
| 941 | public static final int TYPE_OTHER = 7; |
Fred Quintana | 3f86715 | 2009-08-03 11:43:16 -0700 | [diff] [blame] | 942 | public static final int TYPE_CALLBACK = 8; |
| 943 | public static final int TYPE_CAR = 9; |
| 944 | public static final int TYPE_COMPANY_MAIN = 10; |
| 945 | public static final int TYPE_ISDN = 11; |
| 946 | public static final int TYPE_MAIN = 12; |
| 947 | public static final int TYPE_OTHER_FAX = 13; |
| 948 | public static final int TYPE_RADIO = 14; |
| 949 | public static final int TYPE_TELEX = 15; |
| 950 | public static final int TYPE_TTY_TDD = 16; |
| 951 | public static final int TYPE_WORK_MOBILE = 17; |
| 952 | public static final int TYPE_WORK_PAGER = 18; |
| 953 | public static final int TYPE_ASSISTANT = 19; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 954 | |
| 955 | /** |
| 956 | * The phone number as the user entered it. |
| 957 | * <P>Type: TEXT</P> |
| 958 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 959 | public static final String NUMBER = DATA; |
Dmitri Plotnikov | 9303295 | 2009-08-19 11:26:57 -0700 | [diff] [blame] | 960 | |
| 961 | public static final CharSequence getDisplayLabel(Context context, int type, |
| 962 | CharSequence label, CharSequence[] labelArray) { |
| 963 | CharSequence display = ""; |
| 964 | |
| 965 | if (type != Phone.TYPE_CUSTOM) { |
| 966 | CharSequence[] labels = labelArray != null? labelArray |
| 967 | : context.getResources().getTextArray( |
| 968 | com.android.internal.R.array.phoneTypes); |
| 969 | try { |
| 970 | display = labels[type - 1]; |
| 971 | } catch (ArrayIndexOutOfBoundsException e) { |
| 972 | display = labels[Phone.TYPE_CUSTOM]; |
| 973 | } |
| 974 | } else { |
| 975 | if (!TextUtils.isEmpty(label)) { |
| 976 | display = label; |
| 977 | } |
| 978 | } |
| 979 | return display; |
| 980 | } |
| 981 | |
| 982 | public static final CharSequence getDisplayLabel(Context context, int type, |
| 983 | CharSequence label) { |
| 984 | return getDisplayLabel(context, type, label, null); |
| 985 | } |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 986 | } |
| 987 | |
| 988 | /** |
| 989 | * Common data definition for email addresses. |
| 990 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 991 | public static final class Email implements BaseCommonColumns, CommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 992 | private Email() {} |
| 993 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 994 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 995 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email"; |
| 996 | |
Dmitri Plotnikov | d4e0b57 | 2009-08-06 20:19:29 -0700 | [diff] [blame] | 997 | /** |
| 998 | * The content:// style URI for all data records of the |
| 999 | * {@link Email#CONTENT_ITEM_TYPE} MIME type, combined with the |
| 1000 | * associated raw contact and aggregate contact data. |
| 1001 | */ |
| 1002 | public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, |
| 1003 | "emails"); |
| 1004 | |
| 1005 | /** |
| 1006 | * The content:// style URL for filtering data rows by email address. The |
| 1007 | * filter argument should be passed as an additional path segment after |
| 1008 | * this URI. |
| 1009 | */ |
| 1010 | public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI, |
| 1011 | "filter"); |
| 1012 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1013 | public static final int TYPE_HOME = 1; |
| 1014 | public static final int TYPE_WORK = 2; |
| 1015 | public static final int TYPE_OTHER = 3; |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1016 | |
| 1017 | /** |
| 1018 | * The display name for the email address |
| 1019 | * <P>Type: TEXT</P> |
| 1020 | */ |
| 1021 | public static final String DISPLAY_NAME = "data4"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1022 | } |
| 1023 | |
| 1024 | /** |
| 1025 | * Common data definition for postal addresses. |
| 1026 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1027 | public static final class StructuredPostal implements BaseCommonColumns, CommonColumns { |
| 1028 | private StructuredPostal() { |
| 1029 | } |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1030 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1031 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1032 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address"; |
| 1033 | |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 1034 | /** |
| 1035 | * The MIME type of {@link #CONTENT_URI} providing a directory of |
| 1036 | * postal addresses. |
| 1037 | */ |
| 1038 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address"; |
| 1039 | |
| 1040 | /** |
| 1041 | * The content:// style URI for all data records of the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1042 | * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type. |
Evan Millar | 161dd86 | 2009-06-12 16:02:43 -0700 | [diff] [blame] | 1043 | */ |
| 1044 | public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, |
| 1045 | "postals"); |
| 1046 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1047 | public static final int TYPE_HOME = 1; |
| 1048 | public static final int TYPE_WORK = 2; |
| 1049 | public static final int TYPE_OTHER = 3; |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1050 | |
| 1051 | /** |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1052 | * The full, unstructured postal address. <i>This field must be |
| 1053 | * consistent with any structured data.</i> |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1054 | * <p> |
| 1055 | * Type: TEXT |
| 1056 | */ |
| 1057 | public static final String FORMATTED_ADDRESS = DATA; |
| 1058 | |
| 1059 | /** |
| 1060 | * The agent who actually receives the mail. Used in work addresses. |
| 1061 | * Also for 'in care of' or 'c/o'. |
| 1062 | * <p> |
| 1063 | * Type: TEXT |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1064 | * @deprecated since this isn't supported by gd:structuredPostalAddress |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1065 | */ |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1066 | @Deprecated |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1067 | public static final String AGENT = "data4"; |
| 1068 | |
| 1069 | /** |
| 1070 | * Used in places where houses or buildings have names (and not |
| 1071 | * necessarily numbers), eg. "The Pillars". |
| 1072 | * <p> |
| 1073 | * Type: TEXT |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1074 | * @deprecated since this isn't supported by gd:structuredPostalAddress |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1075 | */ |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1076 | @Deprecated |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1077 | public static final String HOUSENAME = "data5"; |
| 1078 | |
| 1079 | /** |
| 1080 | * Can be street, avenue, road, etc. This element also includes the |
| 1081 | * house number and room/apartment/flat/floor number. |
| 1082 | * <p> |
| 1083 | * Type: TEXT |
| 1084 | */ |
| 1085 | public static final String STREET = "data6"; |
| 1086 | |
| 1087 | /** |
| 1088 | * Covers actual P.O. boxes, drawers, locked bags, etc. This is |
| 1089 | * usually but not always mutually exclusive with street. |
| 1090 | * <p> |
| 1091 | * Type: TEXT |
| 1092 | */ |
| 1093 | public static final String POBOX = "data7"; |
| 1094 | |
| 1095 | /** |
| 1096 | * This is used to disambiguate a street address when a city |
| 1097 | * contains more than one street with the same name, or to specify a |
| 1098 | * small place whose mail is routed through a larger postal town. In |
| 1099 | * China it could be a county or a minor city. |
| 1100 | * <p> |
| 1101 | * Type: TEXT |
| 1102 | */ |
Jeff Sharkey | ef348c7 | 2009-07-26 14:14:34 -0700 | [diff] [blame] | 1103 | public static final String NEIGHBORHOOD = "data8"; |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1104 | |
| 1105 | /** |
| 1106 | * Can be city, village, town, borough, etc. This is the postal town |
| 1107 | * and not necessarily the place of residence or place of business. |
| 1108 | * <p> |
| 1109 | * Type: TEXT |
| 1110 | */ |
| 1111 | public static final String CITY = "data9"; |
| 1112 | |
| 1113 | /** |
| 1114 | * Handles administrative districts such as U.S. or U.K. counties |
| 1115 | * that are not used for mail addressing purposes. Subregion is not |
| 1116 | * intended for delivery addresses. |
| 1117 | * <p> |
| 1118 | * Type: TEXT |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1119 | * @deprecated since this isn't supported by gd:structuredPostalAddress |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1120 | */ |
Jeff Sharkey | 62b83b7 | 2009-08-11 17:33:48 -0700 | [diff] [blame] | 1121 | @Deprecated |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1122 | public static final String SUBREGION = "data10"; |
| 1123 | |
| 1124 | /** |
| 1125 | * A state, province, county (in Ireland), Land (in Germany), |
| 1126 | * departement (in France), etc. |
| 1127 | * <p> |
| 1128 | * Type: TEXT |
| 1129 | */ |
| 1130 | public static final String REGION = "data11"; |
| 1131 | |
| 1132 | /** |
Jeff Sharkey | ef348c7 | 2009-07-26 14:14:34 -0700 | [diff] [blame] | 1133 | * Postal code. Usually country-wide, but sometimes specific to the |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1134 | * city (e.g. "2" in "Dublin 2, Ireland" addresses). |
| 1135 | * <p> |
| 1136 | * Type: TEXT |
| 1137 | */ |
| 1138 | public static final String POSTCODE = "data12"; |
| 1139 | |
| 1140 | /** |
| 1141 | * The name or code of the country. |
| 1142 | * <p> |
| 1143 | * Type: TEXT |
| 1144 | */ |
| 1145 | public static final String COUNTRY = "data13"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1146 | } |
| 1147 | |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1148 | /** |
| 1149 | * Common data definition for IM addresses. |
| 1150 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 1151 | public static final class Im implements BaseCommonColumns, CommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1152 | private Im() {} |
| 1153 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1154 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1155 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im"; |
| 1156 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1157 | public static final int TYPE_HOME = 1; |
| 1158 | public static final int TYPE_WORK = 2; |
| 1159 | public static final int TYPE_OTHER = 3; |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 1160 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1161 | public static final String PROTOCOL = "data5"; |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 1162 | |
Jeff Sharkey | 732da92 | 2009-07-30 09:59:31 -0700 | [diff] [blame] | 1163 | public static final String CUSTOM_PROTOCOL = "data6"; |
| 1164 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1165 | /** |
| 1166 | * The predefined IM protocol types. The protocol can either be non-present, one |
| 1167 | * of these types, or a free-form string. These cases are encoded in the PROTOCOL |
| 1168 | * column as: |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 1169 | * <ul> |
| 1170 | * <li>null</li> |
| 1171 | * <li>pre:<an integer, one of the protocols below></li> |
| 1172 | * <li>custom:<a string></li> |
| 1173 | * </ul> |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1174 | */ |
Jeff Sharkey | 732da92 | 2009-07-30 09:59:31 -0700 | [diff] [blame] | 1175 | public static final int PROTOCOL_CUSTOM = -1; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1176 | public static final int PROTOCOL_AIM = 0; |
| 1177 | public static final int PROTOCOL_MSN = 1; |
| 1178 | public static final int PROTOCOL_YAHOO = 2; |
| 1179 | public static final int PROTOCOL_SKYPE = 3; |
| 1180 | public static final int PROTOCOL_QQ = 4; |
| 1181 | public static final int PROTOCOL_GOOGLE_TALK = 5; |
| 1182 | public static final int PROTOCOL_ICQ = 6; |
| 1183 | public static final int PROTOCOL_JABBER = 7; |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1184 | public static final int PROTOCOL_NETMEETING = 8; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1185 | } |
| 1186 | |
| 1187 | /** |
| 1188 | * Common data definition for organizations. |
| 1189 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 1190 | public static final class Organization implements BaseCommonColumns, CommonColumns { |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1191 | private Organization() {} |
| 1192 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1193 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1194 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization"; |
| 1195 | |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 1196 | public static final int TYPE_WORK = 1; |
| 1197 | public static final int TYPE_OTHER = 2; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1198 | |
| 1199 | /** |
| 1200 | * The company as the user entered it. |
| 1201 | * <P>Type: TEXT</P> |
| 1202 | */ |
Dmitri Plotnikov | 761ef2a | 2009-07-17 10:51:06 -0700 | [diff] [blame] | 1203 | public static final String COMPANY = DATA; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1204 | |
| 1205 | /** |
| 1206 | * The position title at this company as the user entered it. |
| 1207 | * <P>Type: TEXT</P> |
| 1208 | */ |
| 1209 | public static final String TITLE = "data4"; |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1210 | |
| 1211 | /** |
| 1212 | * The department at this company as the user entered it. |
| 1213 | * <P>Type: TEXT</P> |
| 1214 | */ |
| 1215 | public static final String DEPARTMENT = "data5"; |
| 1216 | |
| 1217 | /** |
| 1218 | * The job description at this company as the user entered it. |
| 1219 | * <P>Type: TEXT</P> |
| 1220 | */ |
| 1221 | public static final String JOB_DESCRIPTION = "data6"; |
| 1222 | |
| 1223 | /** |
| 1224 | * The symbol of this company as the user entered it. |
| 1225 | * <P>Type: TEXT</P> |
| 1226 | */ |
| 1227 | public static final String SYMBOL = "data7"; |
| 1228 | |
| 1229 | /** |
| 1230 | * The phonetic name of this company as the user entered it. |
| 1231 | * <P>Type: TEXT</P> |
| 1232 | */ |
| 1233 | public static final String PHONETIC_NAME = "data8"; |
| 1234 | } |
| 1235 | |
| 1236 | /** |
| 1237 | * Common data definition for miscellaneous information. |
| 1238 | */ |
| 1239 | public static final class Miscellaneous implements BaseCommonColumns { |
| 1240 | private Miscellaneous() {} |
| 1241 | |
| 1242 | /** MIME type used when storing this in data table. */ |
| 1243 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc"; |
| 1244 | |
| 1245 | /** |
| 1246 | * The birthday as the user entered it. |
| 1247 | * <P>Type: TEXT</P> |
| 1248 | */ |
| 1249 | public static final String BIRTHDAY = "data1"; |
| 1250 | |
| 1251 | /** |
| 1252 | * The nickname as the user entered it. |
| 1253 | * <P>Type: TEXT</P> |
| 1254 | */ |
| 1255 | public static final String NICKNAME = "data2"; |
| 1256 | } |
| 1257 | |
| 1258 | /** |
| 1259 | * Common data definition for relations. |
| 1260 | */ |
| 1261 | public static final class Relation implements BaseCommonColumns, CommonColumns { |
| 1262 | private Relation() {} |
| 1263 | |
| 1264 | /** MIME type used when storing this in data table. */ |
| 1265 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation"; |
| 1266 | |
| 1267 | public static final int TYPE_ASSISTANT = 1; |
| 1268 | public static final int TYPE_BROTHER = 2; |
| 1269 | public static final int TYPE_CHILD = 3; |
| 1270 | public static final int TYPE_DOMESTIC_PARTNER = 4; |
| 1271 | public static final int TYPE_FATHER = 5; |
| 1272 | public static final int TYPE_FRIEND = 6; |
| 1273 | public static final int TYPE_MANAGER = 7; |
| 1274 | public static final int TYPE_MOTHER = 8; |
| 1275 | public static final int TYPE_PARENT = 9; |
| 1276 | public static final int TYPE_PARTNER = 10; |
| 1277 | public static final int TYPE_REFERRED_BY = 11; |
| 1278 | public static final int TYPE_RELATIVE = 12; |
| 1279 | public static final int TYPE_SISTER = 13; |
| 1280 | public static final int TYPE_SPOUSE = 14; |
| 1281 | |
| 1282 | /** |
| 1283 | * The name of the relative as the user entered it. |
| 1284 | * <P>Type: TEXT</P> |
| 1285 | */ |
| 1286 | public static final String NAME = DATA; |
| 1287 | } |
| 1288 | |
| 1289 | /** |
| 1290 | * Common data definition for events. |
| 1291 | */ |
| 1292 | public static final class Event implements BaseCommonColumns, CommonColumns { |
| 1293 | private Event() {} |
| 1294 | |
| 1295 | /** MIME type used when storing this in data table. */ |
| 1296 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event"; |
| 1297 | |
| 1298 | public static final int TYPE_ANNIVERSARY = 1; |
| 1299 | public static final int TYPE_OTHER = 2; |
Dmitri Plotnikov | d4e0b57 | 2009-08-06 20:19:29 -0700 | [diff] [blame] | 1300 | |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1301 | /** |
| 1302 | * The event start date as the user entered it. |
| 1303 | * <P>Type: TEXT</P> |
| 1304 | */ |
| 1305 | public static final String START_DATE = DATA; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1306 | } |
| 1307 | |
| 1308 | /** |
| 1309 | * Photo of the contact. |
| 1310 | */ |
| 1311 | public static final class Photo implements BaseCommonColumns { |
| 1312 | private Photo() {} |
| 1313 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1314 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1315 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo"; |
| 1316 | |
| 1317 | /** |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 1318 | * Thumbnail photo of the raw contact. This is the raw bytes of an image |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1319 | * that could be inflated using {@link BitmapFactory}. |
| 1320 | * <p> |
| 1321 | * Type: BLOB |
| 1322 | */ |
| 1323 | public static final String PHOTO = "data1"; |
| 1324 | } |
| 1325 | |
| 1326 | /** |
| 1327 | * Notes about the contact. |
| 1328 | */ |
| 1329 | public static final class Note implements BaseCommonColumns { |
| 1330 | private Note() {} |
| 1331 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1332 | /** MIME type used when storing this in data table. */ |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1333 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note"; |
| 1334 | |
| 1335 | /** |
| 1336 | * The note text. |
| 1337 | * <P>Type: TEXT</P> |
| 1338 | */ |
| 1339 | public static final String NOTE = "data1"; |
| 1340 | } |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 1341 | |
Dmitri Plotnikov | c926054 | 2009-05-28 17:55:12 -0700 | [diff] [blame] | 1342 | /** |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1343 | * Group Membership. |
Dmitri Plotnikov | ceaafa5 | 2009-06-03 10:46:44 -0700 | [diff] [blame] | 1344 | */ |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1345 | public static final class GroupMembership implements BaseCommonColumns { |
| 1346 | private GroupMembership() {} |
Dmitri Plotnikov | ceaafa5 | 2009-06-03 10:46:44 -0700 | [diff] [blame] | 1347 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1348 | /** MIME type used when storing this in data table. */ |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1349 | public static final String CONTENT_ITEM_TYPE = |
| 1350 | "vnd.android.cursor.item/group_membership"; |
Dmitri Plotnikov | ceaafa5 | 2009-06-03 10:46:44 -0700 | [diff] [blame] | 1351 | |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1352 | /** |
Fred Quintana | ffc34c1 | 2009-07-14 16:02:58 -0700 | [diff] [blame] | 1353 | * The row id of the group that this group membership refers to. Exactly one of |
| 1354 | * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row. |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1355 | * <P>Type: INTEGER</P> |
| 1356 | */ |
| 1357 | public static final String GROUP_ROW_ID = "data1"; |
Dmitri Plotnikov | ceaafa5 | 2009-06-03 10:46:44 -0700 | [diff] [blame] | 1358 | |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1359 | /** |
Fred Quintana | ffc34c1 | 2009-07-14 16:02:58 -0700 | [diff] [blame] | 1360 | * The sourceid of the group that this group membership refers to. Exactly one of |
| 1361 | * this or {@link #GROUP_ROW_ID} must be set when inserting a row. |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1362 | * <P>Type: TEXT</P> |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1363 | */ |
Fred Quintana | ffc34c1 | 2009-07-14 16:02:58 -0700 | [diff] [blame] | 1364 | public static final String GROUP_SOURCE_ID = "group_sourceid"; |
Fred Quintana | d8dfeb5 | 2009-06-04 10:28:49 -0700 | [diff] [blame] | 1365 | } |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1366 | |
| 1367 | /** |
| 1368 | * Website related to the contact. |
| 1369 | */ |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1370 | public static final class Website implements BaseCommonColumns, CommonColumns { |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1371 | private Website() {} |
| 1372 | |
| 1373 | /** MIME type used when storing this in data table. */ |
| 1374 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website"; |
| 1375 | |
Fred Quintana | 8851e16 | 2009-08-05 21:06:45 -0700 | [diff] [blame] | 1376 | public static final int TYPE_HOMEPAGE = 1; |
| 1377 | public static final int TYPE_BLOG = 2; |
| 1378 | public static final int TYPE_PROFILE = 3; |
| 1379 | public static final int TYPE_HOME = 4; |
| 1380 | public static final int TYPE_WORK = 5; |
| 1381 | public static final int TYPE_FTP = 6; |
| 1382 | public static final int TYPE_OTHER = 7; |
| 1383 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1384 | /** |
| 1385 | * The website URL string. |
| 1386 | * <P>Type: TEXT</P> |
| 1387 | */ |
| 1388 | public static final String URL = "data1"; |
| 1389 | } |
Dmitri Plotnikov | ceaafa5 | 2009-06-03 10:46:44 -0700 | [diff] [blame] | 1390 | } |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1391 | |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 1392 | // TODO: make this private before unhiding |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1393 | public interface GroupsColumns { |
| 1394 | /** |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1395 | * The display title of this group. |
| 1396 | * <p> |
| 1397 | * Type: TEXT |
| 1398 | */ |
| 1399 | public static final String TITLE = "title"; |
| 1400 | |
| 1401 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1402 | * The package name to use when creating {@link Resources} objects for |
| 1403 | * this group. This value is only designed for use when building user |
| 1404 | * interfaces, and should not be used to infer the owner. |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1405 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1406 | public static final String RES_PACKAGE = "res_package"; |
| 1407 | |
| 1408 | /** |
| 1409 | * The display title of this group to load as a resource from |
| 1410 | * {@link #RES_PACKAGE}, which may be localized. |
| 1411 | * <P>Type: TEXT</P> |
| 1412 | */ |
| 1413 | public static final String TITLE_RES = "title_res"; |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1414 | |
| 1415 | /** |
Dmitri Plotnikov | 02c5b45 | 2009-07-22 15:13:08 -0700 | [diff] [blame] | 1416 | * Notes about the group. |
| 1417 | * <p> |
| 1418 | * Type: TEXT |
| 1419 | */ |
| 1420 | public static final String NOTES = "notes"; |
| 1421 | |
| 1422 | /** |
| 1423 | * The ID of this group if it is a System Group, i.e. a group that has a special meaning |
| 1424 | * to the sync adapter, null otherwise. |
| 1425 | * <P>Type: TEXT</P> |
| 1426 | */ |
| 1427 | public static final String SYSTEM_ID = "system_id"; |
| 1428 | |
| 1429 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1430 | * The total number of {@link Contacts} that have |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1431 | * {@link GroupMembership} in this group. Read-only value that is only |
| 1432 | * present when querying {@link Groups#CONTENT_SUMMARY_URI}. |
| 1433 | * <p> |
| 1434 | * Type: INTEGER |
| 1435 | */ |
| 1436 | public static final String SUMMARY_COUNT = "summ_count"; |
| 1437 | |
| 1438 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1439 | * The total number of {@link Contacts} that have both |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1440 | * {@link GroupMembership} in this group, and also have phone numbers. |
| 1441 | * Read-only value that is only present when querying |
| 1442 | * {@link Groups#CONTENT_SUMMARY_URI}. |
| 1443 | * <p> |
| 1444 | * Type: INTEGER |
| 1445 | */ |
| 1446 | public static final String SUMMARY_WITH_PHONES = "summ_phones"; |
| 1447 | |
| 1448 | /** |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1449 | * Flag indicating if the contacts belonging to this group should be |
| 1450 | * visible in any user interface. |
| 1451 | * <p> |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 1452 | * Type: INTEGER (boolean) |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1453 | */ |
| 1454 | public static final String GROUP_VISIBLE = "group_visible"; |
Fred Quintana | 00c89f6 | 2009-08-10 14:43:24 -0700 | [diff] [blame] | 1455 | |
| 1456 | /** |
| 1457 | * The "deleted" flag: "0" by default, "1" if the row has been marked |
| 1458 | * for deletion. When {@link android.content.ContentResolver#delete} is |
| 1459 | * called on a raw contact, it is marked for deletion and removed from its |
| 1460 | * aggregate contact. The sync adaptor deletes the raw contact on the server and |
| 1461 | * then calls ContactResolver.delete once more, this time passing the |
| 1462 | * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. |
| 1463 | * <P>Type: INTEGER</P> |
| 1464 | */ |
| 1465 | public static final String DELETED = "deleted"; |
Jeff Sharkey | 403d7ac | 2009-08-16 16:34:35 -0700 | [diff] [blame] | 1466 | |
| 1467 | /** |
| 1468 | * Whether this group should be synced if the SYNC_EVERYTHING settings |
| 1469 | * is false for this group's account. |
| 1470 | * <p> |
| 1471 | * Type: INTEGER (boolean) |
| 1472 | */ |
| 1473 | public static final String SHOULD_SYNC = "should_sync"; |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1474 | } |
| 1475 | |
| 1476 | /** |
| 1477 | * Constants for the groups table. |
| 1478 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1479 | public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns { |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1480 | /** |
| 1481 | * This utility class cannot be instantiated |
| 1482 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 1483 | private Groups() { |
| 1484 | } |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1485 | |
| 1486 | /** |
| 1487 | * The content:// style URI for this table |
| 1488 | */ |
| 1489 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups"); |
| 1490 | |
| 1491 | /** |
| 1492 | * The content:// style URI for this table joined with details data from |
Dmitri Plotnikov | 02c5b45 | 2009-07-22 15:13:08 -0700 | [diff] [blame] | 1493 | * {@link Data}. |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1494 | */ |
| 1495 | public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, |
| 1496 | "groups_summary"); |
| 1497 | |
| 1498 | /** |
| 1499 | * The MIME type of a directory of groups. |
| 1500 | */ |
| 1501 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group"; |
| 1502 | |
| 1503 | /** |
| 1504 | * The MIME type of a single group. |
| 1505 | */ |
| 1506 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; |
Fred Quintana | 00c89f6 | 2009-08-10 14:43:24 -0700 | [diff] [blame] | 1507 | |
| 1508 | /** |
| 1509 | * Query parameter that can be passed with the {@link #CONTENT_URI} URI |
| 1510 | * to the {@link android.content.ContentResolver#delete} method to |
| 1511 | * indicate that the raw contact can be deleted physically, rather than |
| 1512 | * merely marked as deleted. |
| 1513 | */ |
| 1514 | public static final String DELETE_PERMANENTLY = "delete_permanently"; |
Dmitri Plotnikov | 507f160 | 2009-08-10 17:37:36 -0700 | [diff] [blame] | 1515 | |
| 1516 | /** |
| 1517 | * An optional update or insert URI parameter that determines if the |
| 1518 | * group should be marked as dirty. The default value is true. |
| 1519 | */ |
| 1520 | public static final String MARK_AS_DIRTY = "mark_as_dirty"; |
Jeff Sharkey | b2909eb | 2009-06-16 16:55:31 -0700 | [diff] [blame] | 1521 | } |
| 1522 | |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1523 | /** |
| 1524 | * Constants for the contact aggregation exceptions table, which contains |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1525 | * aggregation rules overriding those used by automatic aggregation. This type only |
| 1526 | * supports query and update. Neither insert nor delete are supported. |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1527 | */ |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 1528 | public static final class AggregationExceptions implements BaseColumns { |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1529 | /** |
| 1530 | * This utility class cannot be instantiated |
| 1531 | */ |
| 1532 | private AggregationExceptions() {} |
| 1533 | |
| 1534 | /** |
| 1535 | * The content:// style URI for this table |
| 1536 | */ |
| 1537 | public static final Uri CONTENT_URI = |
| 1538 | Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions"); |
| 1539 | |
| 1540 | /** |
| 1541 | * The MIME type of {@link #CONTENT_URI} providing a directory of data. |
| 1542 | */ |
| 1543 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception"; |
| 1544 | |
| 1545 | /** |
Dmitri Plotnikov | 0918bf0 | 2009-06-10 16:13:08 -0700 | [diff] [blame] | 1546 | * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception |
| 1547 | */ |
| 1548 | public static final String CONTENT_ITEM_TYPE = |
| 1549 | "vnd.android.cursor.item/aggregation_exception"; |
| 1550 | |
| 1551 | /** |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1552 | * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or |
| 1553 | * {@link #TYPE_AUTOMATIC}. |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1554 | * |
| 1555 | * <P>Type: INTEGER</P> |
| 1556 | */ |
| 1557 | public static final String TYPE = "type"; |
| 1558 | |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1559 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1560 | * Allows the provider to automatically decide whether the aggregate |
| 1561 | * contact should include a particular raw contact or not. |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1562 | */ |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1563 | public static final int TYPE_AUTOMATIC = 0; |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1564 | |
| 1565 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1566 | * Makes sure that the specified raw contact is included in the |
| 1567 | * specified aggregate contact. |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1568 | */ |
| 1569 | public static final int TYPE_KEEP_IN = 1; |
| 1570 | |
| 1571 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1572 | * Makes sure that the specified raw contact is NOT included in the |
| 1573 | * specified aggregate contact. |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1574 | */ |
| 1575 | public static final int TYPE_KEEP_OUT = 2; |
| 1576 | |
| 1577 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1578 | * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the |
| 1579 | * aggregate contact that the rule applies to. |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1580 | */ |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1581 | public static final String CONTACT_ID = "contact_id"; |
Dmitri Plotnikov | 9d04451 | 2009-06-16 13:21:23 -0700 | [diff] [blame] | 1582 | |
| 1583 | /** |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 1584 | * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to. |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1585 | */ |
Dmitri Plotnikov | facbbb3 | 2009-07-27 15:18:19 -0700 | [diff] [blame] | 1586 | public static final String RAW_CONTACT_ID = "raw_contact_id"; |
Fred Quintana | 435e427 | 2009-06-04 17:30:28 -0700 | [diff] [blame] | 1587 | } |
Jeff Sharkey | 28b68e5 | 2009-06-10 15:26:58 -0700 | [diff] [blame] | 1588 | |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 1589 | private interface SettingsColumns { |
| 1590 | /** |
| 1591 | * The name of the account instance to which this row belongs. |
| 1592 | * <P>Type: TEXT</P> |
| 1593 | */ |
| 1594 | public static final String ACCOUNT_NAME = "account_name"; |
| 1595 | |
| 1596 | /** |
| 1597 | * The type of account to which this row belongs, which when paired with |
| 1598 | * {@link #ACCOUNT_NAME} identifies a specific account. |
| 1599 | * <P>Type: TEXT</P> |
| 1600 | */ |
| 1601 | public static final String ACCOUNT_TYPE = "account_type"; |
| 1602 | |
| 1603 | /** |
| 1604 | * Setting to indicate how this source handles {@link #SHOULD_SYNC} and |
| 1605 | * {@link Groups#SHOULD_SYNC} flags. This mode should be one of |
| 1606 | * {@link Settings#SYNC_MODE_EVERYTHING}, |
| 1607 | * {@link Settings#SYNC_MODE_UNGROUPED}, or |
| 1608 | * {@link Settings#SYNC_MODE_UNSUPPORTED}. |
| 1609 | * <p> |
| 1610 | * Type: INTEGER |
| 1611 | */ |
| 1612 | public static final String SHOULD_SYNC_MODE = "should_sync_mode"; |
| 1613 | |
| 1614 | /** |
| 1615 | * When modes is {@link Settings#SYNC_MODE_EVERYTHING}, this flag |
| 1616 | * overrides any children {@link Groups#SHOULD_SYNC} when set. When mode |
| 1617 | * is {@link Settings#SYNC_MODE_UNGROUPED}, this flag indicates the |
| 1618 | * syncing behavior for contacts not belonging to any group. |
| 1619 | * <p> |
| 1620 | * Type: INTEGER (boolean) |
| 1621 | */ |
| 1622 | public static final String SHOULD_SYNC = "should_sync"; |
| 1623 | |
| 1624 | /** |
Jeff Sharkey | a659744 | 2009-08-19 09:23:33 -0700 | [diff] [blame] | 1625 | * Flag indicating if contacts without any {@link GroupMembership} |
| 1626 | * entries should be visible in any user interface. |
Jeff Sharkey | 7b6771a | 2009-08-17 01:59:54 -0700 | [diff] [blame] | 1627 | * <p> |
| 1628 | * Type: INTEGER (boolean) |
| 1629 | */ |
| 1630 | public static final String UNGROUPED_VISIBLE = "ungrouped_visible"; |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * Contacts-specific settings for various {@link Account}. |
| 1635 | */ |
| 1636 | public static final class Settings implements BaseColumns, SettingsColumns { |
| 1637 | /** |
| 1638 | * This utility class cannot be instantiated |
| 1639 | */ |
| 1640 | private Settings() { |
| 1641 | } |
| 1642 | |
| 1643 | /** |
| 1644 | * The content:// style URI for this table |
| 1645 | */ |
| 1646 | public static final Uri CONTENT_URI = |
| 1647 | Uri.withAppendedPath(AUTHORITY_URI, "settings"); |
| 1648 | |
| 1649 | /** |
| 1650 | * The MIME-type of {@link #CONTENT_URI} providing a directory of |
| 1651 | * settings. |
| 1652 | */ |
| 1653 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting"; |
| 1654 | |
| 1655 | /** |
| 1656 | * The MIME-type of {@link #CONTENT_URI} providing a single setting. |
| 1657 | */ |
| 1658 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting"; |
| 1659 | |
| 1660 | /** |
| 1661 | * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source |
| 1662 | * doesn't support per-group {@link Groups#SHOULD_SYNC} flags. |
| 1663 | */ |
| 1664 | public static final int SYNC_MODE_UNSUPPORTED = 0; |
| 1665 | |
| 1666 | /** |
| 1667 | * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source |
| 1668 | * fully supports per-group {@link Groups#SHOULD_SYNC} flags and assumes |
| 1669 | * that {@link #SHOULD_SYNC} refers to contacts without any |
| 1670 | * {@link GroupMembership}. |
| 1671 | */ |
| 1672 | public static final int SYNC_MODE_UNGROUPED = 1; |
| 1673 | |
| 1674 | /** |
| 1675 | * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source |
| 1676 | * fully supports per-group {@link Groups#SHOULD_SYNC} flags but assumes |
| 1677 | * that {@link #SHOULD_SYNC} overrides per-group flags when set. |
| 1678 | */ |
| 1679 | public static final int SYNC_MODE_EVERYTHING = 2; |
| 1680 | } |
| 1681 | |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 1682 | /** |
| 1683 | * Contains helper classes used to create or manage {@link android.content.Intent Intents} |
| 1684 | * that involve contacts. |
| 1685 | */ |
| 1686 | public static final class Intents { |
| 1687 | /** |
| 1688 | * This is the intent that is fired when a search suggestion is clicked on. |
| 1689 | */ |
| 1690 | public static final String SEARCH_SUGGESTION_CLICKED = |
| 1691 | "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; |
| 1692 | |
| 1693 | /** |
| 1694 | * This is the intent that is fired when a search suggestion for dialing a number |
| 1695 | * is clicked on. |
| 1696 | */ |
| 1697 | public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = |
| 1698 | "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; |
| 1699 | |
| 1700 | /** |
| 1701 | * This is the intent that is fired when a search suggestion for creating a contact |
| 1702 | * is clicked on. |
| 1703 | */ |
| 1704 | public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = |
| 1705 | "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; |
| 1706 | |
| 1707 | /** |
| 1708 | * Starts an Activity that lets the user pick a contact to attach an image to. |
| 1709 | * After picking the contact it launches the image cropper in face detection mode. |
| 1710 | */ |
| 1711 | public static final String ATTACH_IMAGE = |
| 1712 | "com.android.contacts.action.ATTACH_IMAGE"; |
| 1713 | |
| 1714 | /** |
| 1715 | * Takes as input a data URI with a mailto: or tel: scheme. If a single |
| 1716 | * contact exists with the given data it will be shown. If no contact |
| 1717 | * exists, a dialog will ask the user if they want to create a new |
| 1718 | * contact with the provided details filled in. If multiple contacts |
| 1719 | * share the data the user will be prompted to pick which contact they |
| 1720 | * want to view. |
| 1721 | * <p> |
| 1722 | * For <code>mailto:</code> URIs, the scheme specific portion must be a |
| 1723 | * raw email address, such as one built using |
| 1724 | * {@link Uri#fromParts(String, String, String)}. |
| 1725 | * <p> |
| 1726 | * For <code>tel:</code> URIs, the scheme specific portion is compared |
| 1727 | * to existing numbers using the standard caller ID lookup algorithm. |
| 1728 | * The number must be properly encoded, for example using |
| 1729 | * {@link Uri#fromParts(String, String, String)}. |
| 1730 | * <p> |
| 1731 | * Any extras from the {@link Insert} class will be passed along to the |
| 1732 | * create activity if there are no contacts to show. |
| 1733 | * <p> |
| 1734 | * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip |
| 1735 | * prompting the user when the contact doesn't exist. |
| 1736 | */ |
| 1737 | public static final String SHOW_OR_CREATE_CONTACT = |
| 1738 | "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; |
| 1739 | |
| 1740 | /** |
| 1741 | * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new |
| 1742 | * contact if no matching contact found. Otherwise, default behavior is |
| 1743 | * to prompt user with dialog before creating. |
| 1744 | * <p> |
| 1745 | * Type: BOOLEAN |
| 1746 | */ |
| 1747 | public static final String EXTRA_FORCE_CREATE = |
| 1748 | "com.android.contacts.action.FORCE_CREATE"; |
| 1749 | |
| 1750 | /** |
| 1751 | * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact |
| 1752 | * description to be shown when prompting user about creating a new |
| 1753 | * contact. |
| 1754 | * <p> |
| 1755 | * Type: STRING |
| 1756 | */ |
| 1757 | public static final String EXTRA_CREATE_DESCRIPTION = |
| 1758 | "com.android.contacts.action.CREATE_DESCRIPTION"; |
| 1759 | |
| 1760 | /** |
Jeff Sharkey | 1132200 | 2009-06-04 17:25:51 -0700 | [diff] [blame] | 1761 | * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a |
| 1762 | * dialog location using screen coordinates. When not specified, the |
| 1763 | * dialog will be centered. |
| 1764 | */ |
| 1765 | public static final String EXTRA_TARGET_RECT = "target_rect"; |
| 1766 | |
| 1767 | /** |
Jeff Sharkey | 6bfe14d | 2009-08-05 15:49:48 -0700 | [diff] [blame] | 1768 | * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a |
| 1769 | * desired dialog style, usually a variation on size. One of |
| 1770 | * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}. |
| 1771 | */ |
| 1772 | public static final String EXTRA_MODE = "mode"; |
| 1773 | |
| 1774 | /** |
| 1775 | * Value for {@link #EXTRA_MODE} to show a small-sized dialog. |
| 1776 | */ |
| 1777 | public static final int MODE_SMALL = 1; |
| 1778 | |
| 1779 | /** |
| 1780 | * Value for {@link #EXTRA_MODE} to show a medium-sized dialog. |
| 1781 | */ |
| 1782 | public static final int MODE_MEDIUM = 2; |
| 1783 | |
| 1784 | /** |
| 1785 | * Value for {@link #EXTRA_MODE} to show a large-sized dialog. |
| 1786 | */ |
| 1787 | public static final int MODE_LARGE = 3; |
| 1788 | |
| 1789 | /** |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 1790 | * Intents related to the Contacts app UI. |
| 1791 | */ |
| 1792 | public static final class UI { |
| 1793 | /** |
| 1794 | * The action for the default contacts list tab. |
| 1795 | */ |
| 1796 | public static final String LIST_DEFAULT = |
| 1797 | "com.android.contacts.action.LIST_DEFAULT"; |
| 1798 | |
| 1799 | /** |
| 1800 | * The action for the contacts list tab. |
| 1801 | */ |
| 1802 | public static final String LIST_GROUP_ACTION = |
| 1803 | "com.android.contacts.action.LIST_GROUP"; |
| 1804 | |
| 1805 | /** |
| 1806 | * When in LIST_GROUP_ACTION mode, this is the group to display. |
| 1807 | */ |
| 1808 | public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; |
| 1809 | |
| 1810 | /** |
| 1811 | * The action for the all contacts list tab. |
| 1812 | */ |
| 1813 | public static final String LIST_ALL_CONTACTS_ACTION = |
| 1814 | "com.android.contacts.action.LIST_ALL_CONTACTS"; |
| 1815 | |
| 1816 | /** |
| 1817 | * The action for the contacts with phone numbers list tab. |
| 1818 | */ |
| 1819 | public static final String LIST_CONTACTS_WITH_PHONES_ACTION = |
| 1820 | "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; |
| 1821 | |
| 1822 | /** |
| 1823 | * The action for the starred contacts list tab. |
| 1824 | */ |
| 1825 | public static final String LIST_STARRED_ACTION = |
| 1826 | "com.android.contacts.action.LIST_STARRED"; |
| 1827 | |
| 1828 | /** |
| 1829 | * The action for the frequent contacts list tab. |
| 1830 | */ |
| 1831 | public static final String LIST_FREQUENT_ACTION = |
| 1832 | "com.android.contacts.action.LIST_FREQUENT"; |
| 1833 | |
| 1834 | /** |
| 1835 | * The action for the "strequent" contacts list tab. It first lists the starred |
| 1836 | * contacts in alphabetical order and then the frequent contacts in descending |
| 1837 | * order of the number of times they have been contacted. |
| 1838 | */ |
| 1839 | public static final String LIST_STREQUENT_ACTION = |
| 1840 | "com.android.contacts.action.LIST_STREQUENT"; |
| 1841 | |
| 1842 | /** |
| 1843 | * A key for to be used as an intent extra to set the activity |
| 1844 | * title to a custom String value. |
| 1845 | */ |
| 1846 | public static final String TITLE_EXTRA_KEY = |
| 1847 | "com.android.contacts.extra.TITLE_EXTRA"; |
| 1848 | |
| 1849 | /** |
| 1850 | * Activity Action: Display a filtered list of contacts |
| 1851 | * <p> |
| 1852 | * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for |
| 1853 | * filtering |
| 1854 | * <p> |
| 1855 | * Output: Nothing. |
| 1856 | */ |
| 1857 | public static final String FILTER_CONTACTS_ACTION = |
| 1858 | "com.android.contacts.action.FILTER_CONTACTS"; |
| 1859 | |
| 1860 | /** |
| 1861 | * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION} |
| 1862 | * intents to supply the text on which to filter. |
| 1863 | */ |
| 1864 | public static final String FILTER_TEXT_EXTRA_KEY = |
| 1865 | "com.android.contacts.extra.FILTER_TEXT"; |
| 1866 | } |
| 1867 | |
| 1868 | /** |
| 1869 | * Convenience class that contains string constants used |
| 1870 | * to create contact {@link android.content.Intent Intents}. |
| 1871 | */ |
| 1872 | public static final class Insert { |
| 1873 | /** The action code to use when adding a contact */ |
| 1874 | public static final String ACTION = Intent.ACTION_INSERT; |
| 1875 | |
| 1876 | /** |
| 1877 | * If present, forces a bypass of quick insert mode. |
| 1878 | */ |
| 1879 | public static final String FULL_MODE = "full_mode"; |
| 1880 | |
| 1881 | /** |
| 1882 | * The extra field for the contact name. |
| 1883 | * <P>Type: String</P> |
| 1884 | */ |
| 1885 | public static final String NAME = "name"; |
| 1886 | |
| 1887 | // TODO add structured name values here. |
| 1888 | |
| 1889 | /** |
| 1890 | * The extra field for the contact phonetic name. |
| 1891 | * <P>Type: String</P> |
| 1892 | */ |
| 1893 | public static final String PHONETIC_NAME = "phonetic_name"; |
| 1894 | |
| 1895 | /** |
| 1896 | * The extra field for the contact company. |
| 1897 | * <P>Type: String</P> |
| 1898 | */ |
| 1899 | public static final String COMPANY = "company"; |
| 1900 | |
| 1901 | /** |
| 1902 | * The extra field for the contact job title. |
| 1903 | * <P>Type: String</P> |
| 1904 | */ |
| 1905 | public static final String JOB_TITLE = "job_title"; |
| 1906 | |
| 1907 | /** |
| 1908 | * The extra field for the contact notes. |
| 1909 | * <P>Type: String</P> |
| 1910 | */ |
| 1911 | public static final String NOTES = "notes"; |
| 1912 | |
| 1913 | /** |
| 1914 | * The extra field for the contact phone number. |
| 1915 | * <P>Type: String</P> |
| 1916 | */ |
| 1917 | public static final String PHONE = "phone"; |
| 1918 | |
| 1919 | /** |
| 1920 | * The extra field for the contact phone number type. |
| 1921 | * <P>Type: Either an integer value from |
| 1922 | * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, |
| 1923 | * or a string specifying a custom label.</P> |
| 1924 | */ |
| 1925 | public static final String PHONE_TYPE = "phone_type"; |
| 1926 | |
| 1927 | /** |
| 1928 | * The extra field for the phone isprimary flag. |
| 1929 | * <P>Type: boolean</P> |
| 1930 | */ |
| 1931 | public static final String PHONE_ISPRIMARY = "phone_isprimary"; |
| 1932 | |
| 1933 | /** |
| 1934 | * The extra field for an optional second contact phone number. |
| 1935 | * <P>Type: String</P> |
| 1936 | */ |
| 1937 | public static final String SECONDARY_PHONE = "secondary_phone"; |
| 1938 | |
| 1939 | /** |
| 1940 | * The extra field for an optional second contact phone number type. |
| 1941 | * <P>Type: Either an integer value from |
| 1942 | * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, |
| 1943 | * or a string specifying a custom label.</P> |
| 1944 | */ |
| 1945 | public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; |
| 1946 | |
| 1947 | /** |
| 1948 | * The extra field for an optional third contact phone number. |
| 1949 | * <P>Type: String</P> |
| 1950 | */ |
| 1951 | public static final String TERTIARY_PHONE = "tertiary_phone"; |
| 1952 | |
| 1953 | /** |
| 1954 | * The extra field for an optional third contact phone number type. |
| 1955 | * <P>Type: Either an integer value from |
| 1956 | * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, |
| 1957 | * or a string specifying a custom label.</P> |
| 1958 | */ |
| 1959 | public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; |
| 1960 | |
| 1961 | /** |
| 1962 | * The extra field for the contact email address. |
| 1963 | * <P>Type: String</P> |
| 1964 | */ |
| 1965 | public static final String EMAIL = "email"; |
| 1966 | |
| 1967 | /** |
| 1968 | * The extra field for the contact email type. |
| 1969 | * <P>Type: Either an integer value from |
| 1970 | * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} |
| 1971 | * or a string specifying a custom label.</P> |
| 1972 | */ |
| 1973 | public static final String EMAIL_TYPE = "email_type"; |
| 1974 | |
| 1975 | /** |
| 1976 | * The extra field for the email isprimary flag. |
| 1977 | * <P>Type: boolean</P> |
| 1978 | */ |
| 1979 | public static final String EMAIL_ISPRIMARY = "email_isprimary"; |
| 1980 | |
| 1981 | /** |
| 1982 | * The extra field for an optional second contact email address. |
| 1983 | * <P>Type: String</P> |
| 1984 | */ |
| 1985 | public static final String SECONDARY_EMAIL = "secondary_email"; |
| 1986 | |
| 1987 | /** |
| 1988 | * The extra field for an optional second contact email type. |
| 1989 | * <P>Type: Either an integer value from |
| 1990 | * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} |
| 1991 | * or a string specifying a custom label.</P> |
| 1992 | */ |
| 1993 | public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; |
| 1994 | |
| 1995 | /** |
| 1996 | * The extra field for an optional third contact email address. |
| 1997 | * <P>Type: String</P> |
| 1998 | */ |
| 1999 | public static final String TERTIARY_EMAIL = "tertiary_email"; |
| 2000 | |
| 2001 | /** |
| 2002 | * The extra field for an optional third contact email type. |
| 2003 | * <P>Type: Either an integer value from |
| 2004 | * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} |
| 2005 | * or a string specifying a custom label.</P> |
| 2006 | */ |
| 2007 | public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; |
| 2008 | |
| 2009 | /** |
| 2010 | * The extra field for the contact postal address. |
| 2011 | * <P>Type: String</P> |
| 2012 | */ |
| 2013 | public static final String POSTAL = "postal"; |
| 2014 | |
| 2015 | /** |
| 2016 | * The extra field for the contact postal address type. |
| 2017 | * <P>Type: Either an integer value from |
| 2018 | * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} |
| 2019 | * or a string specifying a custom label.</P> |
| 2020 | */ |
| 2021 | public static final String POSTAL_TYPE = "postal_type"; |
| 2022 | |
| 2023 | /** |
| 2024 | * The extra field for the postal isprimary flag. |
| 2025 | * <P>Type: boolean</P> |
| 2026 | */ |
| 2027 | public static final String POSTAL_ISPRIMARY = "postal_isprimary"; |
| 2028 | |
| 2029 | /** |
| 2030 | * The extra field for an IM handle. |
| 2031 | * <P>Type: String</P> |
| 2032 | */ |
| 2033 | public static final String IM_HANDLE = "im_handle"; |
| 2034 | |
| 2035 | /** |
| 2036 | * The extra field for the IM protocol |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 2037 | * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} |
| 2038 | * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P> |
Evan Millar | dc2da5f | 2009-06-18 16:07:13 -0700 | [diff] [blame] | 2039 | */ |
| 2040 | public static final String IM_PROTOCOL = "im_protocol"; |
| 2041 | |
| 2042 | /** |
| 2043 | * The extra field for the IM isprimary flag. |
| 2044 | * <P>Type: boolean</P> |
| 2045 | */ |
| 2046 | public static final String IM_ISPRIMARY = "im_isprimary"; |
| 2047 | } |
| 2048 | } |
| 2049 | |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 2050 | } |