blob: 67676864aca156913690c7d288867cb053fc390e [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 -080032
33public class UIProvider {
Mindy Pereira82cc5662012-01-09 17:29:30 -080034 public static final String EMAIL_SEPARATOR = "\n";
Mindy Pereira326c6602012-01-04 15:32:42 -080035 public static final long INVALID_CONVERSATION_ID = -1;
36 public static final long INVALID_MESSAGE_ID = -1;
37
Marc Blank9ace18a2012-02-21 16:34:07 -080038 /**
39 * Values for the current state of a Folder/Account; note that it's possible that more than one
40 * sync is in progress
41 */
42 public static final class SyncStatus {
43 // No sync in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080044 public static final int NO_SYNC = 0;
Marc Blank9ace18a2012-02-21 16:34:07 -080045 // A user-requested sync/refresh is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080046 public static final int USER_REFRESH = 1<<0;
Marc Blank9ace18a2012-02-21 16:34:07 -080047 // A user-requested query is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080048 public static final int USER_QUERY = 1<<1;
Marc Blank9ace18a2012-02-21 16:34:07 -080049 // A user request for additional results is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080050 public static final int USER_MORE_RESULTS = 1<<2;
Marc Blank9ace18a2012-02-21 16:34:07 -080051 // A background sync is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080052 public static final int BACKGROUND_SYNC = 1<<3;
Marc Blank9ace18a2012-02-21 16:34:07 -080053 }
54
55 /**
56 * Values for the result of the last attempted sync of a Folder/Account
57 */
58 public static final class LastSyncResult {
59 // The sync completed successfully
60 public static final int SUCCESS = 0;
61 // The sync wasn't completed due to a connection error
62 public static final int CONNECTION_ERROR = 1;
63 // The sync wasn't completed due to an authentication error
64 public static final int AUTH_ERROR = 2;
65 // The sync wasn't completed due to a security error
66 public static final int SECURITY_ERROR = 3;
67 // The sync wasn't completed due to a low memory condition
68 public static final int STORAGE_ERROR = 4;
69 // The sync wasn't completed due to an internal error/exception
70 public static final int INTERNAL_ERROR = 5;
71 }
72
Paul Westbrook82ea6da2011-12-15 11:03:51 -080073 // The actual content provider should define its own authority
Andy Huang30e2c242012-01-06 18:14:30 -080074 public static final String AUTHORITY = "com.android.mail.providers";
Mindy Pereira6f92de62011-12-19 11:31:48 -080075
76 public static final String ACCOUNT_LIST_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080077 "vnd.android.cursor.dir/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080078 public static final String ACCOUNT_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080079 "vnd.android.cursor.item/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080080
81 public static final String[] ACCOUNTS_PROJECTION = {
82 BaseColumns._ID,
83 AccountColumns.NAME,
84 AccountColumns.PROVIDER_VERSION,
85 AccountColumns.URI,
86 AccountColumns.CAPABILITIES,
87 AccountColumns.FOLDER_LIST_URI,
88 AccountColumns.SEARCH_URI,
89 AccountColumns.ACCOUNT_FROM_ADDRESSES_URI,
Mindy Pereira33fe9082012-01-09 16:24:30 -080090 AccountColumns.SAVE_DRAFT_URI,
Mindy Pereira7ed1c112012-01-18 10:59:25 -080091 AccountColumns.SEND_MAIL_URI,
Mindy Pereira96b5c352012-02-01 11:33:40 -080092 AccountColumns.EXPUNGE_MESSAGE_URI,
Mindy Pereira9600dac2012-02-17 15:59:25 -080093 AccountColumns.UNDO_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -080094 AccountColumns.SETTINGS_INTENT_URI,
Paul Westbrook63eef792012-02-27 14:01:06 -080095 AccountColumns.SETTINGS_QUERY_URI,
Paul Westbrook94e440d2012-02-24 11:03:47 -080096 AccountColumns.SYNC_STATUS,
Mindy Pereira23755e22012-02-27 13:58:04 -080097 AccountColumns.HELP_INTENT_URI,
98 AccountColumns.COMPOSE_URI
Mindy Pereira6f92de62011-12-19 11:31:48 -080099 };
100
Mindy Pereira33fe9082012-01-09 16:24:30 -0800101 public static final int ACCOUNT_ID_COLUMN = 0;
102 public static final int ACCOUNT_NAME_COLUMN = 1;
103 public static final int ACCOUNT_PROVIDER_VERISON_COLUMN = 2;
104 public static final int ACCOUNT_URI_COLUMN = 3;
105 public static final int ACCOUNT_CAPABILITIES_COLUMN = 4;
106 public static final int ACCOUNT_FOLDER_LIST_URI_COLUMN = 5;
107 public static final int ACCOUNT_SEARCH_URI_COLUMN = 6;
108 public static final int ACCOUNT_FROM_ADDRESSES_URI_COLUMN = 7;
109 public static final int ACCOUNT_SAVE_DRAFT_URI_COLUMN = 8;
110 public static final int ACCOUNT_SEND_MESSAGE_URI_COLUMN = 9;
Mindy Pereira82cc5662012-01-09 17:29:30 -0800111 public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10;
Mindy Pereira96b5c352012-02-01 11:33:40 -0800112 public static final int ACCOUNT_UNDO_URI_COLUMN = 11;
Marc Blank9ace18a2012-02-21 16:34:07 -0800113 public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12;
Paul Westbrook63eef792012-02-27 14:01:06 -0800114 public static final int ACCOUNT_SETTINGS_QUERY_URI_COLUMN = 13;
115 public static final int ACCOUNT_SYNC_STATUS_COLUMN = 14;
116 public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 15;
117 public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 16;
Mindy Pereira33fe9082012-01-09 16:24:30 -0800118
Mindy Pereira6f92de62011-12-19 11:31:48 -0800119 public static final class AccountCapabilities {
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800120 /**
121 * Whether folders can be synchronized back to the server.
122 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800123 public static final int SYNCABLE_FOLDERS = 0x0001;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800124 /**
125 * Whether the server allows reporting spam back.
126 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800127 public static final int REPORT_SPAM = 0x0002;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800128 /**
129 * Whether the server supports a concept of Archive: removing mail from the Inbox but
130 * keeping it around.
131 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800132 public static final int ARCHIVE = 0x0004;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800133 /**
134 * Whether the server will stop notifying on updates to this thread? This requires
135 * THREADED_CONVERSATIONS to be true, otherwise it should be ignored.
136 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800137 public static final int MUTE = 0x0008;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800138 /**
139 * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS
140 * to be true, otherwise it should be ignored.
141 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800142 public static final int SERVER_SEARCH = 0x0010;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800143 /**
144 * Whether the server supports constraining search to a single folder. Requires
145 * SYNCABLE_FOLDERS, otherwise it should be ignored.
146 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800147 public static final int FOLDER_SERVER_SEARCH = 0x0020;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800148 /**
149 * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML).
150 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800151 public static final int SANITIZED_HTML = 0x0040;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800152 /**
153 * Whether the server allows synchronization of draft messages. This does NOT require
154 * SYNCABLE_FOLDERS to be set.
155 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800156 public static final int DRAFT_SYNCHRONIZATION = 0x0080;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800157 /**
158 * Does the server allow the user to compose mails (and reply) using addresses other than
159 * their account name? For instance, GMail allows users to set FROM addresses that are
160 * different from account@gmail.com address. For instance, user@gmail.com could have another
161 * FROM: address like user@android.com. If the user has enabled multiple FROM address, he
162 * can compose (and reply) using either address.
163 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800164 public static final int MULTIPLE_FROM_ADDRESSES = 0x0100;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800165 /**
166 * Whether the server allows the original message to be included in the reply by setting a
167 * flag on the reply. If we can avoid including the entire previous message, we save on
168 * bandwidth (replies are shorter).
169 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800170 public static final int SMART_REPLY = 0x0200;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800171 /**
172 * Does this account support searching locally, on the device? This requires the backend
173 * storage to support a mechanism for searching.
174 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800175 public static final int LOCAL_SEARCH = 0x0400;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800176 /**
177 * Whether the server supports a notion of threaded conversations: where replies to messages
178 * are tagged to keep conversations grouped. This could be full threading (each message
179 * lists its parent) or conversation-level threading (each message lists one conversation
180 * which it belongs to)
181 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800182 public static final int THREADED_CONVERSATIONS = 0x0800;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800183 /**
184 * Whether the server supports allowing a conversation to be in multiple folders. (Or allows
185 * multiple labels on a single conversation, since labels and folders are interchangeable
186 * in this application.)
187 */
Mindy Pereira84648892012-02-03 08:29:55 -0800188 public static final int MULTIPLE_FOLDERS_PER_CONV = 0x1000;
Mindy Pereira343ffeb2012-02-22 10:12:14 -0800189 /**
190 * Whether the provider supports undoing operations. If it doesn't, never show the undo bar.
191 */
192 public static final int UNDO = 0x2000;
Paul Westbrook94e440d2012-02-24 11:03:47 -0800193 /**
194 * Whether the account provides help content.
195 */
196 public static final int HELP_CONTENT = 0x4000;
Mindy Pereira6f92de62011-12-19 11:31:48 -0800197 }
198
199 public static final class AccountColumns {
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800200 /**
201 * This string column contains the human visible name for the account.
202 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800203 public static final String NAME = "name";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800204
205 /**
206 * This integer column returns the version of the UI provider schema from which this
207 * account provider will return results.
208 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800209 public static final String PROVIDER_VERSION = "providerVersion";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800210
211 /**
212 * This string column contains the uri to directly access the information for this account.
213 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800214 public static final String URI = "accountUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800215
216 /**
217 * This integer column contains a bit field of the possible cabibilities that this account
218 * supports.
219 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800220 public static final String CAPABILITIES = "capabilities";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800221
222 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800223 * This string column contains the content provider uri to return the
224 * list of top level folders for this account.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800225 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800226 public static final String FOLDER_LIST_URI = "folderListUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800227
228 /**
229 * This string column contains the content provider uri that can be queried for search
230 * results.
231 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800232 public static final String SEARCH_URI = "searchUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800233
234 /**
235 * This string column contains the content provider uri that can be queried to access the
236 * from addresses for this account.
237 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800238 public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800239
240 /**
241 * This string column contains the content provider uri that can be used to save (insert)
Mindy Pereira82cc5662012-01-09 17:29:30 -0800242 * new draft messages for this account. NOTE: This might be better to
243 * be an update operation on the messageUri.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800244 */
Mindy Pereira33fe9082012-01-09 16:24:30 -0800245 public static final String SAVE_DRAFT_URI = "saveDraftUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800246
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800247 /**
248 * This string column contains the content provider uri that can be used to send
249 * a message for this account.
250 * NOTE: This might be better to be an update operation on the messageUri.
251 */
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800252 public static final String SEND_MAIL_URI = "sendMailUri";
Mindy Pereira82cc5662012-01-09 17:29:30 -0800253
254 /**
255 * This string column contains the content provider uri that can be used
256 * to expunge a message from this account. NOTE: This might be better to
257 * be an update operation on the messageUri.
258 */
259 public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri";
Mindy Pereira96b5c352012-02-01 11:33:40 -0800260
261 /**
262 * This string column contains the content provider uri that can be used
263 * to undo the last committed action.
264 */
Mindy Pereira9600dac2012-02-17 15:59:25 -0800265 public static final String UNDO_URI = "undoUri";
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800266
267 /**
Paul Westbrook9912eee2012-02-22 14:49:03 -0800268 * Uri for EDIT intent that will cause the settings screens for this account type to be
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800269 * shown.
270 * TODO: When we want to support a heterogeneous set of account types, this value may need
271 * to be moved to a global content provider.
272 */
273 public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
Marc Blank9ace18a2012-02-21 16:34:07 -0800274
275 /**
Paul Westbrook63eef792012-02-27 14:01:06 -0800276 * This string column contains the content provider uri that can be used to query user
277 * settings/preferences.
278 *
279 * The cursor returned by this query support columnms declared in {@link #SettingsColumns}
280 */
281 public static final String SETTINGS_QUERY_URI = "accountSettingsQueryUri";
282
283 /**
Paul Westbrook94e440d2012-02-24 11:03:47 -0800284 * Uri for VIEW intent that will cause the help screens for this account type to be
285 * shown.
286 * TODO: When we want to support a heterogeneous set of account types, this value may need
287 * to be moved to a global content provider.
288 */
289 public static String HELP_INTENT_URI = "helpIntentUri";
290
291 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800292 * This int column contains the current sync status of the account (the logical AND of the
293 * sync status of folders in this account)
294 */
295 public static final String SYNC_STATUS = "syncStatus";
Mindy Pereira23755e22012-02-27 13:58:04 -0800296 /**
297 * Uri for VIEW intent that will cause the compose screens for this type
298 * of account to be shown.
299 */
300 public static final String COMPOSE_URI = "composeUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800301 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800302
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800303 // We define a "folder" as anything that contains a list of conversations.
304 public static final String FOLDER_LIST_TYPE =
305 "vnd.android.cursor.dir/vnd.com.android.mail.folder";
306 public static final String FOLDER_TYPE =
Mindy Pereira750cc732011-12-21 13:32:29 -0800307 "vnd.android.cursor.item/vnd.com.android.mail.folder";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800308
309 public static final String[] FOLDERS_PROJECTION = {
310 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800311 FolderColumns.URI,
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800312 FolderColumns.NAME,
Mindy Pereira750cc732011-12-21 13:32:29 -0800313 FolderColumns.HAS_CHILDREN,
Mindy Pereira0973b202011-12-21 15:48:12 -0800314 FolderColumns.CAPABILITIES,
Mindy Pereira0973b202011-12-21 15:48:12 -0800315 FolderColumns.SYNC_WINDOW,
Mindy Pereira750cc732011-12-21 13:32:29 -0800316 FolderColumns.CONVERSATION_LIST_URI,
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800317 FolderColumns.CHILD_FOLDERS_LIST_URI,
318 FolderColumns.UNREAD_COUNT,
Marc Blankc8a99422012-01-19 14:27:47 -0800319 FolderColumns.TOTAL_COUNT,
Mindy Pereira77528642012-02-17 15:51:10 -0800320 FolderColumns.REFRESH_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -0800321 FolderColumns.SYNC_STATUS,
322 FolderColumns.LAST_SYNC_RESULT
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800323 };
324
Mindy Pereira818143e2012-01-11 13:59:49 -0800325 public static final int FOLDER_ID_COLUMN = 0;
326 public static final int FOLDER_URI_COLUMN = 1;
327 public static final int FOLDER_NAME_COLUMN = 2;
328 public static final int FOLDER_HAS_CHILDREN_COLUMN = 3;
329 public static final int FOLDER_CAPABILITIES_COLUMN = 4;
Mindy Pereira621b4bd2012-02-23 13:48:50 -0800330 public static final int FOLDER_SYNC_WINDOW_COLUMN = 5;
331 public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6;
332 public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7;
333 public static final int FOLDER_UNREAD_COUNT_COLUMN = 8;
334 public static final int FOLDER_TOTAL_COUNT_COLUMN = 9;
335 public static final int FOLDER_REFRESH_URI_COLUMN = 10;
336 public static final int FOLDER_SYNC_STATUS_COLUMN = 11;
337 public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12;
Mindy Pereira818143e2012-01-11 13:59:49 -0800338
Mindy Pereira0973b202011-12-21 15:48:12 -0800339 public static final class FolderCapabilities {
340 public static final int SYNCABLE = 0x0001;
341 public static final int PARENT = 0x0002;
342 public static final int CAN_HOLD_MAIL = 0x0004;
343 public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008;
Paul Westbrook334e64a2012-02-23 13:26:35 -0800344 /**
345 * For accounts that support archive, this will indicate that this folder supports
346 * the archive functionality.
347 */
348 public static final int ARCHIVE = 0x0010;
349
350 /**
351 * For accounts that support report spam, this will indicate that this folder supports
352 * the report spam functionality.
353 */
354 public static final int REPORT_SPAM = 0x0020;
355
356 /**
357 * For accounts that support mute, this will indicate if a mute is performed from within
358 * this folder, the action is destructive.
359 */
360 public static final int DESTRUCTIVE_MUTE = 0x0040;
Mindy Pereira0973b202011-12-21 15:48:12 -0800361 }
362
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800363 public static final class FolderColumns {
Mindy Pereira77528642012-02-17 15:51:10 -0800364 public static final String URI = "folderUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800365 /**
366 * This string column contains the human visible name for the folder.
367 */
368 public static final String NAME = "name";
369 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800370 * This int column represents the capabilities of the folder specified by
371 * FolderCapabilities flags.
372 */
373 public static String CAPABILITIES = "capabilities";
374 /**
Mindy Pereirafc2277e2012-01-11 10:23:44 -0800375 * This int column represents whether or not this folder has any
Mindy Pereira750cc732011-12-21 13:32:29 -0800376 * child folders.
377 */
378 public static String HAS_CHILDREN = "hasChildren";
379 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800380 * This int column represents how large the sync window is.
381 */
382 public static String SYNC_WINDOW = "syncWindow";
383 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800384 * This string column contains the content provider uri to return the
385 * list of conversations for this folder.
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800386 */
387 public static final String CONVERSATION_LIST_URI = "conversationListUri";
Mindy Pereira750cc732011-12-21 13:32:29 -0800388 /**
389 * This string column contains the content provider uri to return the
390 * list of child folders of this folder.
391 */
Mindy Pereira77528642012-02-17 15:51:10 -0800392 public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800393
Mindy Pereira77528642012-02-17 15:51:10 -0800394 public static final String UNREAD_COUNT = "unreadCount";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800395
Mindy Pereira77528642012-02-17 15:51:10 -0800396 public static final String TOTAL_COUNT = "totalCount";
Mindy Pereira9c002102012-02-17 14:45:58 -0800397 /**
398 * This string column contains the content provider uri to force a
399 * refresh of this folder.
400 */
Mindy Pereira77528642012-02-17 15:51:10 -0800401 public static final String REFRESH_URI = "refreshUri";
402 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800403 * This int column contains current sync status of the folder; some combination of the
404 * SyncStatus bits defined above
Mindy Pereira77528642012-02-17 15:51:10 -0800405 */
Marc Blank9ace18a2012-02-21 16:34:07 -0800406 public static final String SYNC_STATUS = "syncStatus";
407 /**
408 * This int column contains the sync status of the last sync attempt; one of the
409 * LastSyncStatus values defined above
410 */
411 public static final String LAST_SYNC_RESULT = "lastSyncResult";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800412
Vikram Aggarwalff7d02a2012-01-11 16:37:45 -0800413 public FolderColumns() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800414 }
415
Mindy Pereiraa1406072011-12-22 10:54:06 -0800416 // We define a "folder" as anything that contains a list of conversations.
417 public static final String CONVERSATION_LIST_TYPE =
418 "vnd.android.cursor.dir/vnd.com.android.mail.conversation";
419 public static final String CONVERSATION_TYPE =
420 "vnd.android.cursor.item/vnd.com.android.mail.conversation";
421
Mindy Pereira9cdc4062012-02-02 14:18:08 -0800422
Mindy Pereiraa1406072011-12-22 10:54:06 -0800423 public static final String[] CONVERSATION_PROJECTION = {
424 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800425 ConversationColumns.URI,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800426 ConversationColumns.MESSAGE_LIST_URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800427 ConversationColumns.SUBJECT,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800428 ConversationColumns.SNIPPET,
429 ConversationColumns.SENDER_INFO,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800430 ConversationColumns.DATE_RECEIVED_MS,
Mindy Pereira4db59c52012-01-12 09:45:13 -0800431 ConversationColumns.HAS_ATTACHMENTS,
432 ConversationColumns.NUM_MESSAGES,
433 ConversationColumns.NUM_DRAFTS,
434 ConversationColumns.SENDING_STATE,
Marc Blankc8a99422012-01-19 14:27:47 -0800435 ConversationColumns.PRIORITY,
436 ConversationColumns.READ,
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800437 ConversationColumns.STARRED,
438 ConversationColumns.FOLDER_LIST
Mindy Pereiraa1406072011-12-22 10:54:06 -0800439 };
440
Mindy Pereirafdd984b2011-12-29 09:43:45 -0800441 // These column indexes only work when the caller uses the
442 // default CONVERSATION_PROJECTION defined above.
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800443 public static final int CONVERSATION_ID_COLUMN = 0;
Mindy Pereira3263fa92012-01-04 10:15:32 -0800444 public static final int CONVERSATION_URI_COLUMN = 1;
445 public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2;
446 public static final int CONVERSATION_SUBJECT_COLUMN = 3;
447 public static final int CONVERSATION_SNIPPET_COLUMN = 4;
448 public static final int CONVERSATION_SENDER_INFO_COLUMN = 5;
449 public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6;
450 public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800451 public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8;
452 public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9;
453 public static final int CONVERSATION_SENDING_STATE_COLUMN = 10;
454 public static final int CONVERSATION_PRIORITY_COLUMN = 11;
Marc Blankc8a99422012-01-19 14:27:47 -0800455 public static final int CONVERSATION_READ_COLUMN = 12;
456 public static final int CONVERSATION_STARRED_COLUMN = 13;
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800457 public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800458
459 public static final class ConversationSendingState {
Mindy Pereiraa4571372012-01-12 14:04:21 -0800460 public static final int OTHER = 0;
461 public static final int SENDING = 1;
462 public static final int SENT = 2;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800463 public static final int SEND_ERROR = -1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800464 }
Mindy Pereira4db59c52012-01-12 09:45:13 -0800465
466 public static final class ConversationPriority {
467 public static final int LOW = 0;
468 public static final int HIGH = 1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800469 }
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800470
Marc Blankc8a99422012-01-19 14:27:47 -0800471 public static final class ConversationFlags {
472 public static final int READ = 1<<0;
473 public static final int STARRED = 1<<1;
474 public static final int REPLIED = 1<<2;
475 public static final int FORWARDED = 1<<3;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800476 }
Marc Blankc8a99422012-01-19 14:27:47 -0800477
Mindy Pereiraa1406072011-12-22 10:54:06 -0800478 public static final class ConversationColumns {
Mindy Pereira6349a042012-01-04 11:25:01 -0800479 public static final String URI = "conversationUri";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800480 /**
Mindy Pereiraa1406072011-12-22 10:54:06 -0800481 * This string column contains the content provider uri to return the
482 * list of messages for this conversation.
483 */
484 public static final String MESSAGE_LIST_URI = "messageListUri";
Mindy Pereira27a0cf02011-12-22 13:16:32 -0800485 /**
486 * This string column contains the subject string for a conversation.
487 */
488 public static final String SUBJECT = "subject";
489 /**
490 * This string column contains the snippet string for a conversation.
491 */
492 public static final String SNIPPET = "snippet";
493 /**
494 * This string column contains the sender info string for a
495 * conversation.
496 */
497 public static final String SENDER_INFO = "senderInfo";
498 /**
499 * This long column contains the time in ms of the latest update to a
500 * conversation.
501 */
502 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
503
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800504 /**
505 * This boolean column contains whether any messages in this conversation
506 * have attachments.
507 */
508 public static final String HAS_ATTACHMENTS = "hasAttachments";
509
Mindy Pereira4db59c52012-01-12 09:45:13 -0800510 /**
511 * This int column contains the number of messages in this conversation.
512 * For unthreaded, this will always be 1.
513 */
514 public static String NUM_MESSAGES = "numMessages";
515
516 /**
517 * This int column contains the number of drafts associated with this
518 * conversation.
519 */
520 public static String NUM_DRAFTS = "numDrafts";
521
522 /**
523 * This int column contains the state of drafts and replies associated
524 * with this conversation. Use ConversationSendingState to interpret
525 * this field.
526 */
527 public static String SENDING_STATE = "sendingState";
528
529 /**
530 * This int column contains the priority of this conversation. Use
531 * ConversationPriority to interpret this field.
532 */
533 public static String PRIORITY = "priority";
534
Marc Blankc8a99422012-01-19 14:27:47 -0800535 /**
536 * This boolean column indicates whether the conversation has been read
537 */
538 public static String READ = "read";
539
540 /**
541 * This boolean column indicates whether the conversation has been read
542 */
543 public static String STARRED = "starred";
544
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800545 /**
546 * This string column contains a csv of all folders associated with this
547 * conversation
548 */
549 public static final String FOLDER_LIST = "folderList";
550
Paul Westbrook334e64a2012-02-23 13:26:35 -0800551 private ConversationColumns() {
Andy Huang732600e2012-01-10 17:47:17 -0800552 }
Mindy Pereiraa1406072011-12-22 10:54:06 -0800553 }
554
Mindy Pereira6f92de62011-12-19 11:31:48 -0800555 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800556 * List of operations that can can be performed on a conversation. These operations are applied
557 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])}
558 * where the conversation uri is specified, and the ContentValues specifies the operation to
559 * be performed.
560 * <p/>
561 * The operation to be performed is specified in the ContentValues by
562 * the {@link ConversationOperations#OPERATION_KEY}
563 * <p/>
564 * Note not all UI providers will support these operations. {@link AccountCapabilities} can
565 * be used to determine which operations are supported.
Mindy Pereira6f92de62011-12-19 11:31:48 -0800566 */
Paul Westbrook334e64a2012-02-23 13:26:35 -0800567 public static final class ConversationOperations {
568 /**
569 * ContentValues key used to specify the operation to be performed
570 */
571 public static final String OPERATION_KEY = "operation";
572
573 /**
574 * Archive operation
575 */
576 public static final String ARCHIVE = "archive";
577
578 /**
579 * Mute operation
580 */
581 public static final String MUTE = "mute";
582
583 /**
584 * Report spam operation
585 */
586 public static final String REPORT_SPAM = "report_spam";
587
588 private ConversationOperations() {
589 }
590 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800591
592 public static final class DraftType {
Andy Huang97c25be2012-01-12 15:12:09 -0800593 public static final int NOT_A_DRAFT = 0;
594 public static final int COMPOSE = 1;
595 public static final int REPLY = 2;
596 public static final int REPLY_ALL = 3;
597 public static final int FORWARD = 4;
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800598
599 private DraftType() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800600 }
601
Mindy Pereiraa1406072011-12-22 10:54:06 -0800602 public static final String[] MESSAGE_PROJECTION = {
603 BaseColumns._ID,
Mindy Pereira326c6602012-01-04 15:32:42 -0800604 MessageColumns.SERVER_ID,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800605 MessageColumns.URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800606 MessageColumns.CONVERSATION_ID,
607 MessageColumns.SUBJECT,
608 MessageColumns.SNIPPET,
609 MessageColumns.FROM,
610 MessageColumns.TO,
611 MessageColumns.CC,
612 MessageColumns.BCC,
613 MessageColumns.REPLY_TO,
614 MessageColumns.DATE_RECEIVED_MS,
615 MessageColumns.BODY_HTML,
616 MessageColumns.BODY_TEXT,
617 MessageColumns.EMBEDS_EXTERNAL_RESOURCES,
618 MessageColumns.REF_MESSAGE_ID,
619 MessageColumns.DRAFT_TYPE,
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800620 MessageColumns.APPEND_REF_MESSAGE_CONTENT,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800621 MessageColumns.HAS_ATTACHMENTS,
Mindy Pereira326c6602012-01-04 15:32:42 -0800622 MessageColumns.ATTACHMENT_LIST_URI,
Mindy Pereiraf944e962012-01-17 11:43:36 -0800623 MessageColumns.MESSAGE_FLAGS,
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800624 MessageColumns.JOINED_ATTACHMENT_INFOS,
625 MessageColumns.SAVE_MESSAGE_URI,
Paul Westbrook104f7292012-02-28 16:07:07 -0800626 MessageColumns.SEND_MESSAGE_URI,
627 MessageColumns.ALWAYS_SHOW_IMAGES
Mindy Pereiraa1406072011-12-22 10:54:06 -0800628 };
629
Mindy Pereiraf944e962012-01-17 11:43:36 -0800630 /** Separates attachment info parts in strings in a message. */
631 public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800632 public static final String MESSAGE_LIST_TYPE =
633 "vnd.android.cursor.dir/vnd.com.android.mail.message";
634 public static final String MESSAGE_TYPE =
635 "vnd.android.cursor.item/vnd.com.android.mail.message";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800636
Mindy Pereira6349a042012-01-04 11:25:01 -0800637 public static final int MESSAGE_ID_COLUMN = 0;
Mindy Pereira326c6602012-01-04 15:32:42 -0800638 public static final int MESSAGE_SERVER_ID_COLUMN = 1;
639 public static final int MESSAGE_URI_COLUMN = 2;
640 public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3;
641 public static final int MESSAGE_SUBJECT_COLUMN = 4;
642 public static final int MESSAGE_SNIPPET_COLUMN = 5;
643 public static final int MESSAGE_FROM_COLUMN = 6;
644 public static final int MESSAGE_TO_COLUMN = 7;
645 public static final int MESSAGE_CC_COLUMN = 8;
646 public static final int MESSAGE_BCC_COLUMN = 9;
647 public static final int MESSAGE_REPLY_TO_COLUMN = 10;
648 public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11;
Mindy Pereira16668162012-01-11 16:11:19 -0800649 public static final int MESSAGE_BODY_HTML_COLUMN = 12;
650 public static final int MESSAGE_BODY_TEXT_COLUMN = 13;
Mindy Pereira326c6602012-01-04 15:32:42 -0800651 public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14;
652 public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15;
653 public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16;
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800654 public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17;
655 public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18;
656 public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19;
657 public static final int MESSAGE_FLAGS_COLUMN = 20;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800658 public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21;
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800659 public static final int MESSAGE_SAVE_URI_COLUMN = 22;
660 public static final int MESSAGE_SEND_URI_COLUMN = 23;
Paul Westbrook104f7292012-02-28 16:07:07 -0800661 public static final int ALWAYS_SHOW_IMAGES_COLUMN = 24;
Mindy Pereira6349a042012-01-04 11:25:01 -0800662
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800663 public static final class MessageFlags {
Andy Huangdb977472012-01-11 19:53:25 -0800664 public static final int STARRED = 1 << 0;
665 public static final int UNREAD = 1 << 1;
666 public static final int REPLIED = 1 << 2;
667 public static final int FORWARDED = 1 << 3;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800668 }
669
Mindy Pereira6f92de62011-12-19 11:31:48 -0800670 public static final class MessageColumns {
Andy Huangdb977472012-01-11 19:53:25 -0800671 /**
672 * This string column contains a content provider URI that points to this single message.
673 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800674 public static final String URI = "messageUri";
Andy Huangdb977472012-01-11 19:53:25 -0800675 /**
676 * This string column contains a server-assigned ID for this message.
677 */
678 public static final String SERVER_ID = "serverMessageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800679 public static final String CONVERSATION_ID = "conversationId";
Andy Huangdb977472012-01-11 19:53:25 -0800680 /**
681 * This string column contains the subject of a message.
682 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800683 public static final String SUBJECT = "subject";
Andy Huangdb977472012-01-11 19:53:25 -0800684 /**
685 * This string column contains a snippet of the message body.
686 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800687 public static final String SNIPPET = "snippet";
Andy Huangdb977472012-01-11 19:53:25 -0800688 /**
689 * This string column contains the single email address (and optionally name) of the sender.
690 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800691 public static final String FROM = "fromAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800692 /**
693 * This string column contains a comma-delimited list of "To:" recipient email addresses.
694 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800695 public static final String TO = "toAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800696 /**
697 * This string column contains a comma-delimited list of "CC:" recipient email addresses.
698 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800699 public static final String CC = "ccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800700 /**
701 * This string column contains a comma-delimited list of "BCC:" recipient email addresses.
702 * This value will be null for incoming messages.
703 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800704 public static final String BCC = "bccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800705 /**
706 * This string column contains the single email address (and optionally name) of the
707 * sender's reply-to address.
708 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800709 public static final String REPLY_TO = "replyToAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800710 /**
711 * This long column contains the timestamp (in millis) of receipt of the message.
712 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800713 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
Andy Huangdb977472012-01-11 19:53:25 -0800714 /**
715 * This string column contains the HTML form of the message body, if available. If not,
716 * a provider must populate BODY_TEXT.
717 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800718 public static final String BODY_HTML = "bodyHtml";
Andy Huangdb977472012-01-11 19:53:25 -0800719 /**
720 * This string column contains the plaintext form of the message body, if HTML is not
721 * otherwise available. If HTML is available, this value should be left empty (null).
722 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800723 public static final String BODY_TEXT = "bodyText";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800724 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources";
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800725 /**
726 * This string column contains an opaque string used by the sendMessage api.
727 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800728 public static final String REF_MESSAGE_ID = "refMessageId";
Andy Huangdb977472012-01-11 19:53:25 -0800729 /**
Andy Huang97c25be2012-01-12 15:12:09 -0800730 * This integer column contains the type of this draft, or zero (0) if this message is not a
731 * draft. See {@link DraftType} for possible values.
Andy Huangdb977472012-01-11 19:53:25 -0800732 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800733 public static final String DRAFT_TYPE = "draftType";
Andy Huangdb977472012-01-11 19:53:25 -0800734 /**
735 * This boolean column indicates whether an outgoing message should trigger special quoted
736 * text processing upon send. The value should default to zero (0) for protocols that do
737 * not support or require this flag, and for all incoming messages.
738 */
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800739 public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent";
Andy Huangdb977472012-01-11 19:53:25 -0800740 /**
741 * This boolean column indicates whether a message has attachments. The list of attachments
742 * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}.
743 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800744 public static final String HAS_ATTACHMENTS = "hasAttachments";
Andy Huangdb977472012-01-11 19:53:25 -0800745 /**
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800746 * This string column contains the content provider URI for the list of
747 * attachments associated with this message.
Andy Huangdb977472012-01-11 19:53:25 -0800748 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800749 public static final String ATTACHMENT_LIST_URI = "attachmentListUri";
Andy Huangdb977472012-01-11 19:53:25 -0800750 /**
751 * This long column is a bit field of flags defined in {@link MessageFlags}.
752 */
Andy Huang732600e2012-01-10 17:47:17 -0800753 public static final String MESSAGE_FLAGS = "messageFlags";
Mindy Pereiraf944e962012-01-17 11:43:36 -0800754 /**
755 * This string column contains a specially formatted string representing all
756 * attachments that we added to a message that is being sent or saved.
757 */
Mindy Pereira84554ec2012-01-17 14:44:44 -0800758 public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos";
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800759 /**
760 * This string column contains the content provider URI for saving this
761 * message.
762 */
763 public static final String SAVE_MESSAGE_URI = "saveMessageUri";
764 /**
765 * This string column contains content provider URI for sending this
766 * message.
767 */
768 public static final String SEND_MESSAGE_URI = "sendMessageUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800769
Paul Westbrook104f7292012-02-28 16:07:07 -0800770 /**
771 * This integer column represents whether the user has specified that images should always
772 * be shown. The value of "1" indicates that the user has specified that images should be
773 * shown, while the value of "0" indicates that the user should be prompted before loading
774 * any external images.
775 */
776 public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages";
777
Mindy Pereira6f92de62011-12-19 11:31:48 -0800778 private MessageColumns() {}
779 }
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800780
781 // We define a "folder" as anything that contains a list of conversations.
782 public static final String ATTACHMENT_LIST_TYPE =
783 "vnd.android.cursor.dir/vnd.com.android.mail.attachment";
784 public static final String ATTACHMENT_TYPE =
785 "vnd.android.cursor.item/vnd.com.android.mail.attachment";
786
787 public static final String[] ATTACHMENT_PROJECTION = {
788 BaseColumns._ID,
789 AttachmentColumns.NAME,
790 AttachmentColumns.SIZE,
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800791 AttachmentColumns.URI,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800792 AttachmentColumns.ORIGIN_EXTRAS,
793 AttachmentColumns.CONTENT_TYPE,
794 AttachmentColumns.SYNCED
795 };
Mindy Pereira82cc5662012-01-09 17:29:30 -0800796 private static final String EMAIL_SEPARATOR_PATTERN = "\n";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800797 public static final int ATTACHMENT_ID_COLUMN = 0;
798 public static final int ATTACHMENT_NAME_COLUMN = 1;
799 public static final int ATTACHMENT_SIZE_COLUMN = 2;
800 public static final int ATTACHMENT_URI_COLUMN = 3;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800801 public static final int ATTACHMENT_ORIGIN_EXTRAS_COLUMN = 4;
802 public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 5;
803 public static final int ATTACHMENT_SYNCED_COLUMN = 6;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800804
805 public static final class AttachmentColumns {
806 public static final String NAME = "name";
807 public static final String SIZE = "size";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800808 public static final String URI = "uri";
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800809 public static final String ORIGIN_EXTRAS = "originExtras";
810 public static final String CONTENT_TYPE = "contentType";
811 public static final String SYNCED = "synced";
812 }
Mindy Pereira013194c2012-01-06 15:09:33 -0800813
814 public static int getMailMaxAttachmentSize(String account) {
815 // TODO: query the account to see what the max attachment size is?
816 return 5 * 1024 * 1024;
817 }
818
819 public static String getAttachmentTypeSetting() {
820 // TODO: query the account to see what kinds of attachments it supports?
821 return "com.google.android.gm.allowAddAnyAttachment";
822 }
Mindy Pereira82cc5662012-01-09 17:29:30 -0800823
824 public static void incrementRecipientsTimesContacted(Context context, String addressString) {
825 DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context);
826 ArrayList<String> recipients = new ArrayList<String>();
827 String[] addresses = TextUtils.split(addressString, EMAIL_SEPARATOR_PATTERN);
828 for (String address : addresses) {
829 recipients.add(address);
830 }
831 statsUpdater.updateWithAddress(recipients);
832 }
Marc Blankb31ab5a2012-02-01 12:28:29 -0800833
834 public static final String[] UNDO_PROJECTION = {
835 ConversationColumns.MESSAGE_LIST_URI
836 };
837 public static final int UNDO_MESSAGE_LIST_COLUMN = 0;
Marc Blankdd10bc82012-02-01 19:10:46 -0800838
839 // Parameter used to indicate the sequence number for an undoable operation
840 public static final String SEQUENCE_QUERY_PARAMETER = "seq";
Paul Westbrook63eef792012-02-27 14:01:06 -0800841
842
843 public static final String[] SETTINGS_PROJECTION = {
844 SettingsColumns.SIGNATURE,
845 SettingsColumns.AUTO_ADVANCE,
846 SettingsColumns.MESSAGE_TEXT_SIZE,
847 SettingsColumns.SNAP_HEADERS,
848 SettingsColumns.REPLY_BEHAVIOR,
849 SettingsColumns.HIDE_CHECKBOXES,
850 SettingsColumns.CONFIRM_DELETE,
851 SettingsColumns.CONFIRM_ARCHIVE,
852 SettingsColumns.CONFIRM_SEND,
853 };
854
855 public static final class AutoAdvance {
856 public static final int UNSET = 0;
857 public static final int OLDER = 1;
858 public static final int NEWER = 2;
859 public static final int LIST = 3;
860 }
861
862 public static final class SnapHeaderValue {
863 public static final int ALWAYS = 0;
864 public static final int PORTRAIT_ONLY = 1;
865 public static final int NEVER = 2;
866 }
867
868 public static final class MessageTextSize {
869 public static final int TINY = -2;
870 public static final int SMALL = -1;
871 public static final int NORMAL = 0;
872 public static final int LARGE = 1;
873 public static final int HUGE = 2;
874 }
875
876 public static final class DefaultReplyBehavior {
877 public static final int REPLY = 0;
878 public static final int REPLY_ALL = 1;
879 }
880
881 public static final class SettingsColumns {
882 /**
883 * String column containing the contents of the signature for this account. If no
884 * signature has been specified, the value will be null.
885 */
886 public static final String SIGNATURE = "signature";
887
888 /**
889 * Integer column containing the user's specified auto-advance policy. This value will be
890 * one of the values in {@link UIProvider.AutoAdvance}
891 */
892 public static final String AUTO_ADVANCE = "auto_advance";
893
894 /**
895 * Integer column containing the user's specified message text size preference. This value
896 * will be one of the values in {@link UIProvider.MessageTextSize}
897 */
898 public static final String MESSAGE_TEXT_SIZE = "message_text_size";
899
900 /**
901 * Integer column contaning the user's specified snap header preference. This value
902 * will be one of the values in {@link UIProvider.SnapHeaderValue}
903 */
904 public static final String SNAP_HEADERS = "snap_headers";
905
906 /**
907 * Integer column containing the user's specified default reply behavior. This value will
908 * be one of the values in {@link UIProvider.DefaultReplyBehavior}
909 */
910 public static final String REPLY_BEHAVIOR = "reply_behavior";
911
912 /**
913 * Integer column containing the user's specified checkbox preference. The value
914 * of 0 indicates that checkboxes are not hidden.
915 */
916 public static final String HIDE_CHECKBOXES = "hide_checkboxes";
917
918 /**
919 * Integer column containing the user's specified confirm delete preference value.
920 * A value of 1 indicates that the user has indicated that a confirmation should
921 * be shown when a delete action is performed.
922 */
923 public static final String CONFIRM_DELETE = "confirm_delete";
924
925 /**
926 * Integer column containing the user's specified confirm archive preference value.
927 * A value of 1 indicates that the user has indicated that a confirmation should
928 * be shown when an archive action is performed.
929 */
930 public static final String CONFIRM_ARCHIVE = "confirm_archive";
931
932 /**
933 * Integer column containing the user's specified confirm send preference value.
934 * A value of 1 indicates that the user has indicated that a confirmation should
935 * be shown when a send action is performed.
936 */
937 public static final String CONFIRM_SEND = "confirm_send";
938 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800939}