Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2011, Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.email.providers; |
| 18 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 19 | import android.provider.BaseColumns; |
| 20 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 21 | import java.lang.String; |
| 22 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 23 | |
| 24 | public class UIProvider { |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 25 | public static final long INVALID_CONVERSATION_ID = -1; |
| 26 | public static final long INVALID_MESSAGE_ID = -1; |
| 27 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 28 | // The actual content provider should define its own authority |
Mindy Pereira | fdd984b | 2011-12-29 09:43:45 -0800 | [diff] [blame] | 29 | public static final String AUTHORITY = "com.android.email.providers"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 30 | |
| 31 | public static final String ACCOUNT_LIST_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 32 | "vnd.android.cursor.dir/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 33 | public static final String ACCOUNT_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 34 | "vnd.android.cursor.item/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 35 | |
| 36 | public static final String[] ACCOUNTS_PROJECTION = { |
| 37 | BaseColumns._ID, |
| 38 | AccountColumns.NAME, |
| 39 | AccountColumns.PROVIDER_VERSION, |
| 40 | AccountColumns.URI, |
| 41 | AccountColumns.CAPABILITIES, |
| 42 | AccountColumns.FOLDER_LIST_URI, |
| 43 | AccountColumns.SEARCH_URI, |
| 44 | AccountColumns.ACCOUNT_FROM_ADDRESSES_URI, |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 45 | AccountColumns.SAVE_NEW_DRAFT_URI, |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 46 | AccountColumns.SEND_MESSAGE_URI |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | public static final class AccountCapabilities { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 50 | public static final int SYNCABLE_FOLDERS = 0x0001; |
| 51 | public static final int REPORT_SPAM = 0x0002; |
| 52 | public static final int ARCHIVE = 0x0004; |
| 53 | public static final int MUTE = 0x0008; |
| 54 | public static final int SERVER_SEARCH = 0x0010; |
| 55 | public static final int FOLDER_SERVER_SEARCH = 0x0020; |
| 56 | public static final int SANITIZED_HTML = 0x0040; |
| 57 | public static final int DRAFT_SYNCHRONIZATION = 0x0080; |
| 58 | public static final int MULTIPLE_FROM_ADDRESSES = 0x0100; |
| 59 | public static final int SMART_REPLY = 0x0200; |
| 60 | public static final int LOCAL_SEARCH = 0x0400; |
| 61 | public static final int THREADED_CONVERSATIONS = 0x0800; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | public static final class AccountColumns { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 65 | /** |
| 66 | * This string column contains the human visible name for the account. |
| 67 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 68 | public static final String NAME = "name"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * This integer column returns the version of the UI provider schema from which this |
| 72 | * account provider will return results. |
| 73 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 74 | public static final String PROVIDER_VERSION = "providerVersion"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * This string column contains the uri to directly access the information for this account. |
| 78 | */ |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 79 | public static final String URI = "accountUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * This integer column contains a bit field of the possible cabibilities that this account |
| 83 | * supports. |
| 84 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 85 | public static final String CAPABILITIES = "capabilities"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 86 | |
| 87 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 88 | * This string column contains the content provider uri to return the |
| 89 | * list of top level folders for this account. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 90 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 91 | public static final String FOLDER_LIST_URI = "folderListUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * This string column contains the content provider uri that can be queried for search |
| 95 | * results. |
| 96 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 97 | public static final String SEARCH_URI = "searchUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * This string column contains the content provider uri that can be queried to access the |
| 101 | * from addresses for this account. |
| 102 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 103 | public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * This string column contains the content provider uri that can be used to save (insert) |
| 107 | * new draft messages for this account. |
| 108 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 109 | public static final String SAVE_NEW_DRAFT_URI = "saveNewDraftUri"; |
| 110 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 111 | /** |
| 112 | * This string column contains the content provider uri that can be used to send |
| 113 | * a message for this account. |
| 114 | * NOTE: This might be better to be an update operation on the messageUri. |
| 115 | */ |
| 116 | public static final String SEND_MESSAGE_URI = "sendMessageUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 117 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 118 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 119 | // We define a "folder" as anything that contains a list of conversations. |
| 120 | public static final String FOLDER_LIST_TYPE = |
| 121 | "vnd.android.cursor.dir/vnd.com.android.mail.folder"; |
| 122 | public static final String FOLDER_TYPE = |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 123 | "vnd.android.cursor.item/vnd.com.android.mail.folder"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 124 | |
| 125 | public static final String[] FOLDERS_PROJECTION = { |
| 126 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 127 | FolderColumns.URI, |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 128 | FolderColumns.NAME, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 129 | FolderColumns.HAS_CHILDREN, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 130 | FolderColumns.CAPABILITIES, |
| 131 | FolderColumns.SYNC_FREQUENCY, |
| 132 | FolderColumns.SYNC_WINDOW, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 133 | FolderColumns.CONVERSATION_LIST_URI, |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 134 | FolderColumns.CHILD_FOLDERS_LIST_URI, |
| 135 | FolderColumns.UNREAD_COUNT, |
| 136 | FolderColumns.TOTAL_COUNT |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 137 | }; |
| 138 | |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 139 | public static final class FolderCapabilities { |
| 140 | public static final int SYNCABLE = 0x0001; |
| 141 | public static final int PARENT = 0x0002; |
| 142 | public static final int CAN_HOLD_MAIL = 0x0004; |
| 143 | public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; |
| 144 | } |
| 145 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 146 | public static final class FolderColumns { |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 147 | public static String URI = "folderUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 148 | /** |
| 149 | * This string column contains the human visible name for the folder. |
| 150 | */ |
| 151 | public static final String NAME = "name"; |
| 152 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 153 | * This int column represents the capabilities of the folder specified by |
| 154 | * FolderCapabilities flags. |
| 155 | */ |
| 156 | public static String CAPABILITIES = "capabilities"; |
| 157 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 158 | * This boolean column represents whether or not this folder has any |
| 159 | * child folders. |
| 160 | */ |
| 161 | public static String HAS_CHILDREN = "hasChildren"; |
| 162 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 163 | * This int column represents how often the folder should be synced. |
| 164 | */ |
| 165 | public static String SYNC_FREQUENCY = "syncFrequency"; |
| 166 | /** |
| 167 | * This int column represents how large the sync window is. |
| 168 | */ |
| 169 | public static String SYNC_WINDOW = "syncWindow"; |
| 170 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 171 | * This string column contains the content provider uri to return the |
| 172 | * list of conversations for this folder. |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 173 | */ |
| 174 | public static final String CONVERSATION_LIST_URI = "conversationListUri"; |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 175 | /** |
| 176 | * This string column contains the content provider uri to return the |
| 177 | * list of child folders of this folder. |
| 178 | */ |
| 179 | public static String CHILD_FOLDERS_LIST_URI = "childFoldersListUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 180 | |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 181 | public static String UNREAD_COUNT = "unreadCount"; |
| 182 | |
| 183 | public static String TOTAL_COUNT = "totalCount"; |
| 184 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 185 | public FolderColumns() {}; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 186 | } |
| 187 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 188 | // We define a "folder" as anything that contains a list of conversations. |
| 189 | public static final String CONVERSATION_LIST_TYPE = |
| 190 | "vnd.android.cursor.dir/vnd.com.android.mail.conversation"; |
| 191 | public static final String CONVERSATION_TYPE = |
| 192 | "vnd.android.cursor.item/vnd.com.android.mail.conversation"; |
| 193 | |
| 194 | public static final String[] CONVERSATION_PROJECTION = { |
| 195 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 196 | ConversationColumns.URI, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 197 | ConversationColumns.MESSAGE_LIST_URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 198 | ConversationColumns.SUBJECT, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 199 | ConversationColumns.SNIPPET, |
| 200 | ConversationColumns.SENDER_INFO, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 201 | ConversationColumns.DATE_RECEIVED_MS, |
| 202 | ConversationColumns.HAS_ATTACHMENTS |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 203 | }; |
| 204 | |
Mindy Pereira | fdd984b | 2011-12-29 09:43:45 -0800 | [diff] [blame] | 205 | // These column indexes only work when the caller uses the |
| 206 | // default CONVERSATION_PROJECTION defined above. |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 207 | public static final int CONVERSATION_ID_COLUMN = 0; |
Mindy Pereira | 3263fa9 | 2012-01-04 10:15:32 -0800 | [diff] [blame] | 208 | public static final int CONVERSATION_URI_COLUMN = 1; |
| 209 | public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2; |
| 210 | public static final int CONVERSATION_SUBJECT_COLUMN = 3; |
| 211 | public static final int CONVERSATION_SNIPPET_COLUMN = 4; |
| 212 | public static final int CONVERSATION_SENDER_INFO_COLUMN = 5; |
| 213 | public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6; |
| 214 | public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7; |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 215 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 216 | public static final class ConversationColumns { |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 217 | public static final String URI = "conversationUri"; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 218 | /** |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 219 | * This string column contains the content provider uri to return the |
| 220 | * list of messages for this conversation. |
| 221 | */ |
| 222 | public static final String MESSAGE_LIST_URI = "messageListUri"; |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 223 | /** |
| 224 | * This string column contains the subject string for a conversation. |
| 225 | */ |
| 226 | public static final String SUBJECT = "subject"; |
| 227 | /** |
| 228 | * This string column contains the snippet string for a conversation. |
| 229 | */ |
| 230 | public static final String SNIPPET = "snippet"; |
| 231 | /** |
| 232 | * This string column contains the sender info string for a |
| 233 | * conversation. |
| 234 | */ |
| 235 | public static final String SENDER_INFO = "senderInfo"; |
| 236 | /** |
| 237 | * This long column contains the time in ms of the latest update to a |
| 238 | * conversation. |
| 239 | */ |
| 240 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
| 241 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 242 | /** |
| 243 | * This boolean column contains whether any messages in this conversation |
| 244 | * have attachments. |
| 245 | */ |
| 246 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
| 247 | |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 248 | public ConversationColumns() { |
| 249 | }; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 250 | } |
| 251 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 252 | /** |
| 253 | * Returns a uri that, when queried, will return a cursor with a list of information for the |
| 254 | * list of configured accounts. |
| 255 | * @return |
| 256 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 257 | // TODO: create a static registry for the starting point for the UI provider. |
| 258 | // public static Uri getAccountsUri() { |
| 259 | // return Uri.parse(BASE_URI_STRING + "/"); |
| 260 | // } |
| 261 | |
| 262 | public static final class DraftType { |
| 263 | public static final String COMPOSE = "compose"; |
| 264 | public static final String REPLY = "reply"; |
| 265 | public static final String REPLY_ALL = "replyAll"; |
| 266 | public static final String FORWARD = "forward"; |
| 267 | |
| 268 | private DraftType() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 269 | } |
| 270 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 271 | public static final String[] MESSAGE_PROJECTION = { |
| 272 | BaseColumns._ID, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 273 | MessageColumns.SERVER_ID, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 274 | MessageColumns.URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 275 | MessageColumns.CONVERSATION_ID, |
| 276 | MessageColumns.SUBJECT, |
| 277 | MessageColumns.SNIPPET, |
| 278 | MessageColumns.FROM, |
| 279 | MessageColumns.TO, |
| 280 | MessageColumns.CC, |
| 281 | MessageColumns.BCC, |
| 282 | MessageColumns.REPLY_TO, |
| 283 | MessageColumns.DATE_RECEIVED_MS, |
| 284 | MessageColumns.BODY_HTML, |
| 285 | MessageColumns.BODY_TEXT, |
| 286 | MessageColumns.EMBEDS_EXTERNAL_RESOURCES, |
| 287 | MessageColumns.REF_MESSAGE_ID, |
| 288 | MessageColumns.DRAFT_TYPE, |
| 289 | MessageColumns.INCLUDE_QUOTED_TEXT, |
| 290 | MessageColumns.QUOTE_START_POS, |
| 291 | MessageColumns.CLIENT_CREATED, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 292 | MessageColumns.CUSTOM_FROM_ADDRESS, |
| 293 | MessageColumns.HAS_ATTACHMENTS, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 294 | MessageColumns.ATTACHMENT_LIST_URI, |
| 295 | MessageColumns.MESSAGE_FLAGS |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 296 | }; |
| 297 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 298 | public static final String MESSAGE_LIST_TYPE = |
| 299 | "vnd.android.cursor.dir/vnd.com.android.mail.message"; |
| 300 | public static final String MESSAGE_TYPE = |
| 301 | "vnd.android.cursor.item/vnd.com.android.mail.message"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 302 | |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 303 | public static final int MESSAGE_ID_COLUMN = 0; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 304 | public static final int MESSAGE_SERVER_ID_COLUMN = 1; |
| 305 | public static final int MESSAGE_URI_COLUMN = 2; |
| 306 | public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3; |
| 307 | public static final int MESSAGE_SUBJECT_COLUMN = 4; |
| 308 | public static final int MESSAGE_SNIPPET_COLUMN = 5; |
| 309 | public static final int MESSAGE_FROM_COLUMN = 6; |
| 310 | public static final int MESSAGE_TO_COLUMN = 7; |
| 311 | public static final int MESSAGE_CC_COLUMN = 8; |
| 312 | public static final int MESSAGE_BCC_COLUMN = 9; |
| 313 | public static final int MESSAGE_REPLY_TO_COLUMN = 10; |
| 314 | public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11; |
| 315 | public static final int MESSAGE_BODY_HTML = 12; |
| 316 | public static final int MESSAGE_BODY_TEXT = 13; |
| 317 | public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14; |
| 318 | public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15; |
| 319 | public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16; |
| 320 | public static final int MESSAGE_INCLUDE_QUOTED_TEXT_COLUMN = 17; |
| 321 | public static final int MESSAGE_QUOTE_START_POS_COLUMN = 18; |
| 322 | public static final int MESSAGE_CLIENT_CREATED_COLUMN = 19; |
| 323 | public static final int MESSAGE_CUSTOM_FROM_ADDRESS_COLUMN = 20; |
| 324 | public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 21; |
| 325 | public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 22; |
| 326 | public static final int MESSAGE_FLAGS_COLUMN = 23; |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 327 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 328 | public static final class MessageFlags { |
| 329 | public static final int SYNCABLE = 0x0001; |
| 330 | public static final int PARENT = 0x0002; |
| 331 | public static final int CAN_HOLD_MAIL = 0x0004; |
| 332 | public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 333 | public static final int STARRED = 0x0012; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 334 | } |
| 335 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 336 | public static final class MessageColumns { |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 337 | public static final String URI = "messageUri"; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 338 | public static final String SERVER_ID = "localMessageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 339 | public static final String CONVERSATION_ID = "conversationId"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 340 | public static final String SUBJECT = "subject"; |
| 341 | public static final String SNIPPET = "snippet"; |
| 342 | public static final String FROM = "fromAddress"; |
| 343 | public static final String TO = "toAddresses"; |
| 344 | public static final String CC = "ccAddresses"; |
| 345 | public static final String BCC = "bccAddresses"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 346 | public static final String REPLY_TO = "replyToAddress"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 347 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 348 | public static final String BODY_HTML = "bodyHtml"; |
| 349 | public static final String BODY_TEXT = "bodyText"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 350 | public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources"; |
| 351 | public static final String REF_MESSAGE_ID = "refMessageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 352 | public static final String DRAFT_TYPE = "draftType"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 353 | public static final String INCLUDE_QUOTED_TEXT = "includeQuotedText"; |
| 354 | public static final String QUOTE_START_POS = "quoteStartPos"; |
| 355 | public static final String CLIENT_CREATED = "clientCreated"; |
| 356 | public static final String CUSTOM_FROM_ADDRESS = "customFromAddress"; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 357 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
| 358 | public static final String ATTACHMENT_LIST_URI = "attachmentListUri"; |
| 359 | public static final String MESSAGE_FLAGS = "messagesFlags"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 360 | |
| 361 | private MessageColumns() {} |
| 362 | } |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 363 | |
| 364 | // We define a "folder" as anything that contains a list of conversations. |
| 365 | public static final String ATTACHMENT_LIST_TYPE = |
| 366 | "vnd.android.cursor.dir/vnd.com.android.mail.attachment"; |
| 367 | public static final String ATTACHMENT_TYPE = |
| 368 | "vnd.android.cursor.item/vnd.com.android.mail.attachment"; |
| 369 | |
| 370 | public static final String[] ATTACHMENT_PROJECTION = { |
| 371 | BaseColumns._ID, |
| 372 | AttachmentColumns.NAME, |
| 373 | AttachmentColumns.SIZE, |
| 374 | AttachmentColumns.ORIGIN, |
| 375 | AttachmentColumns.ORIGIN_EXTRAS, |
| 376 | AttachmentColumns.CONTENT_TYPE, |
| 377 | AttachmentColumns.SYNCED |
| 378 | }; |
| 379 | |
Mindy Pereira | 3263fa9 | 2012-01-04 10:15:32 -0800 | [diff] [blame] | 380 | public static final int ACCOUNT_NAME_COLUMN = 1; |
| 381 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 382 | public static final class AttachmentColumns { |
| 383 | public static final String NAME = "name"; |
| 384 | public static final String SIZE = "size"; |
| 385 | public static final String ORIGIN = "origin"; |
| 386 | public static final String ORIGIN_EXTRAS = "originExtras"; |
| 387 | public static final String CONTENT_TYPE = "contentType"; |
| 388 | public static final String SYNCED = "synced"; |
| 389 | } |
Mindy Pereira | 013194c | 2012-01-06 15:09:33 -0800 | [diff] [blame^] | 390 | |
| 391 | public static int getMailMaxAttachmentSize(String account) { |
| 392 | // TODO: query the account to see what the max attachment size is? |
| 393 | return 5 * 1024 * 1024; |
| 394 | } |
| 395 | |
| 396 | public static String getAttachmentTypeSetting() { |
| 397 | // TODO: query the account to see what kinds of attachments it supports? |
| 398 | return "com.google.android.gm.allowAddAnyAttachment"; |
| 399 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 400 | } |