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