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