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