blob: cccafce06d4f6e7fb445b5dc60614dde72f43903 [file] [log] [blame]
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08001/*******************************************************************************
2 * Copyright (C) 2011 Google Inc.
3 * Licensed to The Android Open Source Project.
Mindy Pereira6f92de62011-12-19 11:31:48 -08004 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Mindy Pereira6f92de62011-12-19 11:31:48 -08008 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08009 * http://www.apache.org/licenses/LICENSE-2.0
Mindy Pereira6f92de62011-12-19 11:31:48 -080010 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -080011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
Mindy Pereira6f92de62011-12-19 11:31:48 -080017
Andy Huang30e2c242012-01-06 18:14:30 -080018package com.android.mail.providers;
Mindy Pereira6f92de62011-12-19 11:31:48 -080019
Paul Westbrook334e64a2012-02-23 13:26:35 -080020import android.content.ContentProvider;
21import android.content.ContentValues;
Mindy Pereira82cc5662012-01-09 17:29:30 -080022import android.content.Context;
Mindy Pereira6f92de62011-12-19 11:31:48 -080023import android.provider.BaseColumns;
Mindy Pereira82cc5662012-01-09 17:29:30 -080024import android.text.TextUtils;
Paul Westbrook334e64a2012-02-23 13:26:35 -080025import android.net.Uri;
Mindy Pereira82cc5662012-01-09 17:29:30 -080026
27import com.android.common.contacts.DataUsageStatUpdater;
Mindy Pereira6f92de62011-12-19 11:31:48 -080028
Paul Westbrook334e64a2012-02-23 13:26:35 -080029import java.lang.String;
Mindy Pereira82cc5662012-01-09 17:29:30 -080030import java.util.ArrayList;
Paul Westbrook82ea6da2011-12-15 11:03:51 -080031
Mindy Pereira6f92de62011-12-19 11:31:48 -080032public class UIProvider {
Mindy Pereira82cc5662012-01-09 17:29:30 -080033 public static final String EMAIL_SEPARATOR = "\n";
Mindy Pereira326c6602012-01-04 15:32:42 -080034 public static final long INVALID_CONVERSATION_ID = -1;
35 public static final long INVALID_MESSAGE_ID = -1;
36
Marc Blank9ace18a2012-02-21 16:34:07 -080037 /**
38 * Values for the current state of a Folder/Account; note that it's possible that more than one
39 * sync is in progress
40 */
41 public static final class SyncStatus {
42 // No sync in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080043 public static final int NO_SYNC = 0;
Marc Blank9ace18a2012-02-21 16:34:07 -080044 // A user-requested sync/refresh is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080045 public static final int USER_REFRESH = 1<<0;
Marc Blank9ace18a2012-02-21 16:34:07 -080046 // A user-requested query is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080047 public static final int USER_QUERY = 1<<1;
Marc Blank9ace18a2012-02-21 16:34:07 -080048 // A user request for additional results is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080049 public static final int USER_MORE_RESULTS = 1<<2;
Marc Blank9ace18a2012-02-21 16:34:07 -080050 // A background sync is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080051 public static final int BACKGROUND_SYNC = 1<<3;
Marc Blank9ace18a2012-02-21 16:34:07 -080052 }
53
54 /**
55 * Values for the result of the last attempted sync of a Folder/Account
56 */
57 public static final class LastSyncResult {
58 // The sync completed successfully
59 public static final int SUCCESS = 0;
60 // The sync wasn't completed due to a connection error
61 public static final int CONNECTION_ERROR = 1;
62 // The sync wasn't completed due to an authentication error
63 public static final int AUTH_ERROR = 2;
64 // The sync wasn't completed due to a security error
65 public static final int SECURITY_ERROR = 3;
66 // The sync wasn't completed due to a low memory condition
67 public static final int STORAGE_ERROR = 4;
68 // The sync wasn't completed due to an internal error/exception
69 public static final int INTERNAL_ERROR = 5;
70 }
71
Paul Westbrook82ea6da2011-12-15 11:03:51 -080072 // The actual content provider should define its own authority
Andy Huang30e2c242012-01-06 18:14:30 -080073 public static final String AUTHORITY = "com.android.mail.providers";
Mindy Pereira6f92de62011-12-19 11:31:48 -080074
75 public static final String ACCOUNT_LIST_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080076 "vnd.android.cursor.dir/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080077 public static final String ACCOUNT_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080078 "vnd.android.cursor.item/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080079
80 public static final String[] ACCOUNTS_PROJECTION = {
81 BaseColumns._ID,
82 AccountColumns.NAME,
83 AccountColumns.PROVIDER_VERSION,
84 AccountColumns.URI,
85 AccountColumns.CAPABILITIES,
86 AccountColumns.FOLDER_LIST_URI,
87 AccountColumns.SEARCH_URI,
88 AccountColumns.ACCOUNT_FROM_ADDRESSES_URI,
Mindy Pereira33fe9082012-01-09 16:24:30 -080089 AccountColumns.SAVE_DRAFT_URI,
Mindy Pereira7ed1c112012-01-18 10:59:25 -080090 AccountColumns.SEND_MAIL_URI,
Mindy Pereira96b5c352012-02-01 11:33:40 -080091 AccountColumns.EXPUNGE_MESSAGE_URI,
Mindy Pereira9600dac2012-02-17 15:59:25 -080092 AccountColumns.UNDO_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -080093 AccountColumns.SETTINGS_INTENT_URI,
Paul Westbrook63eef792012-02-27 14:01:06 -080094 AccountColumns.SETTINGS_QUERY_URI,
Paul Westbrook94e440d2012-02-24 11:03:47 -080095 AccountColumns.SYNC_STATUS,
Mindy Pereira23755e22012-02-27 13:58:04 -080096 AccountColumns.HELP_INTENT_URI,
97 AccountColumns.COMPOSE_URI
Mindy Pereira6f92de62011-12-19 11:31:48 -080098 };
99
Mindy Pereira33fe9082012-01-09 16:24:30 -0800100 public static final int ACCOUNT_ID_COLUMN = 0;
101 public static final int ACCOUNT_NAME_COLUMN = 1;
102 public static final int ACCOUNT_PROVIDER_VERISON_COLUMN = 2;
103 public static final int ACCOUNT_URI_COLUMN = 3;
104 public static final int ACCOUNT_CAPABILITIES_COLUMN = 4;
105 public static final int ACCOUNT_FOLDER_LIST_URI_COLUMN = 5;
106 public static final int ACCOUNT_SEARCH_URI_COLUMN = 6;
107 public static final int ACCOUNT_FROM_ADDRESSES_URI_COLUMN = 7;
108 public static final int ACCOUNT_SAVE_DRAFT_URI_COLUMN = 8;
109 public static final int ACCOUNT_SEND_MESSAGE_URI_COLUMN = 9;
Mindy Pereira82cc5662012-01-09 17:29:30 -0800110 public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10;
Mindy Pereira96b5c352012-02-01 11:33:40 -0800111 public static final int ACCOUNT_UNDO_URI_COLUMN = 11;
Marc Blank9ace18a2012-02-21 16:34:07 -0800112 public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12;
Paul Westbrook63eef792012-02-27 14:01:06 -0800113 public static final int ACCOUNT_SETTINGS_QUERY_URI_COLUMN = 13;
114 public static final int ACCOUNT_SYNC_STATUS_COLUMN = 14;
115 public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 15;
116 public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 16;
Mindy Pereira33fe9082012-01-09 16:24:30 -0800117
Mindy Pereira6f92de62011-12-19 11:31:48 -0800118 public static final class AccountCapabilities {
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800119 /**
120 * Whether folders can be synchronized back to the server.
121 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800122 public static final int SYNCABLE_FOLDERS = 0x0001;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800123 /**
124 * Whether the server allows reporting spam back.
125 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800126 public static final int REPORT_SPAM = 0x0002;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800127 /**
128 * Whether the server supports a concept of Archive: removing mail from the Inbox but
129 * keeping it around.
130 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800131 public static final int ARCHIVE = 0x0004;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800132 /**
133 * Whether the server will stop notifying on updates to this thread? This requires
134 * THREADED_CONVERSATIONS to be true, otherwise it should be ignored.
135 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800136 public static final int MUTE = 0x0008;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800137 /**
138 * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS
139 * to be true, otherwise it should be ignored.
140 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800141 public static final int SERVER_SEARCH = 0x0010;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800142 /**
143 * Whether the server supports constraining search to a single folder. Requires
144 * SYNCABLE_FOLDERS, otherwise it should be ignored.
145 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800146 public static final int FOLDER_SERVER_SEARCH = 0x0020;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800147 /**
148 * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML).
149 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800150 public static final int SANITIZED_HTML = 0x0040;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800151 /**
152 * Whether the server allows synchronization of draft messages. This does NOT require
153 * SYNCABLE_FOLDERS to be set.
154 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800155 public static final int DRAFT_SYNCHRONIZATION = 0x0080;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800156 /**
157 * Does the server allow the user to compose mails (and reply) using addresses other than
158 * their account name? For instance, GMail allows users to set FROM addresses that are
159 * different from account@gmail.com address. For instance, user@gmail.com could have another
160 * FROM: address like user@android.com. If the user has enabled multiple FROM address, he
161 * can compose (and reply) using either address.
162 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800163 public static final int MULTIPLE_FROM_ADDRESSES = 0x0100;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800164 /**
165 * Whether the server allows the original message to be included in the reply by setting a
166 * flag on the reply. If we can avoid including the entire previous message, we save on
167 * bandwidth (replies are shorter).
168 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800169 public static final int SMART_REPLY = 0x0200;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800170 /**
171 * Does this account support searching locally, on the device? This requires the backend
172 * storage to support a mechanism for searching.
173 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800174 public static final int LOCAL_SEARCH = 0x0400;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800175 /**
176 * Whether the server supports a notion of threaded conversations: where replies to messages
177 * are tagged to keep conversations grouped. This could be full threading (each message
178 * lists its parent) or conversation-level threading (each message lists one conversation
179 * which it belongs to)
180 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800181 public static final int THREADED_CONVERSATIONS = 0x0800;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800182 /**
183 * Whether the server supports allowing a conversation to be in multiple folders. (Or allows
184 * multiple labels on a single conversation, since labels and folders are interchangeable
185 * in this application.)
186 */
Mindy Pereira84648892012-02-03 08:29:55 -0800187 public static final int MULTIPLE_FOLDERS_PER_CONV = 0x1000;
Mindy Pereira343ffeb2012-02-22 10:12:14 -0800188 /**
189 * Whether the provider supports undoing operations. If it doesn't, never show the undo bar.
190 */
191 public static final int UNDO = 0x2000;
Paul Westbrook94e440d2012-02-24 11:03:47 -0800192 /**
193 * Whether the account provides help content.
194 */
195 public static final int HELP_CONTENT = 0x4000;
Mindy Pereira7f0a9622012-02-29 15:00:34 -0800196 /**
197 * Whether the account provides a mechanism for marking conversations as important.
198 */
199 public static final int MARK_IMPORTANT = 0x8000;
Mindy Pereira6f92de62011-12-19 11:31:48 -0800200 }
201
202 public static final class AccountColumns {
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800203 /**
204 * This string column contains the human visible name for the account.
205 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800206 public static final String NAME = "name";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800207
208 /**
209 * This integer column returns the version of the UI provider schema from which this
210 * account provider will return results.
211 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800212 public static final String PROVIDER_VERSION = "providerVersion";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800213
214 /**
215 * This string column contains the uri to directly access the information for this account.
216 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800217 public static final String URI = "accountUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800218
219 /**
220 * This integer column contains a bit field of the possible cabibilities that this account
221 * supports.
222 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800223 public static final String CAPABILITIES = "capabilities";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800224
225 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800226 * This string column contains the content provider uri to return the
227 * list of top level folders for this account.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800228 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800229 public static final String FOLDER_LIST_URI = "folderListUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800230
231 /**
232 * This string column contains the content provider uri that can be queried for search
233 * results.
234 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800235 public static final String SEARCH_URI = "searchUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800236
237 /**
238 * This string column contains the content provider uri that can be queried to access the
239 * from addresses for this account.
240 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800241 public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800242
243 /**
244 * This string column contains the content provider uri that can be used to save (insert)
Mindy Pereira82cc5662012-01-09 17:29:30 -0800245 * new draft messages for this account. NOTE: This might be better to
246 * be an update operation on the messageUri.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800247 */
Mindy Pereira33fe9082012-01-09 16:24:30 -0800248 public static final String SAVE_DRAFT_URI = "saveDraftUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800249
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800250 /**
251 * This string column contains the content provider uri that can be used to send
252 * a message for this account.
253 * NOTE: This might be better to be an update operation on the messageUri.
254 */
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800255 public static final String SEND_MAIL_URI = "sendMailUri";
Mindy Pereira82cc5662012-01-09 17:29:30 -0800256
257 /**
258 * This string column contains the content provider uri that can be used
259 * to expunge a message from this account. NOTE: This might be better to
260 * be an update operation on the messageUri.
261 */
262 public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri";
Mindy Pereira96b5c352012-02-01 11:33:40 -0800263
264 /**
265 * This string column contains the content provider uri that can be used
266 * to undo the last committed action.
267 */
Mindy Pereira9600dac2012-02-17 15:59:25 -0800268 public static final String UNDO_URI = "undoUri";
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800269
270 /**
Paul Westbrook9912eee2012-02-22 14:49:03 -0800271 * Uri for EDIT intent that will cause the settings screens for this account type to be
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800272 * shown.
273 * TODO: When we want to support a heterogeneous set of account types, this value may need
274 * to be moved to a global content provider.
275 */
276 public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
Marc Blank9ace18a2012-02-21 16:34:07 -0800277
278 /**
Paul Westbrook63eef792012-02-27 14:01:06 -0800279 * This string column contains the content provider uri that can be used to query user
280 * settings/preferences.
281 *
282 * The cursor returned by this query support columnms declared in {@link #SettingsColumns}
283 */
284 public static final String SETTINGS_QUERY_URI = "accountSettingsQueryUri";
285
286 /**
Paul Westbrook94e440d2012-02-24 11:03:47 -0800287 * Uri for VIEW intent that will cause the help screens for this account type to be
288 * shown.
289 * TODO: When we want to support a heterogeneous set of account types, this value may need
290 * to be moved to a global content provider.
291 */
292 public static String HELP_INTENT_URI = "helpIntentUri";
293
294 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800295 * This int column contains the current sync status of the account (the logical AND of the
296 * sync status of folders in this account)
297 */
298 public static final String SYNC_STATUS = "syncStatus";
Mindy Pereira23755e22012-02-27 13:58:04 -0800299 /**
300 * Uri for VIEW intent that will cause the compose screens for this type
301 * of account to be shown.
302 */
303 public static final String COMPOSE_URI = "composeUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800304 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800305
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800306 // We define a "folder" as anything that contains a list of conversations.
307 public static final String FOLDER_LIST_TYPE =
308 "vnd.android.cursor.dir/vnd.com.android.mail.folder";
309 public static final String FOLDER_TYPE =
Mindy Pereira750cc732011-12-21 13:32:29 -0800310 "vnd.android.cursor.item/vnd.com.android.mail.folder";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800311
312 public static final String[] FOLDERS_PROJECTION = {
313 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800314 FolderColumns.URI,
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800315 FolderColumns.NAME,
Mindy Pereira750cc732011-12-21 13:32:29 -0800316 FolderColumns.HAS_CHILDREN,
Mindy Pereira0973b202011-12-21 15:48:12 -0800317 FolderColumns.CAPABILITIES,
Mindy Pereira0973b202011-12-21 15:48:12 -0800318 FolderColumns.SYNC_WINDOW,
Mindy Pereira750cc732011-12-21 13:32:29 -0800319 FolderColumns.CONVERSATION_LIST_URI,
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800320 FolderColumns.CHILD_FOLDERS_LIST_URI,
321 FolderColumns.UNREAD_COUNT,
Marc Blankc8a99422012-01-19 14:27:47 -0800322 FolderColumns.TOTAL_COUNT,
Mindy Pereira77528642012-02-17 15:51:10 -0800323 FolderColumns.REFRESH_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -0800324 FolderColumns.SYNC_STATUS,
325 FolderColumns.LAST_SYNC_RESULT
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800326 };
327
Mindy Pereira818143e2012-01-11 13:59:49 -0800328 public static final int FOLDER_ID_COLUMN = 0;
329 public static final int FOLDER_URI_COLUMN = 1;
330 public static final int FOLDER_NAME_COLUMN = 2;
331 public static final int FOLDER_HAS_CHILDREN_COLUMN = 3;
332 public static final int FOLDER_CAPABILITIES_COLUMN = 4;
Mindy Pereira621b4bd2012-02-23 13:48:50 -0800333 public static final int FOLDER_SYNC_WINDOW_COLUMN = 5;
334 public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6;
335 public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7;
336 public static final int FOLDER_UNREAD_COUNT_COLUMN = 8;
337 public static final int FOLDER_TOTAL_COUNT_COLUMN = 9;
338 public static final int FOLDER_REFRESH_URI_COLUMN = 10;
339 public static final int FOLDER_SYNC_STATUS_COLUMN = 11;
340 public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12;
Mindy Pereira818143e2012-01-11 13:59:49 -0800341
Mindy Pereira0973b202011-12-21 15:48:12 -0800342 public static final class FolderCapabilities {
343 public static final int SYNCABLE = 0x0001;
344 public static final int PARENT = 0x0002;
345 public static final int CAN_HOLD_MAIL = 0x0004;
346 public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008;
Paul Westbrook334e64a2012-02-23 13:26:35 -0800347 /**
348 * For accounts that support archive, this will indicate that this folder supports
349 * the archive functionality.
350 */
351 public static final int ARCHIVE = 0x0010;
352
353 /**
354 * For accounts that support report spam, this will indicate that this folder supports
355 * the report spam functionality.
356 */
357 public static final int REPORT_SPAM = 0x0020;
358
359 /**
360 * For accounts that support mute, this will indicate if a mute is performed from within
361 * this folder, the action is destructive.
362 */
363 public static final int DESTRUCTIVE_MUTE = 0x0040;
Mindy Pereira0973b202011-12-21 15:48:12 -0800364 }
365
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800366 public static final class FolderColumns {
Mindy Pereira77528642012-02-17 15:51:10 -0800367 public static final String URI = "folderUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800368 /**
369 * This string column contains the human visible name for the folder.
370 */
371 public static final String NAME = "name";
372 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800373 * This int column represents the capabilities of the folder specified by
374 * FolderCapabilities flags.
375 */
376 public static String CAPABILITIES = "capabilities";
377 /**
Mindy Pereirafc2277e2012-01-11 10:23:44 -0800378 * This int column represents whether or not this folder has any
Mindy Pereira750cc732011-12-21 13:32:29 -0800379 * child folders.
380 */
381 public static String HAS_CHILDREN = "hasChildren";
382 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800383 * This int column represents how large the sync window is.
384 */
385 public static String SYNC_WINDOW = "syncWindow";
386 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800387 * This string column contains the content provider uri to return the
388 * list of conversations for this folder.
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800389 */
390 public static final String CONVERSATION_LIST_URI = "conversationListUri";
Mindy Pereira750cc732011-12-21 13:32:29 -0800391 /**
392 * This string column contains the content provider uri to return the
393 * list of child folders of this folder.
394 */
Mindy Pereira77528642012-02-17 15:51:10 -0800395 public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800396
Mindy Pereira77528642012-02-17 15:51:10 -0800397 public static final String UNREAD_COUNT = "unreadCount";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800398
Mindy Pereira77528642012-02-17 15:51:10 -0800399 public static final String TOTAL_COUNT = "totalCount";
Mindy Pereira9c002102012-02-17 14:45:58 -0800400 /**
401 * This string column contains the content provider uri to force a
402 * refresh of this folder.
403 */
Mindy Pereira77528642012-02-17 15:51:10 -0800404 public static final String REFRESH_URI = "refreshUri";
405 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800406 * This int column contains current sync status of the folder; some combination of the
407 * SyncStatus bits defined above
Mindy Pereira77528642012-02-17 15:51:10 -0800408 */
Marc Blank9ace18a2012-02-21 16:34:07 -0800409 public static final String SYNC_STATUS = "syncStatus";
410 /**
411 * This int column contains the sync status of the last sync attempt; one of the
412 * LastSyncStatus values defined above
413 */
414 public static final String LAST_SYNC_RESULT = "lastSyncResult";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800415
Vikram Aggarwalff7d02a2012-01-11 16:37:45 -0800416 public FolderColumns() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800417 }
418
Mindy Pereiraa1406072011-12-22 10:54:06 -0800419 // We define a "folder" as anything that contains a list of conversations.
420 public static final String CONVERSATION_LIST_TYPE =
421 "vnd.android.cursor.dir/vnd.com.android.mail.conversation";
422 public static final String CONVERSATION_TYPE =
423 "vnd.android.cursor.item/vnd.com.android.mail.conversation";
424
Mindy Pereira9cdc4062012-02-02 14:18:08 -0800425
Mindy Pereiraa1406072011-12-22 10:54:06 -0800426 public static final String[] CONVERSATION_PROJECTION = {
427 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800428 ConversationColumns.URI,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800429 ConversationColumns.MESSAGE_LIST_URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800430 ConversationColumns.SUBJECT,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800431 ConversationColumns.SNIPPET,
432 ConversationColumns.SENDER_INFO,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800433 ConversationColumns.DATE_RECEIVED_MS,
Mindy Pereira4db59c52012-01-12 09:45:13 -0800434 ConversationColumns.HAS_ATTACHMENTS,
435 ConversationColumns.NUM_MESSAGES,
436 ConversationColumns.NUM_DRAFTS,
437 ConversationColumns.SENDING_STATE,
Marc Blankc8a99422012-01-19 14:27:47 -0800438 ConversationColumns.PRIORITY,
439 ConversationColumns.READ,
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800440 ConversationColumns.STARRED,
441 ConversationColumns.FOLDER_LIST
Mindy Pereiraa1406072011-12-22 10:54:06 -0800442 };
443
Mindy Pereirafdd984b2011-12-29 09:43:45 -0800444 // These column indexes only work when the caller uses the
445 // default CONVERSATION_PROJECTION defined above.
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800446 public static final int CONVERSATION_ID_COLUMN = 0;
Mindy Pereira3263fa92012-01-04 10:15:32 -0800447 public static final int CONVERSATION_URI_COLUMN = 1;
448 public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2;
449 public static final int CONVERSATION_SUBJECT_COLUMN = 3;
450 public static final int CONVERSATION_SNIPPET_COLUMN = 4;
451 public static final int CONVERSATION_SENDER_INFO_COLUMN = 5;
452 public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6;
453 public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800454 public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8;
455 public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9;
456 public static final int CONVERSATION_SENDING_STATE_COLUMN = 10;
457 public static final int CONVERSATION_PRIORITY_COLUMN = 11;
Marc Blankc8a99422012-01-19 14:27:47 -0800458 public static final int CONVERSATION_READ_COLUMN = 12;
459 public static final int CONVERSATION_STARRED_COLUMN = 13;
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800460 public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800461
462 public static final class ConversationSendingState {
Mindy Pereiraa4571372012-01-12 14:04:21 -0800463 public static final int OTHER = 0;
464 public static final int SENDING = 1;
465 public static final int SENT = 2;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800466 public static final int SEND_ERROR = -1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800467 }
Mindy Pereira4db59c52012-01-12 09:45:13 -0800468
469 public static final class ConversationPriority {
470 public static final int LOW = 0;
471 public static final int HIGH = 1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800472 }
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800473
Marc Blankc8a99422012-01-19 14:27:47 -0800474 public static final class ConversationFlags {
475 public static final int READ = 1<<0;
476 public static final int STARRED = 1<<1;
477 public static final int REPLIED = 1<<2;
478 public static final int FORWARDED = 1<<3;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800479 }
Marc Blankc8a99422012-01-19 14:27:47 -0800480
Mindy Pereiraa1406072011-12-22 10:54:06 -0800481 public static final class ConversationColumns {
Mindy Pereira6349a042012-01-04 11:25:01 -0800482 public static final String URI = "conversationUri";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800483 /**
Mindy Pereiraa1406072011-12-22 10:54:06 -0800484 * This string column contains the content provider uri to return the
485 * list of messages for this conversation.
486 */
487 public static final String MESSAGE_LIST_URI = "messageListUri";
Mindy Pereira27a0cf02011-12-22 13:16:32 -0800488 /**
489 * This string column contains the subject string for a conversation.
490 */
491 public static final String SUBJECT = "subject";
492 /**
493 * This string column contains the snippet string for a conversation.
494 */
495 public static final String SNIPPET = "snippet";
496 /**
497 * This string column contains the sender info string for a
498 * conversation.
499 */
500 public static final String SENDER_INFO = "senderInfo";
501 /**
502 * This long column contains the time in ms of the latest update to a
503 * conversation.
504 */
505 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
506
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800507 /**
508 * This boolean column contains whether any messages in this conversation
509 * have attachments.
510 */
511 public static final String HAS_ATTACHMENTS = "hasAttachments";
512
Mindy Pereira4db59c52012-01-12 09:45:13 -0800513 /**
514 * This int column contains the number of messages in this conversation.
515 * For unthreaded, this will always be 1.
516 */
517 public static String NUM_MESSAGES = "numMessages";
518
519 /**
520 * This int column contains the number of drafts associated with this
521 * conversation.
522 */
523 public static String NUM_DRAFTS = "numDrafts";
524
525 /**
526 * This int column contains the state of drafts and replies associated
527 * with this conversation. Use ConversationSendingState to interpret
528 * this field.
529 */
530 public static String SENDING_STATE = "sendingState";
531
532 /**
533 * This int column contains the priority of this conversation. Use
534 * ConversationPriority to interpret this field.
535 */
536 public static String PRIORITY = "priority";
537
Marc Blankc8a99422012-01-19 14:27:47 -0800538 /**
539 * This boolean column indicates whether the conversation has been read
540 */
541 public static String READ = "read";
542
543 /**
544 * This boolean column indicates whether the conversation has been read
545 */
546 public static String STARRED = "starred";
547
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800548 /**
549 * This string column contains a csv of all folders associated with this
550 * conversation
551 */
552 public static final String FOLDER_LIST = "folderList";
553
Paul Westbrook334e64a2012-02-23 13:26:35 -0800554 private ConversationColumns() {
Andy Huang732600e2012-01-10 17:47:17 -0800555 }
Mindy Pereiraa1406072011-12-22 10:54:06 -0800556 }
557
Mindy Pereira6f92de62011-12-19 11:31:48 -0800558 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800559 * List of operations that can can be performed on a conversation. These operations are applied
560 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])}
561 * where the conversation uri is specified, and the ContentValues specifies the operation to
562 * be performed.
563 * <p/>
564 * The operation to be performed is specified in the ContentValues by
565 * the {@link ConversationOperations#OPERATION_KEY}
566 * <p/>
567 * Note not all UI providers will support these operations. {@link AccountCapabilities} can
568 * be used to determine which operations are supported.
Mindy Pereira6f92de62011-12-19 11:31:48 -0800569 */
Paul Westbrook334e64a2012-02-23 13:26:35 -0800570 public static final class ConversationOperations {
571 /**
572 * ContentValues key used to specify the operation to be performed
573 */
574 public static final String OPERATION_KEY = "operation";
575
576 /**
577 * Archive operation
578 */
579 public static final String ARCHIVE = "archive";
580
581 /**
582 * Mute operation
583 */
584 public static final String MUTE = "mute";
585
586 /**
587 * Report spam operation
588 */
589 public static final String REPORT_SPAM = "report_spam";
590
591 private ConversationOperations() {
592 }
593 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800594
595 public static final class DraftType {
Andy Huang97c25be2012-01-12 15:12:09 -0800596 public static final int NOT_A_DRAFT = 0;
597 public static final int COMPOSE = 1;
598 public static final int REPLY = 2;
599 public static final int REPLY_ALL = 3;
600 public static final int FORWARD = 4;
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800601
602 private DraftType() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800603 }
604
Mindy Pereiraa1406072011-12-22 10:54:06 -0800605 public static final String[] MESSAGE_PROJECTION = {
606 BaseColumns._ID,
Mindy Pereira326c6602012-01-04 15:32:42 -0800607 MessageColumns.SERVER_ID,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800608 MessageColumns.URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800609 MessageColumns.CONVERSATION_ID,
610 MessageColumns.SUBJECT,
611 MessageColumns.SNIPPET,
612 MessageColumns.FROM,
613 MessageColumns.TO,
614 MessageColumns.CC,
615 MessageColumns.BCC,
616 MessageColumns.REPLY_TO,
617 MessageColumns.DATE_RECEIVED_MS,
618 MessageColumns.BODY_HTML,
619 MessageColumns.BODY_TEXT,
620 MessageColumns.EMBEDS_EXTERNAL_RESOURCES,
621 MessageColumns.REF_MESSAGE_ID,
622 MessageColumns.DRAFT_TYPE,
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800623 MessageColumns.APPEND_REF_MESSAGE_CONTENT,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800624 MessageColumns.HAS_ATTACHMENTS,
Mindy Pereira326c6602012-01-04 15:32:42 -0800625 MessageColumns.ATTACHMENT_LIST_URI,
Mindy Pereiraf944e962012-01-17 11:43:36 -0800626 MessageColumns.MESSAGE_FLAGS,
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800627 MessageColumns.JOINED_ATTACHMENT_INFOS,
628 MessageColumns.SAVE_MESSAGE_URI,
Paul Westbrook104f7292012-02-28 16:07:07 -0800629 MessageColumns.SEND_MESSAGE_URI,
630 MessageColumns.ALWAYS_SHOW_IMAGES
Mindy Pereiraa1406072011-12-22 10:54:06 -0800631 };
632
Mindy Pereiraf944e962012-01-17 11:43:36 -0800633 /** Separates attachment info parts in strings in a message. */
634 public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800635 public static final String MESSAGE_LIST_TYPE =
636 "vnd.android.cursor.dir/vnd.com.android.mail.message";
637 public static final String MESSAGE_TYPE =
638 "vnd.android.cursor.item/vnd.com.android.mail.message";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800639
Mindy Pereira6349a042012-01-04 11:25:01 -0800640 public static final int MESSAGE_ID_COLUMN = 0;
Mindy Pereira326c6602012-01-04 15:32:42 -0800641 public static final int MESSAGE_SERVER_ID_COLUMN = 1;
642 public static final int MESSAGE_URI_COLUMN = 2;
643 public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3;
644 public static final int MESSAGE_SUBJECT_COLUMN = 4;
645 public static final int MESSAGE_SNIPPET_COLUMN = 5;
646 public static final int MESSAGE_FROM_COLUMN = 6;
647 public static final int MESSAGE_TO_COLUMN = 7;
648 public static final int MESSAGE_CC_COLUMN = 8;
649 public static final int MESSAGE_BCC_COLUMN = 9;
650 public static final int MESSAGE_REPLY_TO_COLUMN = 10;
651 public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11;
Mindy Pereira16668162012-01-11 16:11:19 -0800652 public static final int MESSAGE_BODY_HTML_COLUMN = 12;
653 public static final int MESSAGE_BODY_TEXT_COLUMN = 13;
Mindy Pereira326c6602012-01-04 15:32:42 -0800654 public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14;
655 public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15;
656 public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16;
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800657 public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17;
658 public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18;
659 public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19;
660 public static final int MESSAGE_FLAGS_COLUMN = 20;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800661 public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21;
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800662 public static final int MESSAGE_SAVE_URI_COLUMN = 22;
663 public static final int MESSAGE_SEND_URI_COLUMN = 23;
Paul Westbrook104f7292012-02-28 16:07:07 -0800664 public static final int ALWAYS_SHOW_IMAGES_COLUMN = 24;
Mindy Pereira6349a042012-01-04 11:25:01 -0800665
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800666 public static final class MessageFlags {
Andy Huangdb977472012-01-11 19:53:25 -0800667 public static final int STARRED = 1 << 0;
668 public static final int UNREAD = 1 << 1;
669 public static final int REPLIED = 1 << 2;
670 public static final int FORWARDED = 1 << 3;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800671 }
672
Mindy Pereira6f92de62011-12-19 11:31:48 -0800673 public static final class MessageColumns {
Andy Huangdb977472012-01-11 19:53:25 -0800674 /**
675 * This string column contains a content provider URI that points to this single message.
676 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800677 public static final String URI = "messageUri";
Andy Huangdb977472012-01-11 19:53:25 -0800678 /**
679 * This string column contains a server-assigned ID for this message.
680 */
681 public static final String SERVER_ID = "serverMessageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800682 public static final String CONVERSATION_ID = "conversationId";
Andy Huangdb977472012-01-11 19:53:25 -0800683 /**
684 * This string column contains the subject of a message.
685 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800686 public static final String SUBJECT = "subject";
Andy Huangdb977472012-01-11 19:53:25 -0800687 /**
688 * This string column contains a snippet of the message body.
689 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800690 public static final String SNIPPET = "snippet";
Andy Huangdb977472012-01-11 19:53:25 -0800691 /**
692 * This string column contains the single email address (and optionally name) of the sender.
693 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800694 public static final String FROM = "fromAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800695 /**
696 * This string column contains a comma-delimited list of "To:" recipient email addresses.
697 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800698 public static final String TO = "toAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800699 /**
700 * This string column contains a comma-delimited list of "CC:" recipient email addresses.
701 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800702 public static final String CC = "ccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800703 /**
704 * This string column contains a comma-delimited list of "BCC:" recipient email addresses.
705 * This value will be null for incoming messages.
706 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800707 public static final String BCC = "bccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800708 /**
709 * This string column contains the single email address (and optionally name) of the
710 * sender's reply-to address.
711 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800712 public static final String REPLY_TO = "replyToAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800713 /**
714 * This long column contains the timestamp (in millis) of receipt of the message.
715 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800716 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
Andy Huangdb977472012-01-11 19:53:25 -0800717 /**
718 * This string column contains the HTML form of the message body, if available. If not,
719 * a provider must populate BODY_TEXT.
720 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800721 public static final String BODY_HTML = "bodyHtml";
Andy Huangdb977472012-01-11 19:53:25 -0800722 /**
723 * This string column contains the plaintext form of the message body, if HTML is not
724 * otherwise available. If HTML is available, this value should be left empty (null).
725 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800726 public static final String BODY_TEXT = "bodyText";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800727 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources";
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800728 /**
729 * This string column contains an opaque string used by the sendMessage api.
730 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800731 public static final String REF_MESSAGE_ID = "refMessageId";
Andy Huangdb977472012-01-11 19:53:25 -0800732 /**
Andy Huang97c25be2012-01-12 15:12:09 -0800733 * This integer column contains the type of this draft, or zero (0) if this message is not a
734 * draft. See {@link DraftType} for possible values.
Andy Huangdb977472012-01-11 19:53:25 -0800735 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800736 public static final String DRAFT_TYPE = "draftType";
Andy Huangdb977472012-01-11 19:53:25 -0800737 /**
738 * This boolean column indicates whether an outgoing message should trigger special quoted
739 * text processing upon send. The value should default to zero (0) for protocols that do
740 * not support or require this flag, and for all incoming messages.
741 */
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800742 public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent";
Andy Huangdb977472012-01-11 19:53:25 -0800743 /**
744 * This boolean column indicates whether a message has attachments. The list of attachments
745 * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}.
746 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800747 public static final String HAS_ATTACHMENTS = "hasAttachments";
Andy Huangdb977472012-01-11 19:53:25 -0800748 /**
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800749 * This string column contains the content provider URI for the list of
750 * attachments associated with this message.
Andy Huangdb977472012-01-11 19:53:25 -0800751 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800752 public static final String ATTACHMENT_LIST_URI = "attachmentListUri";
Andy Huangdb977472012-01-11 19:53:25 -0800753 /**
754 * This long column is a bit field of flags defined in {@link MessageFlags}.
755 */
Andy Huang732600e2012-01-10 17:47:17 -0800756 public static final String MESSAGE_FLAGS = "messageFlags";
Mindy Pereiraf944e962012-01-17 11:43:36 -0800757 /**
758 * This string column contains a specially formatted string representing all
759 * attachments that we added to a message that is being sent or saved.
760 */
Mindy Pereira84554ec2012-01-17 14:44:44 -0800761 public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos";
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800762 /**
763 * This string column contains the content provider URI for saving this
764 * message.
765 */
766 public static final String SAVE_MESSAGE_URI = "saveMessageUri";
767 /**
768 * This string column contains content provider URI for sending this
769 * message.
770 */
771 public static final String SEND_MESSAGE_URI = "sendMessageUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800772
Paul Westbrook104f7292012-02-28 16:07:07 -0800773 /**
774 * This integer column represents whether the user has specified that images should always
775 * be shown. The value of "1" indicates that the user has specified that images should be
776 * shown, while the value of "0" indicates that the user should be prompted before loading
777 * any external images.
778 */
779 public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages";
780
Mindy Pereira6f92de62011-12-19 11:31:48 -0800781 private MessageColumns() {}
782 }
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800783
784 // We define a "folder" as anything that contains a list of conversations.
785 public static final String ATTACHMENT_LIST_TYPE =
786 "vnd.android.cursor.dir/vnd.com.android.mail.attachment";
787 public static final String ATTACHMENT_TYPE =
788 "vnd.android.cursor.item/vnd.com.android.mail.attachment";
789
790 public static final String[] ATTACHMENT_PROJECTION = {
791 BaseColumns._ID,
792 AttachmentColumns.NAME,
793 AttachmentColumns.SIZE,
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800794 AttachmentColumns.URI,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800795 AttachmentColumns.ORIGIN_EXTRAS,
796 AttachmentColumns.CONTENT_TYPE,
797 AttachmentColumns.SYNCED
798 };
Mindy Pereira82cc5662012-01-09 17:29:30 -0800799 private static final String EMAIL_SEPARATOR_PATTERN = "\n";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800800 public static final int ATTACHMENT_ID_COLUMN = 0;
801 public static final int ATTACHMENT_NAME_COLUMN = 1;
802 public static final int ATTACHMENT_SIZE_COLUMN = 2;
803 public static final int ATTACHMENT_URI_COLUMN = 3;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800804 public static final int ATTACHMENT_ORIGIN_EXTRAS_COLUMN = 4;
805 public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 5;
806 public static final int ATTACHMENT_SYNCED_COLUMN = 6;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800807
808 public static final class AttachmentColumns {
809 public static final String NAME = "name";
810 public static final String SIZE = "size";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800811 public static final String URI = "uri";
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800812 public static final String ORIGIN_EXTRAS = "originExtras";
813 public static final String CONTENT_TYPE = "contentType";
814 public static final String SYNCED = "synced";
815 }
Mindy Pereira013194c2012-01-06 15:09:33 -0800816
817 public static int getMailMaxAttachmentSize(String account) {
818 // TODO: query the account to see what the max attachment size is?
819 return 5 * 1024 * 1024;
820 }
821
822 public static String getAttachmentTypeSetting() {
823 // TODO: query the account to see what kinds of attachments it supports?
824 return "com.google.android.gm.allowAddAnyAttachment";
825 }
Mindy Pereira82cc5662012-01-09 17:29:30 -0800826
827 public static void incrementRecipientsTimesContacted(Context context, String addressString) {
828 DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context);
829 ArrayList<String> recipients = new ArrayList<String>();
830 String[] addresses = TextUtils.split(addressString, EMAIL_SEPARATOR_PATTERN);
831 for (String address : addresses) {
832 recipients.add(address);
833 }
834 statsUpdater.updateWithAddress(recipients);
835 }
Marc Blankb31ab5a2012-02-01 12:28:29 -0800836
837 public static final String[] UNDO_PROJECTION = {
838 ConversationColumns.MESSAGE_LIST_URI
839 };
840 public static final int UNDO_MESSAGE_LIST_COLUMN = 0;
Marc Blankdd10bc82012-02-01 19:10:46 -0800841
842 // Parameter used to indicate the sequence number for an undoable operation
843 public static final String SEQUENCE_QUERY_PARAMETER = "seq";
Paul Westbrook63eef792012-02-27 14:01:06 -0800844
845
846 public static final String[] SETTINGS_PROJECTION = {
847 SettingsColumns.SIGNATURE,
848 SettingsColumns.AUTO_ADVANCE,
849 SettingsColumns.MESSAGE_TEXT_SIZE,
850 SettingsColumns.SNAP_HEADERS,
851 SettingsColumns.REPLY_BEHAVIOR,
852 SettingsColumns.HIDE_CHECKBOXES,
853 SettingsColumns.CONFIRM_DELETE,
854 SettingsColumns.CONFIRM_ARCHIVE,
855 SettingsColumns.CONFIRM_SEND,
856 };
857
858 public static final class AutoAdvance {
859 public static final int UNSET = 0;
860 public static final int OLDER = 1;
861 public static final int NEWER = 2;
862 public static final int LIST = 3;
863 }
864
865 public static final class SnapHeaderValue {
866 public static final int ALWAYS = 0;
867 public static final int PORTRAIT_ONLY = 1;
868 public static final int NEVER = 2;
869 }
870
871 public static final class MessageTextSize {
872 public static final int TINY = -2;
873 public static final int SMALL = -1;
874 public static final int NORMAL = 0;
875 public static final int LARGE = 1;
876 public static final int HUGE = 2;
877 }
878
879 public static final class DefaultReplyBehavior {
880 public static final int REPLY = 0;
881 public static final int REPLY_ALL = 1;
882 }
883
884 public static final class SettingsColumns {
885 /**
886 * String column containing the contents of the signature for this account. If no
887 * signature has been specified, the value will be null.
888 */
889 public static final String SIGNATURE = "signature";
890
891 /**
892 * Integer column containing the user's specified auto-advance policy. This value will be
893 * one of the values in {@link UIProvider.AutoAdvance}
894 */
895 public static final String AUTO_ADVANCE = "auto_advance";
896
897 /**
898 * Integer column containing the user's specified message text size preference. This value
899 * will be one of the values in {@link UIProvider.MessageTextSize}
900 */
901 public static final String MESSAGE_TEXT_SIZE = "message_text_size";
902
903 /**
904 * Integer column contaning the user's specified snap header preference. This value
905 * will be one of the values in {@link UIProvider.SnapHeaderValue}
906 */
907 public static final String SNAP_HEADERS = "snap_headers";
908
909 /**
910 * Integer column containing the user's specified default reply behavior. This value will
911 * be one of the values in {@link UIProvider.DefaultReplyBehavior}
912 */
913 public static final String REPLY_BEHAVIOR = "reply_behavior";
914
915 /**
916 * Integer column containing the user's specified checkbox preference. The value
917 * of 0 indicates that checkboxes are not hidden.
918 */
919 public static final String HIDE_CHECKBOXES = "hide_checkboxes";
920
921 /**
922 * Integer column containing the user's specified confirm delete preference value.
923 * A value of 1 indicates that the user has indicated that a confirmation should
924 * be shown when a delete action is performed.
925 */
926 public static final String CONFIRM_DELETE = "confirm_delete";
927
928 /**
929 * Integer column containing the user's specified confirm archive preference value.
930 * A value of 1 indicates that the user has indicated that a confirmation should
931 * be shown when an archive action is performed.
932 */
933 public static final String CONFIRM_ARCHIVE = "confirm_archive";
934
935 /**
936 * Integer column containing the user's specified confirm send preference value.
937 * A value of 1 indicates that the user has indicated that a confirmation should
938 * be shown when a send action is performed.
939 */
940 public static final String CONFIRM_SEND = "confirm_send";
941 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800942}