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