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