Vikram Aggarwal | 4f9a4c5 | 2012-01-11 15:04:55 -0800 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (C) 2011 Google Inc. |
| 3 | * Licensed to The Android Open Source Project. |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 4 | * |
Vikram Aggarwal | 4f9a4c5 | 2012-01-11 15:04:55 -0800 | [diff] [blame] | 5 | * 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 Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 8 | * |
Vikram Aggarwal | 4f9a4c5 | 2012-01-11 15:04:55 -0800 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 10 | * |
Vikram Aggarwal | 4f9a4c5 | 2012-01-11 15:04:55 -0800 | [diff] [blame] | 11 | * 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 Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 17 | |
Andy Huang | 30e2c24 | 2012-01-06 18:14:30 -0800 | [diff] [blame] | 18 | package com.android.mail.providers; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 19 | |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 20 | import android.content.ContentProvider; |
| 21 | import android.content.ContentValues; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 22 | import android.content.Context; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 23 | import android.provider.BaseColumns; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 24 | import android.text.TextUtils; |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 25 | import android.net.Uri; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 26 | |
| 27 | import com.android.common.contacts.DataUsageStatUpdater; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 28 | |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 29 | import java.lang.String; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 30 | import java.util.ArrayList; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 31 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 32 | public class UIProvider { |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 33 | public static final String EMAIL_SEPARATOR = "\n"; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 34 | public static final long INVALID_CONVERSATION_ID = -1; |
| 35 | public static final long INVALID_MESSAGE_ID = -1; |
| 36 | |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 37 | /** |
| 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 Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 43 | public static final int NO_SYNC = 0; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 44 | // A user-requested sync/refresh is in progress |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 45 | public static final int USER_REFRESH = 1<<0; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 46 | // A user-requested query is in progress |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 47 | public static final int USER_QUERY = 1<<1; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 48 | // A user request for additional results is in progress |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 49 | public static final int USER_MORE_RESULTS = 1<<2; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 50 | // A background sync is in progress |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 51 | public static final int BACKGROUND_SYNC = 1<<3; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 52 | } |
| 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 Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 72 | // The actual content provider should define its own authority |
Andy Huang | 30e2c24 | 2012-01-06 18:14:30 -0800 | [diff] [blame] | 73 | public static final String AUTHORITY = "com.android.mail.providers"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 74 | |
| 75 | public static final String ACCOUNT_LIST_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 76 | "vnd.android.cursor.dir/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 77 | public static final String ACCOUNT_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 78 | "vnd.android.cursor.item/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 79 | |
| 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 Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 89 | AccountColumns.SAVE_DRAFT_URI, |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 90 | AccountColumns.SEND_MAIL_URI, |
Mindy Pereira | 96b5c35 | 2012-02-01 11:33:40 -0800 | [diff] [blame] | 91 | AccountColumns.EXPUNGE_MESSAGE_URI, |
Mindy Pereira | 9600dac | 2012-02-17 15:59:25 -0800 | [diff] [blame] | 92 | AccountColumns.UNDO_URI, |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 93 | AccountColumns.SETTINGS_INTENT_URI, |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 94 | AccountColumns.SETTINGS_QUERY_URI, |
Paul Westbrook | 94e440d | 2012-02-24 11:03:47 -0800 | [diff] [blame] | 95 | AccountColumns.SYNC_STATUS, |
Mindy Pereira | 23755e2 | 2012-02-27 13:58:04 -0800 | [diff] [blame] | 96 | AccountColumns.HELP_INTENT_URI, |
Mindy Pereira | 898cd38 | 2012-03-06 08:42:47 -0800 | [diff] [blame^] | 97 | AccountColumns.COMPOSE_URI, |
| 98 | AccountColumns.MIME_TYPE |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 99 | }; |
| 100 | |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 101 | 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 Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 111 | public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10; |
Mindy Pereira | 96b5c35 | 2012-02-01 11:33:40 -0800 | [diff] [blame] | 112 | public static final int ACCOUNT_UNDO_URI_COLUMN = 11; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 113 | public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12; |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 114 | 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 Pereira | 898cd38 | 2012-03-06 08:42:47 -0800 | [diff] [blame^] | 118 | public static final int ACCOUNT_MIME_TYPE_COLUMN = 17; |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 119 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 120 | public static final class AccountCapabilities { |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 121 | /** |
| 122 | * Whether folders can be synchronized back to the server. |
| 123 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 124 | public static final int SYNCABLE_FOLDERS = 0x0001; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 125 | /** |
| 126 | * Whether the server allows reporting spam back. |
| 127 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 128 | public static final int REPORT_SPAM = 0x0002; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 129 | /** |
| 130 | * Whether the server supports a concept of Archive: removing mail from the Inbox but |
| 131 | * keeping it around. |
| 132 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 133 | public static final int ARCHIVE = 0x0004; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 134 | /** |
| 135 | * Whether the server will stop notifying on updates to this thread? This requires |
| 136 | * THREADED_CONVERSATIONS to be true, otherwise it should be ignored. |
| 137 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 138 | public static final int MUTE = 0x0008; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 139 | /** |
| 140 | * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS |
| 141 | * to be true, otherwise it should be ignored. |
| 142 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 143 | public static final int SERVER_SEARCH = 0x0010; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 144 | /** |
| 145 | * Whether the server supports constraining search to a single folder. Requires |
| 146 | * SYNCABLE_FOLDERS, otherwise it should be ignored. |
| 147 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 148 | public static final int FOLDER_SERVER_SEARCH = 0x0020; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 149 | /** |
| 150 | * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML). |
| 151 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 152 | public static final int SANITIZED_HTML = 0x0040; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 153 | /** |
| 154 | * Whether the server allows synchronization of draft messages. This does NOT require |
| 155 | * SYNCABLE_FOLDERS to be set. |
| 156 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 157 | public static final int DRAFT_SYNCHRONIZATION = 0x0080; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 158 | /** |
| 159 | * Does the server allow the user to compose mails (and reply) using addresses other than |
| 160 | * their account name? For instance, GMail allows users to set FROM addresses that are |
| 161 | * different from account@gmail.com address. For instance, user@gmail.com could have another |
| 162 | * FROM: address like user@android.com. If the user has enabled multiple FROM address, he |
| 163 | * can compose (and reply) using either address. |
| 164 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 165 | public static final int MULTIPLE_FROM_ADDRESSES = 0x0100; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 166 | /** |
| 167 | * Whether the server allows the original message to be included in the reply by setting a |
| 168 | * flag on the reply. If we can avoid including the entire previous message, we save on |
| 169 | * bandwidth (replies are shorter). |
| 170 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 171 | public static final int SMART_REPLY = 0x0200; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 172 | /** |
| 173 | * Does this account support searching locally, on the device? This requires the backend |
| 174 | * storage to support a mechanism for searching. |
| 175 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 176 | public static final int LOCAL_SEARCH = 0x0400; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 177 | /** |
| 178 | * Whether the server supports a notion of threaded conversations: where replies to messages |
| 179 | * are tagged to keep conversations grouped. This could be full threading (each message |
| 180 | * lists its parent) or conversation-level threading (each message lists one conversation |
| 181 | * which it belongs to) |
| 182 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 183 | public static final int THREADED_CONVERSATIONS = 0x0800; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 184 | /** |
| 185 | * Whether the server supports allowing a conversation to be in multiple folders. (Or allows |
| 186 | * multiple labels on a single conversation, since labels and folders are interchangeable |
| 187 | * in this application.) |
| 188 | */ |
Mindy Pereira | 8464889 | 2012-02-03 08:29:55 -0800 | [diff] [blame] | 189 | public static final int MULTIPLE_FOLDERS_PER_CONV = 0x1000; |
Mindy Pereira | 343ffeb | 2012-02-22 10:12:14 -0800 | [diff] [blame] | 190 | /** |
| 191 | * Whether the provider supports undoing operations. If it doesn't, never show the undo bar. |
| 192 | */ |
| 193 | public static final int UNDO = 0x2000; |
Paul Westbrook | 94e440d | 2012-02-24 11:03:47 -0800 | [diff] [blame] | 194 | /** |
| 195 | * Whether the account provides help content. |
| 196 | */ |
| 197 | public static final int HELP_CONTENT = 0x4000; |
Mindy Pereira | 7f0a962 | 2012-02-29 15:00:34 -0800 | [diff] [blame] | 198 | /** |
| 199 | * Whether the account provides a mechanism for marking conversations as important. |
| 200 | */ |
| 201 | public static final int MARK_IMPORTANT = 0x8000; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | public static final class AccountColumns { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 205 | /** |
| 206 | * This string column contains the human visible name for the account. |
| 207 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 208 | public static final String NAME = "name"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * This integer column returns the version of the UI provider schema from which this |
| 212 | * account provider will return results. |
| 213 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 214 | public static final String PROVIDER_VERSION = "providerVersion"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 215 | |
| 216 | /** |
| 217 | * This string column contains the uri to directly access the information for this account. |
| 218 | */ |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 219 | public static final String URI = "accountUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 220 | |
| 221 | /** |
| 222 | * This integer column contains a bit field of the possible cabibilities that this account |
| 223 | * supports. |
| 224 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 225 | public static final String CAPABILITIES = "capabilities"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 226 | |
| 227 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 228 | * This string column contains the content provider uri to return the |
| 229 | * list of top level folders for this account. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 230 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 231 | public static final String FOLDER_LIST_URI = "folderListUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 232 | |
| 233 | /** |
| 234 | * This string column contains the content provider uri that can be queried for search |
| 235 | * results. |
| 236 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 237 | public static final String SEARCH_URI = "searchUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 238 | |
| 239 | /** |
| 240 | * This string column contains the content provider uri that can be queried to access the |
| 241 | * from addresses for this account. |
| 242 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 243 | public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 244 | |
| 245 | /** |
| 246 | * This string column contains the content provider uri that can be used to save (insert) |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 247 | * new draft messages for this account. NOTE: This might be better to |
| 248 | * be an update operation on the messageUri. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 249 | */ |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 250 | public static final String SAVE_DRAFT_URI = "saveDraftUri"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 251 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 252 | /** |
| 253 | * This string column contains the content provider uri that can be used to send |
| 254 | * a message for this account. |
| 255 | * NOTE: This might be better to be an update operation on the messageUri. |
| 256 | */ |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 257 | public static final String SEND_MAIL_URI = "sendMailUri"; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 258 | |
| 259 | /** |
| 260 | * This string column contains the content provider uri that can be used |
| 261 | * to expunge a message from this account. NOTE: This might be better to |
| 262 | * be an update operation on the messageUri. |
| 263 | */ |
| 264 | public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri"; |
Mindy Pereira | 96b5c35 | 2012-02-01 11:33:40 -0800 | [diff] [blame] | 265 | |
| 266 | /** |
| 267 | * This string column contains the content provider uri that can be used |
| 268 | * to undo the last committed action. |
| 269 | */ |
Mindy Pereira | 9600dac | 2012-02-17 15:59:25 -0800 | [diff] [blame] | 270 | public static final String UNDO_URI = "undoUri"; |
Paul Westbrook | 2861b6a | 2012-02-15 15:25:34 -0800 | [diff] [blame] | 271 | |
| 272 | /** |
Paul Westbrook | 9912eee | 2012-02-22 14:49:03 -0800 | [diff] [blame] | 273 | * Uri for EDIT intent that will cause the settings screens for this account type to be |
Paul Westbrook | 2861b6a | 2012-02-15 15:25:34 -0800 | [diff] [blame] | 274 | * shown. |
| 275 | * TODO: When we want to support a heterogeneous set of account types, this value may need |
| 276 | * to be moved to a global content provider. |
| 277 | */ |
| 278 | public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri"; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 279 | |
| 280 | /** |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 281 | * This string column contains the content provider uri that can be used to query user |
| 282 | * settings/preferences. |
| 283 | * |
| 284 | * The cursor returned by this query support columnms declared in {@link #SettingsColumns} |
| 285 | */ |
| 286 | public static final String SETTINGS_QUERY_URI = "accountSettingsQueryUri"; |
| 287 | |
| 288 | /** |
Paul Westbrook | 94e440d | 2012-02-24 11:03:47 -0800 | [diff] [blame] | 289 | * Uri for VIEW intent that will cause the help screens for this account type to be |
| 290 | * shown. |
| 291 | * TODO: When we want to support a heterogeneous set of account types, this value may need |
| 292 | * to be moved to a global content provider. |
| 293 | */ |
| 294 | public static String HELP_INTENT_URI = "helpIntentUri"; |
| 295 | |
| 296 | /** |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 297 | * This int column contains the current sync status of the account (the logical AND of the |
| 298 | * sync status of folders in this account) |
| 299 | */ |
| 300 | public static final String SYNC_STATUS = "syncStatus"; |
Mindy Pereira | 23755e2 | 2012-02-27 13:58:04 -0800 | [diff] [blame] | 301 | /** |
| 302 | * Uri for VIEW intent that will cause the compose screens for this type |
| 303 | * of account to be shown. |
| 304 | */ |
| 305 | public static final String COMPOSE_URI = "composeUri"; |
Mindy Pereira | 898cd38 | 2012-03-06 08:42:47 -0800 | [diff] [blame^] | 306 | /** |
| 307 | * Mime-type defining this account. |
| 308 | */ |
| 309 | public static final String MIME_TYPE = "mimeType"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 310 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 311 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 312 | // We define a "folder" as anything that contains a list of conversations. |
| 313 | public static final String FOLDER_LIST_TYPE = |
| 314 | "vnd.android.cursor.dir/vnd.com.android.mail.folder"; |
| 315 | public static final String FOLDER_TYPE = |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 316 | "vnd.android.cursor.item/vnd.com.android.mail.folder"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 317 | |
| 318 | public static final String[] FOLDERS_PROJECTION = { |
| 319 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 320 | FolderColumns.URI, |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 321 | FolderColumns.NAME, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 322 | FolderColumns.HAS_CHILDREN, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 323 | FolderColumns.CAPABILITIES, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 324 | FolderColumns.SYNC_WINDOW, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 325 | FolderColumns.CONVERSATION_LIST_URI, |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 326 | FolderColumns.CHILD_FOLDERS_LIST_URI, |
| 327 | FolderColumns.UNREAD_COUNT, |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 328 | FolderColumns.TOTAL_COUNT, |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 329 | FolderColumns.REFRESH_URI, |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 330 | FolderColumns.SYNC_STATUS, |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 331 | FolderColumns.LAST_SYNC_RESULT, |
| 332 | FolderColumns.TYPE, |
| 333 | FolderColumns.ICON_RES_ID |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 334 | }; |
| 335 | |
Mindy Pereira | 818143e | 2012-01-11 13:59:49 -0800 | [diff] [blame] | 336 | public static final int FOLDER_ID_COLUMN = 0; |
| 337 | public static final int FOLDER_URI_COLUMN = 1; |
| 338 | public static final int FOLDER_NAME_COLUMN = 2; |
| 339 | public static final int FOLDER_HAS_CHILDREN_COLUMN = 3; |
| 340 | public static final int FOLDER_CAPABILITIES_COLUMN = 4; |
Mindy Pereira | 621b4bd | 2012-02-23 13:48:50 -0800 | [diff] [blame] | 341 | public static final int FOLDER_SYNC_WINDOW_COLUMN = 5; |
| 342 | public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6; |
| 343 | public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7; |
| 344 | public static final int FOLDER_UNREAD_COUNT_COLUMN = 8; |
| 345 | public static final int FOLDER_TOTAL_COUNT_COLUMN = 9; |
| 346 | public static final int FOLDER_REFRESH_URI_COLUMN = 10; |
| 347 | public static final int FOLDER_SYNC_STATUS_COLUMN = 11; |
| 348 | public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12; |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 349 | public static final int FOLDER_TYPE_COLUMN = 13; |
| 350 | public static final int FOLDER_ICON_RES_ID_COLUMN = 14; |
| 351 | |
| 352 | public static final class FolderType { |
| 353 | public static final int DEFAULT = 0; |
| 354 | public static final int INBOX = 1; |
| 355 | public static final int DRAFT = 2; |
| 356 | public static final int OUTBOX = 3; |
| 357 | public static final int SENT = 4; |
| 358 | public static final int TRASH = 5; |
| 359 | public static final int SPAM = 6; |
| 360 | } |
Mindy Pereira | 818143e | 2012-01-11 13:59:49 -0800 | [diff] [blame] | 361 | |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 362 | public static final class FolderCapabilities { |
| 363 | public static final int SYNCABLE = 0x0001; |
| 364 | public static final int PARENT = 0x0002; |
| 365 | public static final int CAN_HOLD_MAIL = 0x0004; |
| 366 | public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 367 | /** |
| 368 | * For accounts that support archive, this will indicate that this folder supports |
| 369 | * the archive functionality. |
| 370 | */ |
| 371 | public static final int ARCHIVE = 0x0010; |
| 372 | |
| 373 | /** |
| 374 | * For accounts that support report spam, this will indicate that this folder supports |
| 375 | * the report spam functionality. |
| 376 | */ |
| 377 | public static final int REPORT_SPAM = 0x0020; |
| 378 | |
| 379 | /** |
| 380 | * For accounts that support mute, this will indicate if a mute is performed from within |
| 381 | * this folder, the action is destructive. |
| 382 | */ |
| 383 | public static final int DESTRUCTIVE_MUTE = 0x0040; |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 384 | } |
| 385 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 386 | public static final class FolderColumns { |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 387 | public static final String URI = "folderUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 388 | /** |
| 389 | * This string column contains the human visible name for the folder. |
| 390 | */ |
| 391 | public static final String NAME = "name"; |
| 392 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 393 | * This int column represents the capabilities of the folder specified by |
| 394 | * FolderCapabilities flags. |
| 395 | */ |
| 396 | public static String CAPABILITIES = "capabilities"; |
| 397 | /** |
Mindy Pereira | fc2277e | 2012-01-11 10:23:44 -0800 | [diff] [blame] | 398 | * This int column represents whether or not this folder has any |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 399 | * child folders. |
| 400 | */ |
| 401 | public static String HAS_CHILDREN = "hasChildren"; |
| 402 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 403 | * This int column represents how large the sync window is. |
| 404 | */ |
| 405 | public static String SYNC_WINDOW = "syncWindow"; |
| 406 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 407 | * This string column contains the content provider uri to return the |
| 408 | * list of conversations for this folder. |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 409 | */ |
| 410 | public static final String CONVERSATION_LIST_URI = "conversationListUri"; |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 411 | /** |
| 412 | * This string column contains the content provider uri to return the |
| 413 | * list of child folders of this folder. |
| 414 | */ |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 415 | public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 416 | |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 417 | public static final String UNREAD_COUNT = "unreadCount"; |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 418 | |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 419 | public static final String TOTAL_COUNT = "totalCount"; |
Mindy Pereira | 9c00210 | 2012-02-17 14:45:58 -0800 | [diff] [blame] | 420 | /** |
| 421 | * This string column contains the content provider uri to force a |
| 422 | * refresh of this folder. |
| 423 | */ |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 424 | public static final String REFRESH_URI = "refreshUri"; |
| 425 | /** |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 426 | * This int column contains current sync status of the folder; some combination of the |
| 427 | * SyncStatus bits defined above |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 428 | */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 429 | public static final String SYNC_STATUS = "syncStatus"; |
| 430 | /** |
| 431 | * This int column contains the sync status of the last sync attempt; one of the |
| 432 | * LastSyncStatus values defined above |
| 433 | */ |
| 434 | public static final String LAST_SYNC_RESULT = "lastSyncResult"; |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 435 | /** |
| 436 | * This long column contains the icon res id for this folder, or 0 if there is none. |
| 437 | */ |
| 438 | public static final String ICON_RES_ID = "iconResId"; |
| 439 | /** |
| 440 | * This int column contains the type of the folder. Zero is default. |
| 441 | */ |
| 442 | public static final String TYPE = "type"; |
Vikram Aggarwal | ff7d02a | 2012-01-11 16:37:45 -0800 | [diff] [blame] | 443 | public FolderColumns() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 444 | } |
| 445 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 446 | // We define a "folder" as anything that contains a list of conversations. |
| 447 | public static final String CONVERSATION_LIST_TYPE = |
| 448 | "vnd.android.cursor.dir/vnd.com.android.mail.conversation"; |
| 449 | public static final String CONVERSATION_TYPE = |
| 450 | "vnd.android.cursor.item/vnd.com.android.mail.conversation"; |
| 451 | |
Mindy Pereira | 9cdc406 | 2012-02-02 14:18:08 -0800 | [diff] [blame] | 452 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 453 | public static final String[] CONVERSATION_PROJECTION = { |
| 454 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 455 | ConversationColumns.URI, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 456 | ConversationColumns.MESSAGE_LIST_URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 457 | ConversationColumns.SUBJECT, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 458 | ConversationColumns.SNIPPET, |
| 459 | ConversationColumns.SENDER_INFO, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 460 | ConversationColumns.DATE_RECEIVED_MS, |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 461 | ConversationColumns.HAS_ATTACHMENTS, |
| 462 | ConversationColumns.NUM_MESSAGES, |
| 463 | ConversationColumns.NUM_DRAFTS, |
| 464 | ConversationColumns.SENDING_STATE, |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 465 | ConversationColumns.PRIORITY, |
| 466 | ConversationColumns.READ, |
Mindy Pereira | 36b6c8b | 2012-02-03 14:16:07 -0800 | [diff] [blame] | 467 | ConversationColumns.STARRED, |
| 468 | ConversationColumns.FOLDER_LIST |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 469 | }; |
| 470 | |
Mindy Pereira | fdd984b | 2011-12-29 09:43:45 -0800 | [diff] [blame] | 471 | // These column indexes only work when the caller uses the |
| 472 | // default CONVERSATION_PROJECTION defined above. |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 473 | public static final int CONVERSATION_ID_COLUMN = 0; |
Mindy Pereira | 3263fa9 | 2012-01-04 10:15:32 -0800 | [diff] [blame] | 474 | public static final int CONVERSATION_URI_COLUMN = 1; |
| 475 | public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2; |
| 476 | public static final int CONVERSATION_SUBJECT_COLUMN = 3; |
| 477 | public static final int CONVERSATION_SNIPPET_COLUMN = 4; |
| 478 | public static final int CONVERSATION_SENDER_INFO_COLUMN = 5; |
| 479 | public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6; |
| 480 | public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 481 | public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8; |
| 482 | public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9; |
| 483 | public static final int CONVERSATION_SENDING_STATE_COLUMN = 10; |
| 484 | public static final int CONVERSATION_PRIORITY_COLUMN = 11; |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 485 | public static final int CONVERSATION_READ_COLUMN = 12; |
| 486 | public static final int CONVERSATION_STARRED_COLUMN = 13; |
Mindy Pereira | 36b6c8b | 2012-02-03 14:16:07 -0800 | [diff] [blame] | 487 | public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 488 | |
| 489 | public static final class ConversationSendingState { |
Mindy Pereira | a457137 | 2012-01-12 14:04:21 -0800 | [diff] [blame] | 490 | public static final int OTHER = 0; |
| 491 | public static final int SENDING = 1; |
| 492 | public static final int SENT = 2; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 493 | public static final int SEND_ERROR = -1; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 494 | } |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 495 | |
| 496 | public static final class ConversationPriority { |
| 497 | public static final int LOW = 0; |
| 498 | public static final int HIGH = 1; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 499 | } |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 500 | |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 501 | public static final class ConversationFlags { |
| 502 | public static final int READ = 1<<0; |
| 503 | public static final int STARRED = 1<<1; |
| 504 | public static final int REPLIED = 1<<2; |
| 505 | public static final int FORWARDED = 1<<3; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 506 | } |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 507 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 508 | public static final class ConversationColumns { |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 509 | public static final String URI = "conversationUri"; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 510 | /** |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 511 | * This string column contains the content provider uri to return the |
| 512 | * list of messages for this conversation. |
| 513 | */ |
| 514 | public static final String MESSAGE_LIST_URI = "messageListUri"; |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 515 | /** |
| 516 | * This string column contains the subject string for a conversation. |
| 517 | */ |
| 518 | public static final String SUBJECT = "subject"; |
| 519 | /** |
| 520 | * This string column contains the snippet string for a conversation. |
| 521 | */ |
| 522 | public static final String SNIPPET = "snippet"; |
| 523 | /** |
| 524 | * This string column contains the sender info string for a |
| 525 | * conversation. |
| 526 | */ |
| 527 | public static final String SENDER_INFO = "senderInfo"; |
| 528 | /** |
| 529 | * This long column contains the time in ms of the latest update to a |
| 530 | * conversation. |
| 531 | */ |
| 532 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
| 533 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 534 | /** |
| 535 | * This boolean column contains whether any messages in this conversation |
| 536 | * have attachments. |
| 537 | */ |
| 538 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
| 539 | |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 540 | /** |
| 541 | * This int column contains the number of messages in this conversation. |
| 542 | * For unthreaded, this will always be 1. |
| 543 | */ |
| 544 | public static String NUM_MESSAGES = "numMessages"; |
| 545 | |
| 546 | /** |
| 547 | * This int column contains the number of drafts associated with this |
| 548 | * conversation. |
| 549 | */ |
| 550 | public static String NUM_DRAFTS = "numDrafts"; |
| 551 | |
| 552 | /** |
| 553 | * This int column contains the state of drafts and replies associated |
| 554 | * with this conversation. Use ConversationSendingState to interpret |
| 555 | * this field. |
| 556 | */ |
| 557 | public static String SENDING_STATE = "sendingState"; |
| 558 | |
| 559 | /** |
| 560 | * This int column contains the priority of this conversation. Use |
| 561 | * ConversationPriority to interpret this field. |
| 562 | */ |
| 563 | public static String PRIORITY = "priority"; |
| 564 | |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 565 | /** |
| 566 | * This boolean column indicates whether the conversation has been read |
| 567 | */ |
| 568 | public static String READ = "read"; |
| 569 | |
| 570 | /** |
| 571 | * This boolean column indicates whether the conversation has been read |
| 572 | */ |
| 573 | public static String STARRED = "starred"; |
| 574 | |
Mindy Pereira | 36b6c8b | 2012-02-03 14:16:07 -0800 | [diff] [blame] | 575 | /** |
| 576 | * This string column contains a csv of all folders associated with this |
| 577 | * conversation |
| 578 | */ |
| 579 | public static final String FOLDER_LIST = "folderList"; |
| 580 | |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 581 | private ConversationColumns() { |
Andy Huang | 732600e | 2012-01-10 17:47:17 -0800 | [diff] [blame] | 582 | } |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 583 | } |
| 584 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 585 | /** |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 586 | * List of operations that can can be performed on a conversation. These operations are applied |
| 587 | * with {@link ContentProvider#update(Uri, ContentValues, String, String[])} |
| 588 | * where the conversation uri is specified, and the ContentValues specifies the operation to |
| 589 | * be performed. |
| 590 | * <p/> |
| 591 | * The operation to be performed is specified in the ContentValues by |
| 592 | * the {@link ConversationOperations#OPERATION_KEY} |
| 593 | * <p/> |
| 594 | * Note not all UI providers will support these operations. {@link AccountCapabilities} can |
| 595 | * be used to determine which operations are supported. |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 596 | */ |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 597 | public static final class ConversationOperations { |
| 598 | /** |
| 599 | * ContentValues key used to specify the operation to be performed |
| 600 | */ |
| 601 | public static final String OPERATION_KEY = "operation"; |
| 602 | |
| 603 | /** |
| 604 | * Archive operation |
| 605 | */ |
| 606 | public static final String ARCHIVE = "archive"; |
| 607 | |
| 608 | /** |
| 609 | * Mute operation |
| 610 | */ |
| 611 | public static final String MUTE = "mute"; |
| 612 | |
| 613 | /** |
| 614 | * Report spam operation |
| 615 | */ |
| 616 | public static final String REPORT_SPAM = "report_spam"; |
| 617 | |
| 618 | private ConversationOperations() { |
| 619 | } |
| 620 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 621 | |
| 622 | public static final class DraftType { |
Andy Huang | 97c25be | 2012-01-12 15:12:09 -0800 | [diff] [blame] | 623 | public static final int NOT_A_DRAFT = 0; |
| 624 | public static final int COMPOSE = 1; |
| 625 | public static final int REPLY = 2; |
| 626 | public static final int REPLY_ALL = 3; |
| 627 | public static final int FORWARD = 4; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 628 | |
| 629 | private DraftType() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 630 | } |
| 631 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 632 | public static final String[] MESSAGE_PROJECTION = { |
| 633 | BaseColumns._ID, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 634 | MessageColumns.SERVER_ID, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 635 | MessageColumns.URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 636 | MessageColumns.CONVERSATION_ID, |
| 637 | MessageColumns.SUBJECT, |
| 638 | MessageColumns.SNIPPET, |
| 639 | MessageColumns.FROM, |
| 640 | MessageColumns.TO, |
| 641 | MessageColumns.CC, |
| 642 | MessageColumns.BCC, |
| 643 | MessageColumns.REPLY_TO, |
| 644 | MessageColumns.DATE_RECEIVED_MS, |
| 645 | MessageColumns.BODY_HTML, |
| 646 | MessageColumns.BODY_TEXT, |
| 647 | MessageColumns.EMBEDS_EXTERNAL_RESOURCES, |
| 648 | MessageColumns.REF_MESSAGE_ID, |
| 649 | MessageColumns.DRAFT_TYPE, |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 650 | MessageColumns.APPEND_REF_MESSAGE_CONTENT, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 651 | MessageColumns.HAS_ATTACHMENTS, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 652 | MessageColumns.ATTACHMENT_LIST_URI, |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 653 | MessageColumns.MESSAGE_FLAGS, |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 654 | MessageColumns.JOINED_ATTACHMENT_INFOS, |
| 655 | MessageColumns.SAVE_MESSAGE_URI, |
Paul Westbrook | 104f729 | 2012-02-28 16:07:07 -0800 | [diff] [blame] | 656 | MessageColumns.SEND_MESSAGE_URI, |
| 657 | MessageColumns.ALWAYS_SHOW_IMAGES |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 658 | }; |
| 659 | |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 660 | /** Separates attachment info parts in strings in a message. */ |
| 661 | public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n"; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 662 | public static final String MESSAGE_LIST_TYPE = |
| 663 | "vnd.android.cursor.dir/vnd.com.android.mail.message"; |
| 664 | public static final String MESSAGE_TYPE = |
| 665 | "vnd.android.cursor.item/vnd.com.android.mail.message"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 666 | |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 667 | public static final int MESSAGE_ID_COLUMN = 0; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 668 | public static final int MESSAGE_SERVER_ID_COLUMN = 1; |
| 669 | public static final int MESSAGE_URI_COLUMN = 2; |
| 670 | public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3; |
| 671 | public static final int MESSAGE_SUBJECT_COLUMN = 4; |
| 672 | public static final int MESSAGE_SNIPPET_COLUMN = 5; |
| 673 | public static final int MESSAGE_FROM_COLUMN = 6; |
| 674 | public static final int MESSAGE_TO_COLUMN = 7; |
| 675 | public static final int MESSAGE_CC_COLUMN = 8; |
| 676 | public static final int MESSAGE_BCC_COLUMN = 9; |
| 677 | public static final int MESSAGE_REPLY_TO_COLUMN = 10; |
| 678 | public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11; |
Mindy Pereira | 1666816 | 2012-01-11 16:11:19 -0800 | [diff] [blame] | 679 | public static final int MESSAGE_BODY_HTML_COLUMN = 12; |
| 680 | public static final int MESSAGE_BODY_TEXT_COLUMN = 13; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 681 | public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14; |
| 682 | public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15; |
| 683 | public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16; |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 684 | public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17; |
| 685 | public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18; |
| 686 | public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19; |
| 687 | public static final int MESSAGE_FLAGS_COLUMN = 20; |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 688 | public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21; |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 689 | public static final int MESSAGE_SAVE_URI_COLUMN = 22; |
| 690 | public static final int MESSAGE_SEND_URI_COLUMN = 23; |
Paul Westbrook | 104f729 | 2012-02-28 16:07:07 -0800 | [diff] [blame] | 691 | public static final int ALWAYS_SHOW_IMAGES_COLUMN = 24; |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 692 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 693 | public static final class MessageFlags { |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 694 | public static final int STARRED = 1 << 0; |
| 695 | public static final int UNREAD = 1 << 1; |
| 696 | public static final int REPLIED = 1 << 2; |
| 697 | public static final int FORWARDED = 1 << 3; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 698 | } |
| 699 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 700 | public static final class MessageColumns { |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 701 | /** |
| 702 | * This string column contains a content provider URI that points to this single message. |
| 703 | */ |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 704 | public static final String URI = "messageUri"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 705 | /** |
| 706 | * This string column contains a server-assigned ID for this message. |
| 707 | */ |
| 708 | public static final String SERVER_ID = "serverMessageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 709 | public static final String CONVERSATION_ID = "conversationId"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 710 | /** |
| 711 | * This string column contains the subject of a message. |
| 712 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 713 | public static final String SUBJECT = "subject"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 714 | /** |
| 715 | * This string column contains a snippet of the message body. |
| 716 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 717 | public static final String SNIPPET = "snippet"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 718 | /** |
| 719 | * This string column contains the single email address (and optionally name) of the sender. |
| 720 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 721 | public static final String FROM = "fromAddress"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 722 | /** |
| 723 | * This string column contains a comma-delimited list of "To:" recipient email addresses. |
| 724 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 725 | public static final String TO = "toAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 726 | /** |
| 727 | * This string column contains a comma-delimited list of "CC:" recipient email addresses. |
| 728 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 729 | public static final String CC = "ccAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 730 | /** |
| 731 | * This string column contains a comma-delimited list of "BCC:" recipient email addresses. |
| 732 | * This value will be null for incoming messages. |
| 733 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 734 | public static final String BCC = "bccAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 735 | /** |
| 736 | * This string column contains the single email address (and optionally name) of the |
| 737 | * sender's reply-to address. |
| 738 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 739 | public static final String REPLY_TO = "replyToAddress"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 740 | /** |
| 741 | * This long column contains the timestamp (in millis) of receipt of the message. |
| 742 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 743 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 744 | /** |
| 745 | * This string column contains the HTML form of the message body, if available. If not, |
| 746 | * a provider must populate BODY_TEXT. |
| 747 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 748 | public static final String BODY_HTML = "bodyHtml"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 749 | /** |
| 750 | * This string column contains the plaintext form of the message body, if HTML is not |
| 751 | * otherwise available. If HTML is available, this value should be left empty (null). |
| 752 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 753 | public static final String BODY_TEXT = "bodyText"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 754 | public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources"; |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 755 | /** |
| 756 | * This string column contains an opaque string used by the sendMessage api. |
| 757 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 758 | public static final String REF_MESSAGE_ID = "refMessageId"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 759 | /** |
Andy Huang | 97c25be | 2012-01-12 15:12:09 -0800 | [diff] [blame] | 760 | * This integer column contains the type of this draft, or zero (0) if this message is not a |
| 761 | * draft. See {@link DraftType} for possible values. |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 762 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 763 | public static final String DRAFT_TYPE = "draftType"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 764 | /** |
| 765 | * This boolean column indicates whether an outgoing message should trigger special quoted |
| 766 | * text processing upon send. The value should default to zero (0) for protocols that do |
| 767 | * not support or require this flag, and for all incoming messages. |
| 768 | */ |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 769 | public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 770 | /** |
| 771 | * This boolean column indicates whether a message has attachments. The list of attachments |
| 772 | * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}. |
| 773 | */ |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 774 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 775 | /** |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 776 | * This string column contains the content provider URI for the list of |
| 777 | * attachments associated with this message. |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 778 | */ |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 779 | public static final String ATTACHMENT_LIST_URI = "attachmentListUri"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 780 | /** |
| 781 | * This long column is a bit field of flags defined in {@link MessageFlags}. |
| 782 | */ |
Andy Huang | 732600e | 2012-01-10 17:47:17 -0800 | [diff] [blame] | 783 | public static final String MESSAGE_FLAGS = "messageFlags"; |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 784 | /** |
| 785 | * This string column contains a specially formatted string representing all |
| 786 | * attachments that we added to a message that is being sent or saved. |
| 787 | */ |
Mindy Pereira | 84554ec | 2012-01-17 14:44:44 -0800 | [diff] [blame] | 788 | public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos"; |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 789 | /** |
| 790 | * This string column contains the content provider URI for saving this |
| 791 | * message. |
| 792 | */ |
| 793 | public static final String SAVE_MESSAGE_URI = "saveMessageUri"; |
| 794 | /** |
| 795 | * This string column contains content provider URI for sending this |
| 796 | * message. |
| 797 | */ |
| 798 | public static final String SEND_MESSAGE_URI = "sendMessageUri"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 799 | |
Paul Westbrook | 104f729 | 2012-02-28 16:07:07 -0800 | [diff] [blame] | 800 | /** |
| 801 | * This integer column represents whether the user has specified that images should always |
| 802 | * be shown. The value of "1" indicates that the user has specified that images should be |
| 803 | * shown, while the value of "0" indicates that the user should be prompted before loading |
| 804 | * any external images. |
| 805 | */ |
| 806 | public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages"; |
| 807 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 808 | private MessageColumns() {} |
| 809 | } |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 810 | |
| 811 | // We define a "folder" as anything that contains a list of conversations. |
| 812 | public static final String ATTACHMENT_LIST_TYPE = |
| 813 | "vnd.android.cursor.dir/vnd.com.android.mail.attachment"; |
| 814 | public static final String ATTACHMENT_TYPE = |
| 815 | "vnd.android.cursor.item/vnd.com.android.mail.attachment"; |
| 816 | |
| 817 | public static final String[] ATTACHMENT_PROJECTION = { |
| 818 | BaseColumns._ID, |
| 819 | AttachmentColumns.NAME, |
| 820 | AttachmentColumns.SIZE, |
Mindy Pereira | 7a07fb4 | 2012-01-11 10:32:48 -0800 | [diff] [blame] | 821 | AttachmentColumns.URI, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 822 | AttachmentColumns.ORIGIN_EXTRAS, |
| 823 | AttachmentColumns.CONTENT_TYPE, |
| 824 | AttachmentColumns.SYNCED |
| 825 | }; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 826 | private static final String EMAIL_SEPARATOR_PATTERN = "\n"; |
Mindy Pereira | 7a07fb4 | 2012-01-11 10:32:48 -0800 | [diff] [blame] | 827 | public static final int ATTACHMENT_ID_COLUMN = 0; |
| 828 | public static final int ATTACHMENT_NAME_COLUMN = 1; |
| 829 | public static final int ATTACHMENT_SIZE_COLUMN = 2; |
| 830 | public static final int ATTACHMENT_URI_COLUMN = 3; |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 831 | public static final int ATTACHMENT_ORIGIN_EXTRAS_COLUMN = 4; |
| 832 | public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 5; |
| 833 | public static final int ATTACHMENT_SYNCED_COLUMN = 6; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 834 | |
| 835 | public static final class AttachmentColumns { |
| 836 | public static final String NAME = "name"; |
| 837 | public static final String SIZE = "size"; |
Mindy Pereira | 7a07fb4 | 2012-01-11 10:32:48 -0800 | [diff] [blame] | 838 | public static final String URI = "uri"; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 839 | public static final String ORIGIN_EXTRAS = "originExtras"; |
| 840 | public static final String CONTENT_TYPE = "contentType"; |
| 841 | public static final String SYNCED = "synced"; |
| 842 | } |
Mindy Pereira | 013194c | 2012-01-06 15:09:33 -0800 | [diff] [blame] | 843 | |
| 844 | public static int getMailMaxAttachmentSize(String account) { |
| 845 | // TODO: query the account to see what the max attachment size is? |
| 846 | return 5 * 1024 * 1024; |
| 847 | } |
| 848 | |
| 849 | public static String getAttachmentTypeSetting() { |
| 850 | // TODO: query the account to see what kinds of attachments it supports? |
| 851 | return "com.google.android.gm.allowAddAnyAttachment"; |
| 852 | } |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 853 | |
| 854 | public static void incrementRecipientsTimesContacted(Context context, String addressString) { |
| 855 | DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context); |
| 856 | ArrayList<String> recipients = new ArrayList<String>(); |
| 857 | String[] addresses = TextUtils.split(addressString, EMAIL_SEPARATOR_PATTERN); |
| 858 | for (String address : addresses) { |
| 859 | recipients.add(address); |
| 860 | } |
| 861 | statsUpdater.updateWithAddress(recipients); |
| 862 | } |
Marc Blank | b31ab5a | 2012-02-01 12:28:29 -0800 | [diff] [blame] | 863 | |
| 864 | public static final String[] UNDO_PROJECTION = { |
| 865 | ConversationColumns.MESSAGE_LIST_URI |
| 866 | }; |
| 867 | public static final int UNDO_MESSAGE_LIST_COLUMN = 0; |
Marc Blank | dd10bc8 | 2012-02-01 19:10:46 -0800 | [diff] [blame] | 868 | |
| 869 | // Parameter used to indicate the sequence number for an undoable operation |
| 870 | public static final String SEQUENCE_QUERY_PARAMETER = "seq"; |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 871 | |
| 872 | |
| 873 | public static final String[] SETTINGS_PROJECTION = { |
| 874 | SettingsColumns.SIGNATURE, |
| 875 | SettingsColumns.AUTO_ADVANCE, |
| 876 | SettingsColumns.MESSAGE_TEXT_SIZE, |
| 877 | SettingsColumns.SNAP_HEADERS, |
| 878 | SettingsColumns.REPLY_BEHAVIOR, |
| 879 | SettingsColumns.HIDE_CHECKBOXES, |
| 880 | SettingsColumns.CONFIRM_DELETE, |
| 881 | SettingsColumns.CONFIRM_ARCHIVE, |
| 882 | SettingsColumns.CONFIRM_SEND, |
Mindy Pereira | 9783a74 | 2012-03-01 09:13:07 -0800 | [diff] [blame] | 883 | SettingsColumns.DEFAULT_INBOX |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 884 | }; |
| 885 | |
Mindy Pereira | 8bd8215 | 2012-03-01 10:06:35 -0800 | [diff] [blame] | 886 | public static final int SETTINGS_SIGNATURE_COLUMN = 0; |
| 887 | public static final int SETTINGS_AUTO_ADVANCE_COLUMN = 1; |
| 888 | public static final int SETTINGS_MESSAGE_TEXT_SIZE_COLUMN = 2; |
| 889 | public static final int SETTINGS_SNAP_HEADERS_COLUMN = 3; |
| 890 | public static final int SETTINGS_REPLY_BEHAVIOR_COLUMN = 4; |
| 891 | public static final int SETTINGS_HIDE_CHECKBOXES_COLUMN = 5; |
| 892 | public static final int SETTINGS_CONFIRM_DELETE_COLUMN = 6; |
| 893 | public static final int SETTINGS_CONFIRM_ARCHIVE_COLUMN = 7; |
| 894 | public static final int SETTINGS_CONFIRM_SEND_COLUMN = 8; |
| 895 | public static final int SETTINGS_DEFAULT_INBOX_COLUMN = 9; |
| 896 | |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 897 | public static final class AutoAdvance { |
| 898 | public static final int UNSET = 0; |
| 899 | public static final int OLDER = 1; |
| 900 | public static final int NEWER = 2; |
| 901 | public static final int LIST = 3; |
| 902 | } |
| 903 | |
| 904 | public static final class SnapHeaderValue { |
| 905 | public static final int ALWAYS = 0; |
| 906 | public static final int PORTRAIT_ONLY = 1; |
| 907 | public static final int NEVER = 2; |
| 908 | } |
| 909 | |
| 910 | public static final class MessageTextSize { |
| 911 | public static final int TINY = -2; |
| 912 | public static final int SMALL = -1; |
| 913 | public static final int NORMAL = 0; |
| 914 | public static final int LARGE = 1; |
| 915 | public static final int HUGE = 2; |
| 916 | } |
| 917 | |
| 918 | public static final class DefaultReplyBehavior { |
| 919 | public static final int REPLY = 0; |
| 920 | public static final int REPLY_ALL = 1; |
| 921 | } |
| 922 | |
| 923 | public static final class SettingsColumns { |
| 924 | /** |
| 925 | * String column containing the contents of the signature for this account. If no |
| 926 | * signature has been specified, the value will be null. |
| 927 | */ |
| 928 | public static final String SIGNATURE = "signature"; |
| 929 | |
| 930 | /** |
| 931 | * Integer column containing the user's specified auto-advance policy. This value will be |
| 932 | * one of the values in {@link UIProvider.AutoAdvance} |
| 933 | */ |
| 934 | public static final String AUTO_ADVANCE = "auto_advance"; |
| 935 | |
| 936 | /** |
| 937 | * Integer column containing the user's specified message text size preference. This value |
| 938 | * will be one of the values in {@link UIProvider.MessageTextSize} |
| 939 | */ |
| 940 | public static final String MESSAGE_TEXT_SIZE = "message_text_size"; |
| 941 | |
| 942 | /** |
| 943 | * Integer column contaning the user's specified snap header preference. This value |
| 944 | * will be one of the values in {@link UIProvider.SnapHeaderValue} |
| 945 | */ |
| 946 | public static final String SNAP_HEADERS = "snap_headers"; |
| 947 | |
| 948 | /** |
| 949 | * Integer column containing the user's specified default reply behavior. This value will |
| 950 | * be one of the values in {@link UIProvider.DefaultReplyBehavior} |
| 951 | */ |
| 952 | public static final String REPLY_BEHAVIOR = "reply_behavior"; |
| 953 | |
| 954 | /** |
Mindy Pereira | 8bd8215 | 2012-03-01 10:06:35 -0800 | [diff] [blame] | 955 | * Integer column containing the user's specified checkbox preference. A |
| 956 | * non zero value means to hide checkboxes. |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 957 | */ |
| 958 | public static final String HIDE_CHECKBOXES = "hide_checkboxes"; |
| 959 | |
| 960 | /** |
| 961 | * Integer column containing the user's specified confirm delete preference value. |
Mindy Pereira | 8bd8215 | 2012-03-01 10:06:35 -0800 | [diff] [blame] | 962 | * A non zero value indicates that the user has indicated that a confirmation should |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 963 | * be shown when a delete action is performed. |
| 964 | */ |
| 965 | public static final String CONFIRM_DELETE = "confirm_delete"; |
| 966 | |
| 967 | /** |
| 968 | * Integer column containing the user's specified confirm archive preference value. |
Mindy Pereira | 8bd8215 | 2012-03-01 10:06:35 -0800 | [diff] [blame] | 969 | * A non zero value indicates that the user has indicated that a confirmation should |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 970 | * be shown when an archive action is performed. |
| 971 | */ |
| 972 | public static final String CONFIRM_ARCHIVE = "confirm_archive"; |
| 973 | |
| 974 | /** |
| 975 | * Integer column containing the user's specified confirm send preference value. |
Mindy Pereira | 8bd8215 | 2012-03-01 10:06:35 -0800 | [diff] [blame] | 976 | * A non zero value indicates that the user has indicated that a confirmation should |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 977 | * be shown when a send action is performed. |
| 978 | */ |
| 979 | public static final String CONFIRM_SEND = "confirm_send"; |
Mindy Pereira | 9783a74 | 2012-03-01 09:13:07 -0800 | [diff] [blame] | 980 | /** |
| 981 | * String folder containing the serialized default inbox folder for an account. |
| 982 | */ |
| 983 | public static final String DEFAULT_INBOX = "default_inbox"; |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 984 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 985 | } |