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 | |
Vikram Aggarwal | a9a05d5 | 2012-10-25 13:51:10 -0700 | [diff] [blame] | 20 | import com.google.common.collect.ImmutableMap; |
| 21 | |
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; |
Paul Westbrook | c97d8ac | 2012-03-23 15:21:48 -0700 | [diff] [blame] | 24 | import android.provider.OpenableColumns; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 25 | import android.text.TextUtils; |
mindyp | 845f87e | 2012-09-24 15:14:49 -0700 | [diff] [blame] | 26 | import android.text.util.Rfc822Token; |
| 27 | import android.text.util.Rfc822Tokenizer; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 28 | |
| 29 | import com.android.common.contacts.DataUsageStatUpdater; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 30 | |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 31 | import java.util.ArrayList; |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 32 | import java.util.Map; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 33 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 34 | public class UIProvider { |
Mindy Pereira | 048b5c8 | 2012-04-02 11:11:33 -0700 | [diff] [blame] | 35 | public static final String EMAIL_SEPARATOR = ","; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 36 | public static final long INVALID_CONVERSATION_ID = -1; |
| 37 | public static final long INVALID_MESSAGE_ID = -1; |
| 38 | |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 39 | /** |
| 40 | * Values for the current state of a Folder/Account; note that it's possible that more than one |
| 41 | * sync is in progress |
| 42 | */ |
| 43 | public static final class SyncStatus { |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 44 | /** |
| 45 | * No sync in progress |
| 46 | */ |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 47 | public static final int NO_SYNC = 0; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 48 | /** |
| 49 | * A user-requested sync/refresh is in progress. This occurs when the user taps on the |
| 50 | * refresh icon in the action bar. |
| 51 | */ |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 52 | public static final int USER_REFRESH = 1<<0; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 53 | /** |
| 54 | * A user-requested live query is in progress. This occurs when the user goes past the end |
| 55 | * of the fetched results in the conversation list. |
| 56 | */ |
| 57 | public static final int LIVE_QUERY = 1<<1; |
| 58 | /** Please use the constant {@link #LIVE_QUERY} instead. */ |
| 59 | @Deprecated |
Paul Westbrook | c808fac | 2012-02-22 16:42:18 -0800 | [diff] [blame] | 60 | public static final int USER_QUERY = 1<<1; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 61 | /** |
| 62 | * A background sync is in progress. This happens on <b>no</b> user interaction. |
| 63 | */ |
| 64 | public static final int BACKGROUND_SYNC = 1<<2; |
| 65 | /** |
| 66 | * An initial sync is needed for this Account/Folder to be used. This is account-wide, when |
| 67 | * the user has added an account, and the first sync has not completed successfully. |
| 68 | */ |
| 69 | public static final int INITIAL_SYNC_NEEDED = 1<<3; |
| 70 | /** |
| 71 | * Manual sync is required. This is account-wide, when the user has disabled sync on the |
| 72 | * Gmail account. |
| 73 | */ |
| 74 | public static final int MANUAL_SYNC_REQUIRED = 1<<4; |
Paul Westbrook | dfa1dec | 2012-09-26 16:27:28 -0700 | [diff] [blame] | 75 | /** |
| 76 | * Account initialization is required. |
| 77 | */ |
| 78 | public static final int ACCOUNT_INITIALIZATION_REQUIRED = 1<<5; |
Mindy Pereira | 70a70c9 | 2012-08-02 08:39:45 -0700 | [diff] [blame] | 79 | |
| 80 | public static boolean isSyncInProgress(int syncStatus) { |
| 81 | return 0 != (syncStatus & (BACKGROUND_SYNC | |
| 82 | USER_REFRESH | |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 83 | LIVE_QUERY | |
Mindy Pereira | 70a70c9 | 2012-08-02 08:39:45 -0700 | [diff] [blame] | 84 | USER_MORE_RESULTS)); |
| 85 | } |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 86 | /** |
| 87 | * Unused currently, is not used by any provider. |
| 88 | * TODO(viki): Remove. |
| 89 | */ |
| 90 | public static final int USER_MORE_RESULTS = 1<<5; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Values for the result of the last attempted sync of a Folder/Account |
| 95 | */ |
| 96 | public static final class LastSyncResult { |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 97 | /** The sync completed successfully */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 98 | public static final int SUCCESS = 0; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 99 | /** The sync wasn't completed due to a connection error */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 100 | public static final int CONNECTION_ERROR = 1; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 101 | /** The sync wasn't completed due to an authentication error */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 102 | public static final int AUTH_ERROR = 2; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 103 | /** The sync wasn't completed due to a security error */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 104 | public static final int SECURITY_ERROR = 3; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 105 | /** The sync wasn't completed due to a low memory condition */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 106 | public static final int STORAGE_ERROR = 4; |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 107 | /** The sync wasn't completed due to an internal error/exception */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 108 | public static final int INTERNAL_ERROR = 5; |
| 109 | } |
| 110 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 111 | // The actual content provider should define its own authority |
Andy Huang | 30e2c24 | 2012-01-06 18:14:30 -0800 | [diff] [blame] | 112 | public static final String AUTHORITY = "com.android.mail.providers"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 113 | |
| 114 | public static final String ACCOUNT_LIST_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 115 | "vnd.android.cursor.dir/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 116 | public static final String ACCOUNT_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 117 | "vnd.android.cursor.item/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 118 | |
Paul Westbrook | 2d82d61 | 2012-03-07 09:21:14 -0800 | [diff] [blame] | 119 | /** |
| 120 | * Query parameter key that can be used to control the behavior of list queries. The value |
| 121 | * must be a serialized {@link ListParams} object. UIProvider implementations are not |
| 122 | * required to respect this query parameter |
| 123 | */ |
| 124 | public static final String LIST_PARAMS_QUERY_PARAMETER = "listParams"; |
| 125 | |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 126 | public static final Map<String, Class<?>> ACCOUNTS_COLUMNS = |
| 127 | new ImmutableMap.Builder<String, Class<?>>() |
| 128 | // order matters! (ImmutableMap.Builder preserves insertion order) |
| 129 | .put(BaseColumns._ID, Integer.class) |
| 130 | .put(AccountColumns.NAME, String.class) |
| 131 | .put(AccountColumns.PROVIDER_VERSION, Integer.class) |
| 132 | .put(AccountColumns.URI, String.class) |
| 133 | .put(AccountColumns.CAPABILITIES, Integer.class) |
| 134 | .put(AccountColumns.FOLDER_LIST_URI, String.class) |
| 135 | .put(AccountColumns.FULL_FOLDER_LIST_URI, String.class) |
| 136 | .put(AccountColumns.SEARCH_URI, String.class) |
| 137 | .put(AccountColumns.ACCOUNT_FROM_ADDRESSES, String.class) |
| 138 | .put(AccountColumns.SAVE_DRAFT_URI, String.class) |
| 139 | .put(AccountColumns.SEND_MAIL_URI, String.class) |
| 140 | .put(AccountColumns.EXPUNGE_MESSAGE_URI, String.class) |
| 141 | .put(AccountColumns.UNDO_URI, String.class) |
| 142 | .put(AccountColumns.SETTINGS_INTENT_URI, String.class) |
| 143 | .put(AccountColumns.SYNC_STATUS, Integer.class) |
| 144 | .put(AccountColumns.HELP_INTENT_URI, String.class) |
| 145 | .put(AccountColumns.SEND_FEEDBACK_INTENT_URI, String.class) |
| 146 | .put(AccountColumns.REAUTHENTICATION_INTENT_URI, String.class) |
| 147 | .put(AccountColumns.COMPOSE_URI, String.class) |
| 148 | .put(AccountColumns.MIME_TYPE, String.class) |
| 149 | .put(AccountColumns.RECENT_FOLDER_LIST_URI, String.class) |
| 150 | .put(AccountColumns.COLOR, Integer.class) |
| 151 | .put(AccountColumns.DEFAULT_RECENT_FOLDER_LIST_URI, String.class) |
| 152 | .put(AccountColumns.MANUAL_SYNC_URI, String.class) |
| 153 | .put(AccountColumns.VIEW_INTENT_PROXY_URI, String.class) |
| 154 | .put(AccountColumns.ACCOUNT_COOKIE_QUERY_URI, String.class) |
| 155 | .put(AccountColumns.SettingsColumns.SIGNATURE, String.class) |
| 156 | .put(AccountColumns.SettingsColumns.AUTO_ADVANCE, Integer.class) |
| 157 | .put(AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE, Integer.class) |
| 158 | .put(AccountColumns.SettingsColumns.SNAP_HEADERS, Integer.class) |
| 159 | .put(AccountColumns.SettingsColumns.REPLY_BEHAVIOR, Integer.class) |
Paul Westbrook | 7ed5377 | 2013-01-23 10:19:55 -0800 | [diff] [blame^] | 160 | .put(AccountColumns.SettingsColumns.HIDE_CHECKBOXES, Integer.class) |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 161 | .put(AccountColumns.SettingsColumns.CONFIRM_DELETE, Integer.class) |
| 162 | .put(AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, Integer.class) |
| 163 | .put(AccountColumns.SettingsColumns.CONFIRM_SEND, Integer.class) |
| 164 | .put(AccountColumns.SettingsColumns.DEFAULT_INBOX, String.class) |
| 165 | .put(AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME, String.class) |
| 166 | .put(AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT, Integer.class) |
| 167 | .put(AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE, Integer.class) |
| 168 | .put(AccountColumns.SettingsColumns.SWIPE, Integer.class) |
| 169 | .put(AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED, Integer.class) |
| 170 | .put(AccountColumns.SettingsColumns.SETUP_INTENT_URI, String.class) |
| 171 | .put(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, Integer.class) |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 172 | .put(AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, String.class) |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 173 | .put(AccountColumns.UPDATE_SETTINGS_URI, String.class) |
| 174 | .build(); |
| 175 | |
| 176 | // pull out the (ordered!) keyset from above to form the projection |
| 177 | public static final String[] ACCOUNTS_PROJECTION = ACCOUNTS_COLUMNS.keySet() |
| 178 | .toArray(new String[ACCOUNTS_COLUMNS.size()]); |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 179 | |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 180 | public static final int ACCOUNT_ID_COLUMN = 0; |
| 181 | public static final int ACCOUNT_NAME_COLUMN = 1; |
| 182 | public static final int ACCOUNT_PROVIDER_VERISON_COLUMN = 2; |
| 183 | public static final int ACCOUNT_URI_COLUMN = 3; |
| 184 | public static final int ACCOUNT_CAPABILITIES_COLUMN = 4; |
| 185 | public static final int ACCOUNT_FOLDER_LIST_URI_COLUMN = 5; |
Mindy Pereira | 31d7967 | 2012-06-26 14:43:09 -0700 | [diff] [blame] | 186 | public static final int ACCOUNT_FULL_FOLDER_LIST_URI_COLUMN = 6; |
| 187 | public static final int ACCOUNT_SEARCH_URI_COLUMN = 7; |
| 188 | public static final int ACCOUNT_FROM_ADDRESSES_COLUMN = 8; |
| 189 | public static final int ACCOUNT_SAVE_DRAFT_URI_COLUMN = 9; |
| 190 | public static final int ACCOUNT_SEND_MESSAGE_URI_COLUMN = 10; |
| 191 | public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 11; |
| 192 | public static final int ACCOUNT_UNDO_URI_COLUMN = 12; |
| 193 | public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 13; |
| 194 | public static final int ACCOUNT_SYNC_STATUS_COLUMN = 14; |
| 195 | public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 15; |
| 196 | public static final int ACCOUNT_SEND_FEEDBACK_INTENT_URI_COLUMN = 16; |
Paul Westbrook | 122f7c2 | 2012-08-20 17:50:31 -0700 | [diff] [blame] | 197 | public static final int ACCOUNT_REAUTHENTICATION_INTENT_URI_COLUMN = 17; |
| 198 | public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 18; |
| 199 | public static final int ACCOUNT_MIME_TYPE_COLUMN = 19; |
| 200 | public static final int ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN = 20; |
| 201 | public static final int ACCOUNT_COLOR_COLUMN = 21; |
| 202 | public static final int ACCOUNT_DEFAULT_RECENT_FOLDER_LIST_URI_COLUMN = 22; |
| 203 | public static final int ACCOUNT_MANUAL_SYNC_URI_COLUMN = 23; |
Mark Wei | 9982fdb | 2012-08-30 18:27:46 -0700 | [diff] [blame] | 204 | public static final int ACCOUNT_VIEW_INTENT_PROXY_URI_COLUMN = 24; |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 205 | public static final int ACCOUNT_COOKIE_QUERY_URI_COLUMN = 25; |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 206 | |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 207 | public static final int ACCOUNT_SETTINGS_SIGNATURE_COLUMN = 26; |
| 208 | public static final int ACCOUNT_SETTINGS_AUTO_ADVANCE_COLUMN = 27; |
| 209 | public static final int ACCOUNT_SETTINGS_MESSAGE_TEXT_SIZE_COLUMN = 28; |
| 210 | public static final int ACCOUNT_SETTINGS_SNAP_HEADERS_COLUMN = 29; |
| 211 | public static final int ACCOUNT_SETTINGS_REPLY_BEHAVIOR_COLUMN = 30; |
Paul Westbrook | 7ed5377 | 2013-01-23 10:19:55 -0800 | [diff] [blame^] | 212 | public static final int ACCOUNT_SETTINGS_HIDE_CHECKBOXES_COLUMN = 31; |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 213 | public static final int ACCOUNT_SETTINGS_CONFIRM_DELETE_COLUMN = 32; |
| 214 | public static final int ACCOUNT_SETTINGS_CONFIRM_ARCHIVE_COLUMN = 33; |
| 215 | public static final int ACCOUNT_SETTINGS_CONFIRM_SEND_COLUMN = 34; |
| 216 | public static final int ACCOUNT_SETTINGS_DEFAULT_INBOX_COLUMN = 35; |
| 217 | public static final int ACCOUNT_SETTINGS_DEFAULT_INBOX_NAME_COLUMN = 36; |
| 218 | public static final int ACCOUNT_SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN = 37; |
| 219 | public static final int ACCOUNT_SETTINGS_MAX_ATTACHMENT_SIZE_COLUMN = 38; |
| 220 | public static final int ACCOUNT_SETTINGS_SWIPE_COLUMN = 39; |
| 221 | public static final int ACCOUNT_SETTINGS_PRIORITY_ARROWS_ENABLED_COLUMN = 40; |
| 222 | public static final int ACCOUNT_SETTINGS_SETUP_INTENT_URI = 41; |
Paul Westbrook | fa255c0 | 2012-10-13 14:32:52 -0700 | [diff] [blame] | 223 | public static final int ACCOUNT_SETTINGS_CONVERSATION_MODE_COLUMN = 42; |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 224 | public static final int ACCOUNT_SETTINGS_VEILED_ADDRESS_PATTERN_COLUMN = 43; |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 225 | |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 226 | public static final int ACCOUNT_UPDATE_SETTINGS_URI_COLUMN = 44; |
Scott Kennedy | 0d0f8b0 | 2012-10-12 15:18:18 -0700 | [diff] [blame] | 227 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 228 | public static final class AccountCapabilities { |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 229 | /** |
| 230 | * Whether folders can be synchronized back to the server. |
| 231 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 232 | public static final int SYNCABLE_FOLDERS = 0x0001; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 233 | /** |
| 234 | * Whether the server allows reporting spam back. |
| 235 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 236 | public static final int REPORT_SPAM = 0x0002; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 237 | /** |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 238 | * Whether the server allows reporting phishing back. |
| 239 | */ |
| 240 | public static final int REPORT_PHISHING = 0x0004; |
| 241 | /** |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 242 | * Whether the server supports a concept of Archive: removing mail from the Inbox but |
| 243 | * keeping it around. |
| 244 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 245 | public static final int ARCHIVE = 0x0008; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 246 | /** |
| 247 | * Whether the server will stop notifying on updates to this thread? This requires |
| 248 | * THREADED_CONVERSATIONS to be true, otherwise it should be ignored. |
| 249 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 250 | public static final int MUTE = 0x0010; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 251 | /** |
| 252 | * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS |
| 253 | * to be true, otherwise it should be ignored. |
| 254 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 255 | public static final int SERVER_SEARCH = 0x0020; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 256 | /** |
| 257 | * Whether the server supports constraining search to a single folder. Requires |
| 258 | * SYNCABLE_FOLDERS, otherwise it should be ignored. |
| 259 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 260 | public static final int FOLDER_SERVER_SEARCH = 0x0040; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 261 | /** |
| 262 | * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML). |
| 263 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 264 | public static final int SANITIZED_HTML = 0x0080; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 265 | /** |
| 266 | * Whether the server allows synchronization of draft messages. This does NOT require |
| 267 | * SYNCABLE_FOLDERS to be set. |
| 268 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 269 | public static final int DRAFT_SYNCHRONIZATION = 0x0100; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 270 | /** |
| 271 | * Does the server allow the user to compose mails (and reply) using addresses other than |
| 272 | * their account name? For instance, GMail allows users to set FROM addresses that are |
| 273 | * different from account@gmail.com address. For instance, user@gmail.com could have another |
| 274 | * FROM: address like user@android.com. If the user has enabled multiple FROM address, he |
| 275 | * can compose (and reply) using either address. |
| 276 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 277 | public static final int MULTIPLE_FROM_ADDRESSES = 0x0200; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 278 | /** |
| 279 | * Whether the server allows the original message to be included in the reply by setting a |
| 280 | * flag on the reply. If we can avoid including the entire previous message, we save on |
| 281 | * bandwidth (replies are shorter). |
| 282 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 283 | public static final int SMART_REPLY = 0x0400; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 284 | /** |
| 285 | * Does this account support searching locally, on the device? This requires the backend |
| 286 | * storage to support a mechanism for searching. |
| 287 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 288 | public static final int LOCAL_SEARCH = 0x0800; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 289 | /** |
| 290 | * Whether the server supports a notion of threaded conversations: where replies to messages |
| 291 | * are tagged to keep conversations grouped. This could be full threading (each message |
| 292 | * lists its parent) or conversation-level threading (each message lists one conversation |
| 293 | * which it belongs to) |
| 294 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 295 | public static final int THREADED_CONVERSATIONS = 0x1000; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 296 | /** |
| 297 | * Whether the server supports allowing a conversation to be in multiple folders. (Or allows |
Mindy Pereira | 30fd47b | 2012-03-09 09:24:00 -0800 | [diff] [blame] | 298 | * multiple folders on a single conversation) |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 299 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 300 | public static final int MULTIPLE_FOLDERS_PER_CONV = 0x2000; |
Mindy Pereira | 343ffeb | 2012-02-22 10:12:14 -0800 | [diff] [blame] | 301 | /** |
| 302 | * Whether the provider supports undoing operations. If it doesn't, never show the undo bar. |
| 303 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 304 | public static final int UNDO = 0x4000; |
Paul Westbrook | 94e440d | 2012-02-24 11:03:47 -0800 | [diff] [blame] | 305 | /** |
| 306 | * Whether the account provides help content. |
| 307 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 308 | public static final int HELP_CONTENT = 0x8000; |
Mindy Pereira | 7f0a962 | 2012-02-29 15:00:34 -0800 | [diff] [blame] | 309 | /** |
Paul Westbrook | 517743e | 2012-03-22 10:40:46 -0700 | [diff] [blame] | 310 | * Whether the account provides a way to send feedback content. |
| 311 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 312 | public static final int SEND_FEEDBACK = 0x10000; |
Paul Westbrook | 517743e | 2012-03-22 10:40:46 -0700 | [diff] [blame] | 313 | /** |
Mindy Pereira | 7f0a962 | 2012-02-29 15:00:34 -0800 | [diff] [blame] | 314 | * Whether the account provides a mechanism for marking conversations as important. |
| 315 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 316 | public static final int MARK_IMPORTANT = 0x20000; |
Marc Blank | 5114494 | 2012-03-20 13:59:32 -0700 | [diff] [blame] | 317 | /** |
| 318 | * Whether initial conversation queries should use a limit parameter |
| 319 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 320 | public static final int INITIAL_CONVERSATION_LIMIT = 0x40000; |
Marc Blank | d370792 | 2012-04-24 11:51:50 -0700 | [diff] [blame] | 321 | /** |
| 322 | * Whether the account cannot be used for sending |
| 323 | */ |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 324 | public static final int SENDING_UNAVAILABLE = 0x80000; |
Paul Westbrook | ef36254 | 2012-08-27 14:53:32 -0700 | [diff] [blame] | 325 | /** |
| 326 | * Whether the account supports discarding drafts from a conversation. This should be |
| 327 | * removed when all providers support this capability |
| 328 | */ |
| 329 | public static final int DISCARD_CONVERSATION_DRAFTS = 0x100000; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | public static final class AccountColumns { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 333 | /** |
| 334 | * This string column contains the human visible name for the account. |
| 335 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 336 | public static final String NAME = "name"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 337 | |
| 338 | /** |
Vikram Aggarwal | 6dde178 | 2012-03-12 17:16:48 -0700 | [diff] [blame] | 339 | * This integer contains the type of the account: Google versus non google. This is not |
| 340 | * returned by the UIProvider, rather this is a notion in the system. |
| 341 | */ |
| 342 | public static final String TYPE = "type"; |
| 343 | |
| 344 | /** |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 345 | * This integer column returns the version of the UI provider schema from which this |
| 346 | * account provider will return results. |
| 347 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 348 | public static final String PROVIDER_VERSION = "providerVersion"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 349 | |
| 350 | /** |
| 351 | * This string column contains the uri to directly access the information for this account. |
| 352 | */ |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 353 | public static final String URI = "accountUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 354 | |
| 355 | /** |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 356 | * This integer column contains a bit field of the possible capabilities that this account |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 357 | * supports. |
| 358 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 359 | public static final String CAPABILITIES = "capabilities"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 360 | |
| 361 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 362 | * This string column contains the content provider uri to return the |
| 363 | * list of top level folders for this account. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 364 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 365 | public static final String FOLDER_LIST_URI = "folderListUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 366 | |
| 367 | /** |
Mindy Pereira | 31d7967 | 2012-06-26 14:43:09 -0700 | [diff] [blame] | 368 | * This string column contains the content provider uri to return the |
| 369 | * list of all folders for this account. |
| 370 | */ |
| 371 | public static final String FULL_FOLDER_LIST_URI = "fullFolderListUri"; |
| 372 | |
| 373 | /** |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 374 | * This string column contains the content provider uri that can be queried for search |
| 375 | * results. |
Paul Westbrook | 8130e6f | 2012-03-06 13:51:01 -0800 | [diff] [blame] | 376 | * The supported query parameters are limited to those listed |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 377 | * in {@link SearchQueryParameters} |
Paul Westbrook | 1475a7a | 2012-03-08 15:06:27 -0800 | [diff] [blame] | 378 | * The cursor returned from this query is expected have one row, where the columnm are a |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 379 | * subset of the columns specified in {@link FolderColumns} |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 380 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 381 | public static final String SEARCH_URI = "searchUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 382 | |
| 383 | /** |
Mindy Pereira | 92551d0 | 2012-04-05 11:31:12 -0700 | [diff] [blame] | 384 | * This string column contains a json array of json objects representing |
| 385 | * custom from addresses for this account or null if there are none. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 386 | */ |
Mindy Pereira | 92551d0 | 2012-04-05 11:31:12 -0700 | [diff] [blame] | 387 | public static final String ACCOUNT_FROM_ADDRESSES = "accountFromAddresses"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 388 | |
| 389 | /** |
| 390 | * 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] | 391 | * new draft messages for this account. NOTE: This might be better to |
| 392 | * be an update operation on the messageUri. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 393 | */ |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 394 | @Deprecated |
Mindy Pereira | 33fe908 | 2012-01-09 16:24:30 -0800 | [diff] [blame] | 395 | public static final String SAVE_DRAFT_URI = "saveDraftUri"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 396 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 397 | /** |
| 398 | * This string column contains the content provider uri that can be used to send |
| 399 | * a message for this account. |
| 400 | * NOTE: This might be better to be an update operation on the messageUri. |
| 401 | */ |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 402 | @Deprecated |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 403 | public static final String SEND_MAIL_URI = "sendMailUri"; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 404 | |
| 405 | /** |
| 406 | * This string column contains the content provider uri that can be used |
| 407 | * to expunge a message from this account. NOTE: This might be better to |
| 408 | * be an update operation on the messageUri. |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 409 | * When {@link android.content.ContentResolver#update(Uri, ContentValues, String, String[])} |
| 410 | * is called with this uri, the {@link ContentValues} object is expected to have |
| 411 | * {@link BaseColumns#_ID} specified with the local message id of the message. |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 412 | */ |
| 413 | public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri"; |
Mindy Pereira | 96b5c35 | 2012-02-01 11:33:40 -0800 | [diff] [blame] | 414 | |
| 415 | /** |
| 416 | * This string column contains the content provider uri that can be used |
| 417 | * to undo the last committed action. |
| 418 | */ |
Mindy Pereira | 9600dac | 2012-02-17 15:59:25 -0800 | [diff] [blame] | 419 | public static final String UNDO_URI = "undoUri"; |
Paul Westbrook | 2861b6a | 2012-02-15 15:25:34 -0800 | [diff] [blame] | 420 | |
| 421 | /** |
Paul Westbrook | 9912eee | 2012-02-22 14:49:03 -0800 | [diff] [blame] | 422 | * 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] | 423 | * shown. |
Paul Westbrook | e550355 | 2012-03-28 00:35:57 -0700 | [diff] [blame] | 424 | * Optionally, extra values from {@link EditSettingsExtras} can be used to indicate |
| 425 | * which settings the user wants to edit. |
Paul Westbrook | 2861b6a | 2012-02-15 15:25:34 -0800 | [diff] [blame] | 426 | * TODO: When we want to support a heterogeneous set of account types, this value may need |
| 427 | * to be moved to a global content provider. |
| 428 | */ |
| 429 | public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri"; |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 430 | |
| 431 | /** |
Paul Westbrook | 94e440d | 2012-02-24 11:03:47 -0800 | [diff] [blame] | 432 | * Uri for VIEW intent that will cause the help screens for this account type to be |
| 433 | * shown. |
| 434 | * TODO: When we want to support a heterogeneous set of account types, this value may need |
| 435 | * to be moved to a global content provider. |
| 436 | */ |
| 437 | public static String HELP_INTENT_URI = "helpIntentUri"; |
| 438 | |
| 439 | /** |
Paul Westbrook | 517743e | 2012-03-22 10:40:46 -0700 | [diff] [blame] | 440 | * Uri for VIEW intent that will cause the send feedback for this account type to be |
| 441 | * shown. |
| 442 | * TODO: When we want to support a heterogeneous set of account types, this value may need |
| 443 | * to be moved to a global content provider. |
| 444 | */ |
| 445 | public static String SEND_FEEDBACK_INTENT_URI = "sendFeedbackIntentUri"; |
| 446 | |
| 447 | /** |
Paul Westbrook | 122f7c2 | 2012-08-20 17:50:31 -0700 | [diff] [blame] | 448 | * Uri for VIEW intent that will cause the user to be prompted for authentication for |
| 449 | * this account. startActivityForResult() will be called with this intent. Activities that |
Vikram Aggarwal | 41b9e8f | 2012-09-25 10:15:04 -0700 | [diff] [blame] | 450 | * handle this intent are expected to return {@link android.app.Activity#RESULT_OK} if the |
Paul Westbrook | 122f7c2 | 2012-08-20 17:50:31 -0700 | [diff] [blame] | 451 | * user successfully authenticated. |
| 452 | */ |
| 453 | public static String REAUTHENTICATION_INTENT_URI = "reauthenticationUri"; |
| 454 | |
| 455 | /** |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 456 | * This int column contains the current sync status of the account (the logical AND of the |
| 457 | * sync status of folders in this account) |
| 458 | */ |
| 459 | public static final String SYNC_STATUS = "syncStatus"; |
Mindy Pereira | 23755e2 | 2012-02-27 13:58:04 -0800 | [diff] [blame] | 460 | /** |
| 461 | * Uri for VIEW intent that will cause the compose screens for this type |
| 462 | * of account to be shown. |
| 463 | */ |
| 464 | public static final String COMPOSE_URI = "composeUri"; |
Mindy Pereira | 898cd38 | 2012-03-06 08:42:47 -0800 | [diff] [blame] | 465 | /** |
| 466 | * Mime-type defining this account. |
| 467 | */ |
| 468 | public static final String MIME_TYPE = "mimeType"; |
Vikram Aggarwal | 27e85f2 | 2012-03-05 16:29:17 -0800 | [diff] [blame] | 469 | /** |
| 470 | * URI for location of recent folders viewed on this account. |
| 471 | */ |
| 472 | public static final String RECENT_FOLDER_LIST_URI = "recentFolderListUri"; |
Marc Blank | b287833 | 2012-05-17 15:16:59 -0700 | [diff] [blame] | 473 | /** |
Vikram Aggarwal | 27d89ad | 2012-06-12 13:38:40 -0700 | [diff] [blame] | 474 | * URI for default recent folders for this account, if any. |
| 475 | */ |
| 476 | public static final String DEFAULT_RECENT_FOLDER_LIST_URI = "defaultRecentFolderListUri"; |
| 477 | /** |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 478 | * Color (integer) used for this account (for Email/Combined view) |
Marc Blank | b287833 | 2012-05-17 15:16:59 -0700 | [diff] [blame] | 479 | */ |
| 480 | public static final String COLOR = "color"; |
Mindy Pereira | b378d64 | 2012-07-11 09:46:20 -0700 | [diff] [blame] | 481 | /** |
| 482 | * URI for forcing a manual sync of this account. |
| 483 | */ |
| 484 | public static final String MANUAL_SYNC_URI = "manualSyncUri"; |
Mark Wei | 9982fdb | 2012-08-30 18:27:46 -0700 | [diff] [blame] | 485 | /** |
| 486 | * Optional URI of this account for proxying view intents. |
| 487 | */ |
| 488 | public static final String VIEW_INTENT_PROXY_URI = "viewProxyUri"; |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 489 | /** |
| 490 | * Optional URI for querying for the cookie needed for accessing inline content. The cookie |
| 491 | * specified here will be set on the uri specified in the |
| 492 | * {@link ConversationColumns#CONVERSATION_BASE_URI} column. The cursor returned from this |
| 493 | * query is expected have one row, where the columns are specified in |
| 494 | * {@link AccountCookieColumns} |
| 495 | */ |
| 496 | public static final String ACCOUNT_COOKIE_QUERY_URI = "accountCookieUri"; |
Scott Kennedy | 0d0f8b0 | 2012-10-12 15:18:18 -0700 | [diff] [blame] | 497 | /** |
| 498 | * URI to be used with an update() ContentResolver call with a {@link ContentValues} object |
| 499 | * where the keys are from the {@link AccountColumns.SettingsColumns}, and the values are |
| 500 | * the new values. |
| 501 | */ |
| 502 | public static final String UPDATE_SETTINGS_URI = "updateSettingsUri"; |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 503 | |
| 504 | public static final class SettingsColumns { |
| 505 | /** |
| 506 | * String column containing the contents of the signature for this account. If no |
| 507 | * signature has been specified, the value will be null. |
| 508 | */ |
| 509 | public static final String SIGNATURE = "signature"; |
| 510 | |
| 511 | /** |
| 512 | * Integer column containing the user's specified auto-advance policy. This value will |
| 513 | * be one of the values in {@link UIProvider.AutoAdvance} |
| 514 | */ |
| 515 | public static final String AUTO_ADVANCE = "auto_advance"; |
| 516 | |
| 517 | /** |
| 518 | * Integer column containing the user's specified message text size preference. This |
| 519 | * value will be one of the values in {@link UIProvider.MessageTextSize} |
| 520 | */ |
| 521 | public static final String MESSAGE_TEXT_SIZE = "message_text_size"; |
| 522 | |
| 523 | /** |
| 524 | * Integer column contaning the user's specified snap header preference. This value |
| 525 | * will be one of the values in {@link UIProvider.SnapHeaderValue} |
| 526 | */ |
| 527 | public static final String SNAP_HEADERS = "snap_headers"; |
| 528 | |
| 529 | /** |
| 530 | * Integer column containing the user's specified default reply behavior. This value |
| 531 | * will be one of the values in {@link UIProvider.DefaultReplyBehavior} |
| 532 | */ |
| 533 | public static final String REPLY_BEHAVIOR = "reply_behavior"; |
| 534 | |
| 535 | /** |
| 536 | * Integer column containing the user's specified checkbox preference. A |
Paul Westbrook | 7ed5377 | 2013-01-23 10:19:55 -0800 | [diff] [blame^] | 537 | * non zero value means to hide checkboxes. |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 538 | */ |
Paul Westbrook | 7ed5377 | 2013-01-23 10:19:55 -0800 | [diff] [blame^] | 539 | public static final String HIDE_CHECKBOXES = "hide_checkboxes"; |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 540 | |
| 541 | /** |
| 542 | * Integer column containing the user's specified confirm delete preference value. |
| 543 | * A non zero value indicates that the user has indicated that a confirmation should |
| 544 | * be shown when a delete action is performed. |
| 545 | */ |
| 546 | public static final String CONFIRM_DELETE = "confirm_delete"; |
| 547 | |
| 548 | /** |
| 549 | * Integer column containing the user's specified confirm archive preference value. |
| 550 | * A non zero value indicates that the user has indicated that a confirmation should |
| 551 | * be shown when an archive action is performed. |
| 552 | */ |
| 553 | public static final String CONFIRM_ARCHIVE = "confirm_archive"; |
| 554 | |
| 555 | /** |
| 556 | * Integer column containing the user's specified confirm send preference value. |
| 557 | * A non zero value indicates that the user has indicated that a confirmation should |
| 558 | * be shown when a send action is performed. |
| 559 | */ |
| 560 | public static final String CONFIRM_SEND = "confirm_send"; |
| 561 | /** |
Mindy Pereira | 571de22 | 2012-07-20 09:28:44 -0700 | [diff] [blame] | 562 | * String containing the URI for the default inbox for this account. |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 563 | */ |
| 564 | public static final String DEFAULT_INBOX = "default_inbox"; |
| 565 | /** |
Vikram Aggarwal | 5e63e8a | 2012-07-19 10:05:24 -0700 | [diff] [blame] | 566 | * String containing the name of the default Inbox for this account |
| 567 | */ |
| 568 | public static final String DEFAULT_INBOX_NAME = "default_inbox_name"; |
| 569 | /** |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 570 | * Integer column containing a non zero value if replies should always be sent from |
| 571 | * a default address instead of a recipient. |
| 572 | */ |
Mindy Pereira | 3cd4f40 | 2012-07-17 11:16:18 -0700 | [diff] [blame] | 573 | public static final String FORCE_REPLY_FROM_DEFAULT = "force_reply_from_default"; |
| 574 | /** |
| 575 | * Integer column containing the max attachment size in kb. |
| 576 | */ |
| 577 | public static final String MAX_ATTACHMENT_SIZE = "max_attachment_size"; |
Mindy Pereira | 71a8f5e | 2012-07-25 14:33:18 -0700 | [diff] [blame] | 578 | /** |
| 579 | * Integer column containing a value matching one of the constants from {@link Swipe} |
| 580 | */ |
| 581 | public static final String SWIPE = "swipe"; |
Vikram Aggarwal | 707f24c | 2012-07-31 15:59:36 -0700 | [diff] [blame] | 582 | /** |
Andy Huang | bab9221 | 2012-11-16 18:32:18 -0800 | [diff] [blame] | 583 | * Integer column containing whether priority inbox arrows are enabled. |
Vikram Aggarwal | 707f24c | 2012-07-31 15:59:36 -0700 | [diff] [blame] | 584 | */ |
| 585 | public static final String PRIORITY_ARROWS_ENABLED = "priority_inbox_arrows_enabled"; |
Marc Blank | 5789908 | 2012-09-05 11:35:57 -0700 | [diff] [blame] | 586 | /** |
| 587 | * Uri for EDIT intent that will cause account-specific setup UI to be shown. If not |
| 588 | * null, this intent should be used when an account is "entered" (i.e. viewing a folder |
| 589 | * in the account, etc.) |
| 590 | */ |
| 591 | public static final String SETUP_INTENT_URI = "setup_intent_uri"; |
Paul Westbrook | fa255c0 | 2012-10-13 14:32:52 -0700 | [diff] [blame] | 592 | /** |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 593 | * The regex that defines a veiled address, something that must be hidden from user |
| 594 | * view because it is temporary, long and clumsy. |
| 595 | */ |
Vikram Aggarwal | 6c3875a | 2013-01-15 16:00:11 -0800 | [diff] [blame] | 596 | public static final String VEILED_ADDRESS_PATTERN = "veiled_address_pattern"; |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 597 | /** |
Paul Westbrook | fa255c0 | 2012-10-13 14:32:52 -0700 | [diff] [blame] | 598 | * Integer column containing the Conversation view mode. This value will match one of |
| 599 | * constants from {@link ConversationViewMode} |
| 600 | */ |
| 601 | public static final String CONVERSATION_VIEW_MODE = "conversation_view_mode"; |
Paul Westbrook | b1f573c | 2012-04-06 11:38:28 -0700 | [diff] [blame] | 602 | } |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 603 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 604 | |
Vikram Aggarwal | a9a05d5 | 2012-10-25 13:51:10 -0700 | [diff] [blame] | 605 | /** |
| 606 | * Map to go from account column name to account column. Can only be used through |
| 607 | * {@link #getAccountColumn(String)}. |
| 608 | */ |
| 609 | private static final ImmutableMap<String, Integer> ACCOUNT_TO_ID_MAP = |
| 610 | new ImmutableMap.Builder<String, Integer>() |
| 611 | .put(BaseColumns._ID, ACCOUNT_ID_COLUMN) |
| 612 | .put(AccountColumns.NAME, ACCOUNT_NAME_COLUMN) |
| 613 | .put(AccountColumns.TYPE, -1) |
| 614 | .put(AccountColumns.PROVIDER_VERSION, ACCOUNT_PROVIDER_VERISON_COLUMN) |
| 615 | .put(AccountColumns.URI, ACCOUNT_URI_COLUMN) |
| 616 | .put(AccountColumns.CAPABILITIES, ACCOUNT_CAPABILITIES_COLUMN) |
| 617 | .put(AccountColumns.FOLDER_LIST_URI, ACCOUNT_FOLDER_LIST_URI_COLUMN) |
| 618 | .put(AccountColumns.FULL_FOLDER_LIST_URI, ACCOUNT_FULL_FOLDER_LIST_URI_COLUMN) |
| 619 | .put(AccountColumns.SEARCH_URI, ACCOUNT_SEARCH_URI_COLUMN) |
| 620 | .put(AccountColumns.ACCOUNT_FROM_ADDRESSES, ACCOUNT_FROM_ADDRESSES_COLUMN) |
| 621 | .put(AccountColumns.SAVE_DRAFT_URI, ACCOUNT_SAVE_DRAFT_URI_COLUMN) |
| 622 | .put(AccountColumns.SEND_MAIL_URI, ACCOUNT_SEND_MESSAGE_URI_COLUMN) |
| 623 | .put(AccountColumns.EXPUNGE_MESSAGE_URI, ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN) |
| 624 | .put(AccountColumns.UNDO_URI, ACCOUNT_UNDO_URI_COLUMN) |
| 625 | .put(AccountColumns.SETTINGS_INTENT_URI, ACCOUNT_SETTINGS_INTENT_URI_COLUMN) |
| 626 | .put(AccountColumns.HELP_INTENT_URI, ACCOUNT_HELP_INTENT_URI_COLUMN) |
| 627 | .put(AccountColumns.SEND_FEEDBACK_INTENT_URI, ACCOUNT_SEND_FEEDBACK_INTENT_URI_COLUMN) |
| 628 | .put(AccountColumns.REAUTHENTICATION_INTENT_URI, |
| 629 | ACCOUNT_REAUTHENTICATION_INTENT_URI_COLUMN) |
| 630 | .put(AccountColumns.SYNC_STATUS, ACCOUNT_SYNC_STATUS_COLUMN) |
| 631 | .put(AccountColumns.COMPOSE_URI, ACCOUNT_COMPOSE_INTENT_URI_COLUMN) |
| 632 | .put(AccountColumns.MIME_TYPE, ACCOUNT_MIME_TYPE_COLUMN) |
| 633 | .put(AccountColumns.RECENT_FOLDER_LIST_URI, ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN) |
| 634 | .put(AccountColumns.DEFAULT_RECENT_FOLDER_LIST_URI, |
| 635 | ACCOUNT_DEFAULT_RECENT_FOLDER_LIST_URI_COLUMN) |
| 636 | .put(AccountColumns.COLOR, ACCOUNT_COLOR_COLUMN) |
| 637 | .put(AccountColumns.MANUAL_SYNC_URI, ACCOUNT_MANUAL_SYNC_URI_COLUMN) |
| 638 | .put(AccountColumns.VIEW_INTENT_PROXY_URI, ACCOUNT_VIEW_INTENT_PROXY_URI_COLUMN) |
| 639 | .put(AccountColumns.ACCOUNT_COOKIE_QUERY_URI, ACCOUNT_COOKIE_QUERY_URI_COLUMN) |
| 640 | .put(AccountColumns.SettingsColumns.SIGNATURE, ACCOUNT_SETTINGS_SIGNATURE_COLUMN) |
| 641 | .put(AccountColumns.SettingsColumns.AUTO_ADVANCE, ACCOUNT_SETTINGS_AUTO_ADVANCE_COLUMN) |
| 642 | .put(AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE, |
| 643 | ACCOUNT_SETTINGS_MESSAGE_TEXT_SIZE_COLUMN) |
| 644 | .put(AccountColumns.SettingsColumns.SNAP_HEADERS,ACCOUNT_SETTINGS_SNAP_HEADERS_COLUMN) |
| 645 | .put(AccountColumns.SettingsColumns.REPLY_BEHAVIOR, |
| 646 | ACCOUNT_SETTINGS_REPLY_BEHAVIOR_COLUMN) |
Paul Westbrook | 7ed5377 | 2013-01-23 10:19:55 -0800 | [diff] [blame^] | 647 | .put(AccountColumns.SettingsColumns.HIDE_CHECKBOXES, |
| 648 | ACCOUNT_SETTINGS_HIDE_CHECKBOXES_COLUMN) |
Vikram Aggarwal | a9a05d5 | 2012-10-25 13:51:10 -0700 | [diff] [blame] | 649 | .put(AccountColumns.SettingsColumns.CONFIRM_DELETE, |
| 650 | ACCOUNT_SETTINGS_CONFIRM_DELETE_COLUMN) |
| 651 | .put(AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, |
| 652 | ACCOUNT_SETTINGS_CONFIRM_ARCHIVE_COLUMN) |
| 653 | .put(AccountColumns.SettingsColumns.CONFIRM_SEND, |
| 654 | ACCOUNT_SETTINGS_CONFIRM_SEND_COLUMN) |
| 655 | .put(AccountColumns.SettingsColumns.DEFAULT_INBOX, |
| 656 | ACCOUNT_SETTINGS_DEFAULT_INBOX_COLUMN) |
| 657 | .put(AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME, |
| 658 | ACCOUNT_SETTINGS_DEFAULT_INBOX_NAME_COLUMN) |
| 659 | .put(AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT, |
| 660 | ACCOUNT_SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN) |
| 661 | .put(AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE, |
| 662 | ACCOUNT_SETTINGS_MAX_ATTACHMENT_SIZE_COLUMN) |
| 663 | .put(AccountColumns.SettingsColumns.SWIPE, ACCOUNT_SETTINGS_SWIPE_COLUMN) |
| 664 | .put(AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED, |
| 665 | ACCOUNT_SETTINGS_PRIORITY_ARROWS_ENABLED_COLUMN) |
| 666 | .put(AccountColumns.SettingsColumns.SETUP_INTENT_URI, |
| 667 | ACCOUNT_SETTINGS_SETUP_INTENT_URI) |
| 668 | .put(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, |
| 669 | ACCOUNT_SETTINGS_CONVERSATION_MODE_COLUMN) |
Vikram Aggarwal | 69a6cdf | 2013-01-08 16:05:17 -0800 | [diff] [blame] | 670 | .put(AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, |
| 671 | ACCOUNT_SETTINGS_VEILED_ADDRESS_PATTERN_COLUMN) |
Scott Kennedy | 0d0f8b0 | 2012-10-12 15:18:18 -0700 | [diff] [blame] | 672 | .put(AccountColumns.UPDATE_SETTINGS_URI, ACCOUNT_UPDATE_SETTINGS_URI_COLUMN) |
Vikram Aggarwal | a9a05d5 | 2012-10-25 13:51:10 -0700 | [diff] [blame] | 673 | .build(); |
| 674 | |
| 675 | /** |
| 676 | * Returns the column number for a given column name. The column numbers are guaranteed to be |
| 677 | * unique for distinct column names. Column names are values from {@link AccountColumns} while |
| 678 | * columns are integers. |
| 679 | * @param columnName |
| 680 | * @return |
| 681 | */ |
| 682 | public static final int getAccountColumn(String columnName) { |
| 683 | final Integer id = ACCOUNT_TO_ID_MAP.get(columnName); |
| 684 | if (id == null) { |
| 685 | return -1; |
| 686 | } |
| 687 | return id.intValue(); |
| 688 | } |
| 689 | |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 690 | public static final String[] ACCOUNT_COOKIE_PROJECTION = { |
| 691 | AccountCookieColumns.COOKIE |
| 692 | }; |
| 693 | |
| 694 | public static final class AccountCookieColumns { |
| 695 | /** |
| 696 | * String column containing the cookie string for this account. |
| 697 | */ |
| 698 | public static final String COOKIE = "cookie"; |
| 699 | } |
| 700 | |
Paul Westbrook | 8130e6f | 2012-03-06 13:51:01 -0800 | [diff] [blame] | 701 | public static final class SearchQueryParameters { |
| 702 | /** |
| 703 | * Parameter used to specify the search query. |
| 704 | */ |
| 705 | public static final String QUERY = "query"; |
| 706 | |
| 707 | /** |
| 708 | * If specified, the query results will be limited to this folder. |
| 709 | */ |
| 710 | public static final String FOLDER = "folder"; |
| 711 | |
| 712 | private SearchQueryParameters() {} |
| 713 | } |
| 714 | |
Marc Blank | 5114494 | 2012-03-20 13:59:32 -0700 | [diff] [blame] | 715 | public static final class ConversationListQueryParameters { |
| 716 | public static final String DEFAULT_LIMIT = "50"; |
| 717 | /** |
| 718 | * Parameter used to limit the number of rows returned by a conversation list query |
| 719 | */ |
| 720 | public static final String LIMIT = "limit"; |
| 721 | |
Paul Westbrook | 5f2876a | 2012-03-20 18:47:22 -0700 | [diff] [blame] | 722 | /** |
| 723 | * Parameter used to control whether the this query a remote server. |
| 724 | */ |
| 725 | public static final String USE_NETWORK = "use_network"; |
| 726 | |
Paul Westbrook | 4880b5d | 2012-07-24 09:10:25 -0700 | [diff] [blame] | 727 | /** |
| 728 | * Parameter used to allow the caller to indicate desire to receive all notifications. |
| 729 | * (Including ones for user initiated actions) |
| 730 | */ |
| 731 | public static final String ALL_NOTIFICATIONS = "all_notifications"; |
| 732 | |
Marc Blank | 5114494 | 2012-03-20 13:59:32 -0700 | [diff] [blame] | 733 | private ConversationListQueryParameters() {} |
| 734 | } |
| 735 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 736 | // We define a "folder" as anything that contains a list of conversations. |
| 737 | public static final String FOLDER_LIST_TYPE = |
| 738 | "vnd.android.cursor.dir/vnd.com.android.mail.folder"; |
| 739 | public static final String FOLDER_TYPE = |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 740 | "vnd.android.cursor.item/vnd.com.android.mail.folder"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 741 | |
| 742 | public static final String[] FOLDERS_PROJECTION = { |
| 743 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 744 | FolderColumns.URI, |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 745 | FolderColumns.NAME, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 746 | FolderColumns.HAS_CHILDREN, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 747 | FolderColumns.CAPABILITIES, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 748 | FolderColumns.SYNC_WINDOW, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 749 | FolderColumns.CONVERSATION_LIST_URI, |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 750 | FolderColumns.CHILD_FOLDERS_LIST_URI, |
| 751 | FolderColumns.UNREAD_COUNT, |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 752 | FolderColumns.TOTAL_COUNT, |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 753 | FolderColumns.REFRESH_URI, |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 754 | FolderColumns.SYNC_STATUS, |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 755 | FolderColumns.LAST_SYNC_RESULT, |
| 756 | FolderColumns.TYPE, |
Mindy Pereira | 9275a06 | 2012-03-08 15:12:14 -0800 | [diff] [blame] | 757 | FolderColumns.ICON_RES_ID, |
| 758 | FolderColumns.BG_COLOR, |
Marc Blank | 48a4aed | 2012-03-10 14:07:00 -0800 | [diff] [blame] | 759 | FolderColumns.FG_COLOR, |
Mindy Pereira | c1e8790 | 2012-06-26 11:51:41 -0700 | [diff] [blame] | 760 | FolderColumns.LOAD_MORE_URI, |
| 761 | FolderColumns.HIERARCHICAL_DESC |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 762 | }; |
| 763 | |
Mindy Pereira | 7e5de7a | 2012-03-13 15:36:03 -0700 | [diff] [blame] | 764 | public static final int FOLDER_ID_COLUMN = 0; |
| 765 | public static final int FOLDER_URI_COLUMN = 1; |
| 766 | public static final int FOLDER_NAME_COLUMN = 2; |
| 767 | public static final int FOLDER_HAS_CHILDREN_COLUMN = 3; |
| 768 | public static final int FOLDER_CAPABILITIES_COLUMN = 4; |
| 769 | public static final int FOLDER_SYNC_WINDOW_COLUMN = 5; |
| 770 | public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6; |
| 771 | public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7; |
| 772 | public static final int FOLDER_UNREAD_COUNT_COLUMN = 8; |
| 773 | public static final int FOLDER_TOTAL_COUNT_COLUMN = 9; |
| 774 | public static final int FOLDER_REFRESH_URI_COLUMN = 10; |
| 775 | public static final int FOLDER_SYNC_STATUS_COLUMN = 11; |
| 776 | public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12; |
| 777 | public static final int FOLDER_TYPE_COLUMN = 13; |
| 778 | public static final int FOLDER_ICON_RES_ID_COLUMN = 14; |
| 779 | public static final int FOLDER_BG_COLOR_COLUMN = 15; |
| 780 | public static final int FOLDER_FG_COLOR_COLUMN = 16; |
| 781 | public static final int FOLDER_LOAD_MORE_URI_COLUMN = 17; |
Mindy Pereira | c1e8790 | 2012-06-26 11:51:41 -0700 | [diff] [blame] | 782 | public static final int FOLDER_HIERARCHICAL_DESC_COLUMN = 18; |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 783 | |
| 784 | public static final class FolderType { |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 785 | /** A user defined label. */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 786 | public static final int DEFAULT = 0; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 787 | /** A system defined inbox */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 788 | public static final int INBOX = 1; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 789 | /** A system defined containing mails to be edited before sending. */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 790 | public static final int DRAFT = 2; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 791 | /** A system defined folder containing mails <b>to be</b> sent */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 792 | public static final int OUTBOX = 3; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 793 | /** A system defined folder containing sent mails */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 794 | public static final int SENT = 4; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 795 | /** A system defined trash folder */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 796 | public static final int TRASH = 5; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 797 | /** A system defined spam folder */ |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 798 | public static final int SPAM = 6; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 799 | /** A system defined starred folder */ |
Vikram Aggarwal | 04dc819 | 2012-04-09 13:07:19 -0700 | [diff] [blame] | 800 | public static final int STARRED = 7; |
Vikram Aggarwal | 58cad2e | 2012-08-28 16:18:23 -0700 | [diff] [blame] | 801 | /** Any other system label that we do not have a specific name for. */ |
Mindy Pereira | 9ba4251 | 2012-08-14 11:52:48 -0700 | [diff] [blame] | 802 | public static final int OTHER_PROVIDER_FOLDER = 8; |
mindyp | a849263 | 2012-09-24 09:27:54 -0700 | [diff] [blame] | 803 | /** All mail folder **/ |
| 804 | public static final int ALL_MAIL = 9; |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 805 | } |
Mindy Pereira | 818143e | 2012-01-11 13:59:49 -0800 | [diff] [blame] | 806 | |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 807 | public static final class FolderCapabilities { |
| 808 | public static final int SYNCABLE = 0x0001; |
| 809 | public static final int PARENT = 0x0002; |
| 810 | public static final int CAN_HOLD_MAIL = 0x0004; |
| 811 | public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; |
Marc Blank | a835205 | 2012-04-04 11:37:48 -0700 | [diff] [blame] | 812 | /** |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 813 | * For accounts that support archive, this will indicate that this folder supports |
| 814 | * the archive functionality. |
| 815 | */ |
| 816 | public static final int ARCHIVE = 0x0010; |
| 817 | |
| 818 | /** |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 819 | * This will indicated that this folder supports the delete functionality. |
| 820 | */ |
| 821 | public static final int DELETE = 0x0020; |
| 822 | |
| 823 | /** |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 824 | * For accounts that support report spam, this will indicate that this folder supports |
| 825 | * the report spam functionality. |
| 826 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 827 | public static final int REPORT_SPAM = 0x0040; |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 828 | |
| 829 | /** |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 830 | * For accounts that support report spam, this will indicate that this folder supports |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 831 | * the mark not spam functionality. |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 832 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 833 | public static final int MARK_NOT_SPAM = 0x0080; |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 834 | |
| 835 | /** |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 836 | * For accounts that support mute, this will indicate if a mute is performed from within |
| 837 | * this folder, the action is destructive. |
| 838 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 839 | public static final int DESTRUCTIVE_MUTE = 0x0100; |
Marc Blank | a835205 | 2012-04-04 11:37:48 -0700 | [diff] [blame] | 840 | |
| 841 | /** |
| 842 | * Indicates that a folder supports settings (sync lookback, etc.) |
| 843 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 844 | public static final int SUPPORTS_SETTINGS = 0x0200; |
Vikram Aggarwal | 04dc819 | 2012-04-09 13:07:19 -0700 | [diff] [blame] | 845 | /** |
| 846 | * All the messages in this folder are important. |
| 847 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 848 | public static final int ONLY_IMPORTANT = 0x0400; |
Marc Blank | 386243f | 2012-05-25 10:40:59 -0700 | [diff] [blame] | 849 | /** |
| 850 | * Deletions in this folder can't be undone (could include archive if desirable) |
| 851 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 852 | public static final int DELETE_ACTION_FINAL = 0x0800; |
Marc Blank | a6b671d | 2012-05-25 12:52:02 -0700 | [diff] [blame] | 853 | /** |
| 854 | * This folder is virtual, i.e. contains conversations potentially pulled from other |
| 855 | * folders, potentially even from different accounts. Examples might be a "starred" |
| 856 | * folder, or an "unread" folder (per account or provider-wide) |
| 857 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 858 | public static final int IS_VIRTUAL = 0x1000; |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 859 | |
| 860 | /** |
| 861 | * For accounts that support report phishing, this will indicate that this folder supports |
| 862 | * the report phishing functionality. |
| 863 | */ |
Paul Westbrook | 6102c7d | 2012-08-19 13:20:24 -0700 | [diff] [blame] | 864 | public static final int REPORT_PHISHING = 0x2000; |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 865 | } |
| 866 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 867 | public static final class FolderColumns { |
Paul Westbrook | 0b63e8d | 2012-03-13 11:52:42 -0700 | [diff] [blame] | 868 | /** |
Paul Westbrook | 0b63e8d | 2012-03-13 11:52:42 -0700 | [diff] [blame] | 869 | * This string column contains the uri of the folder. |
| 870 | */ |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 871 | public static final String URI = "folderUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 872 | /** |
| 873 | * This string column contains the human visible name for the folder. |
| 874 | */ |
| 875 | public static final String NAME = "name"; |
| 876 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 877 | * This int column represents the capabilities of the folder specified by |
| 878 | * FolderCapabilities flags. |
| 879 | */ |
| 880 | public static String CAPABILITIES = "capabilities"; |
| 881 | /** |
Mindy Pereira | fc2277e | 2012-01-11 10:23:44 -0800 | [diff] [blame] | 882 | * This int column represents whether or not this folder has any |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 883 | * child folders. |
| 884 | */ |
| 885 | public static String HAS_CHILDREN = "hasChildren"; |
| 886 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame] | 887 | * This int column represents how large the sync window is. |
| 888 | */ |
| 889 | public static String SYNC_WINDOW = "syncWindow"; |
| 890 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 891 | * This string column contains the content provider uri to return the |
| 892 | * list of conversations for this folder. |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 893 | */ |
| 894 | public static final String CONVERSATION_LIST_URI = "conversationListUri"; |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 895 | /** |
| 896 | * This string column contains the content provider uri to return the |
| 897 | * list of child folders of this folder. |
| 898 | */ |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 899 | public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 900 | |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 901 | public static final String UNREAD_COUNT = "unreadCount"; |
Mindy Pereira | bd8f51c | 2012-01-06 13:41:48 -0800 | [diff] [blame] | 902 | |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 903 | public static final String TOTAL_COUNT = "totalCount"; |
Mindy Pereira | 9c00210 | 2012-02-17 14:45:58 -0800 | [diff] [blame] | 904 | /** |
| 905 | * This string column contains the content provider uri to force a |
| 906 | * refresh of this folder. |
| 907 | */ |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 908 | public static final String REFRESH_URI = "refreshUri"; |
| 909 | /** |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 910 | * This int column contains current sync status of the folder; some combination of the |
| 911 | * SyncStatus bits defined above |
Mindy Pereira | 7752864 | 2012-02-17 15:51:10 -0800 | [diff] [blame] | 912 | */ |
Marc Blank | 9ace18a | 2012-02-21 16:34:07 -0800 | [diff] [blame] | 913 | public static final String SYNC_STATUS = "syncStatus"; |
| 914 | /** |
| 915 | * This int column contains the sync status of the last sync attempt; one of the |
| 916 | * LastSyncStatus values defined above |
| 917 | */ |
| 918 | public static final String LAST_SYNC_RESULT = "lastSyncResult"; |
Mindy Pereira | 7866472 | 2012-03-05 13:53:07 -0800 | [diff] [blame] | 919 | /** |
| 920 | * This long column contains the icon res id for this folder, or 0 if there is none. |
| 921 | */ |
| 922 | public static final String ICON_RES_ID = "iconResId"; |
| 923 | /** |
| 924 | * This int column contains the type of the folder. Zero is default. |
| 925 | */ |
| 926 | public static final String TYPE = "type"; |
Mindy Pereira | 9275a06 | 2012-03-08 15:12:14 -0800 | [diff] [blame] | 927 | /** |
| 928 | * String representing the integer background color associated with this |
| 929 | * folder, or null. |
| 930 | */ |
| 931 | public static final String BG_COLOR = "bgColor"; |
| 932 | /** |
| 933 | * String representing the integer of the foreground color associated |
| 934 | * with this folder, or null. |
| 935 | */ |
| 936 | public static final String FG_COLOR = "fgColor"; |
Marc Blank | 48a4aed | 2012-03-10 14:07:00 -0800 | [diff] [blame] | 937 | /** |
| 938 | * String with the content provider Uri used to request more items in the folder, or null. |
| 939 | */ |
| 940 | public static final String LOAD_MORE_URI = "loadMoreUri"; |
Vikram Aggarwal | 27d89ad | 2012-06-12 13:38:40 -0700 | [diff] [blame] | 941 | |
Mindy Pereira | c1e8790 | 2012-06-26 11:51:41 -0700 | [diff] [blame] | 942 | /** |
| 943 | * Possibly empty string that describes the full hierarchy of a folder |
| 944 | * along with its name. |
| 945 | */ |
| 946 | public static final String HIERARCHICAL_DESC = "hierarchicalDesc"; |
| 947 | |
Vikram Aggarwal | ff7d02a | 2012-01-11 16:37:45 -0800 | [diff] [blame] | 948 | public FolderColumns() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 949 | } |
| 950 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 951 | // We define a "folder" as anything that contains a list of conversations. |
| 952 | public static final String CONVERSATION_LIST_TYPE = |
| 953 | "vnd.android.cursor.dir/vnd.com.android.mail.conversation"; |
| 954 | public static final String CONVERSATION_TYPE = |
| 955 | "vnd.android.cursor.item/vnd.com.android.mail.conversation"; |
| 956 | |
Mindy Pereira | 9cdc406 | 2012-02-02 14:18:08 -0800 | [diff] [blame] | 957 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 958 | public static final String[] CONVERSATION_PROJECTION = { |
| 959 | BaseColumns._ID, |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 960 | ConversationColumns.URI, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 961 | ConversationColumns.MESSAGE_LIST_URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 962 | ConversationColumns.SUBJECT, |
Mindy Pereira | f9573c5 | 2011-12-22 14:02:49 -0800 | [diff] [blame] | 963 | ConversationColumns.SNIPPET, |
Mindy Pereira | 648df3f | 2012-07-19 09:20:26 -0700 | [diff] [blame] | 964 | ConversationColumns.CONVERSATION_INFO, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 965 | ConversationColumns.DATE_RECEIVED_MS, |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 966 | ConversationColumns.HAS_ATTACHMENTS, |
| 967 | ConversationColumns.NUM_MESSAGES, |
| 968 | ConversationColumns.NUM_DRAFTS, |
| 969 | ConversationColumns.SENDING_STATE, |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 970 | ConversationColumns.PRIORITY, |
| 971 | ConversationColumns.READ, |
Mindy Pereira | 36b6c8b | 2012-02-03 14:16:07 -0800 | [diff] [blame] | 972 | ConversationColumns.STARRED, |
Mindy Pereira | 2265752 | 2012-03-14 13:27:59 -0700 | [diff] [blame] | 973 | ConversationColumns.RAW_FOLDERS, |
| 974 | ConversationColumns.FLAGS, |
Mindy Pereira | 87d535f | 2012-03-23 11:15:56 -0700 | [diff] [blame] | 975 | ConversationColumns.PERSONAL_LEVEL, |
| 976 | ConversationColumns.SPAM, |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 977 | ConversationColumns.PHISHING, |
Marc Blank | 92939fc | 2012-04-30 14:58:40 -0700 | [diff] [blame] | 978 | ConversationColumns.MUTED, |
Marc Blank | a6b671d | 2012-05-25 12:52:02 -0700 | [diff] [blame] | 979 | ConversationColumns.COLOR, |
Mindy Pereira | 648df3f | 2012-07-19 09:20:26 -0700 | [diff] [blame] | 980 | ConversationColumns.ACCOUNT_URI, |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 981 | ConversationColumns.SENDER_INFO, |
Andy Huang | f98bc89 | 2012-08-07 18:22:09 -0700 | [diff] [blame] | 982 | ConversationColumns.CONVERSATION_BASE_URI, |
| 983 | ConversationColumns.REMOTE |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 984 | }; |
| 985 | |
Mindy Pereira | fdd984b | 2011-12-29 09:43:45 -0800 | [diff] [blame] | 986 | // These column indexes only work when the caller uses the |
| 987 | // default CONVERSATION_PROJECTION defined above. |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 988 | public static final int CONVERSATION_ID_COLUMN = 0; |
Mindy Pereira | 3263fa9 | 2012-01-04 10:15:32 -0800 | [diff] [blame] | 989 | public static final int CONVERSATION_URI_COLUMN = 1; |
| 990 | public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2; |
| 991 | public static final int CONVERSATION_SUBJECT_COLUMN = 3; |
| 992 | public static final int CONVERSATION_SNIPPET_COLUMN = 4; |
Mindy Pereira | 648df3f | 2012-07-19 09:20:26 -0700 | [diff] [blame] | 993 | public static final int CONVERSATION_INFO_COLUMN = 5; |
Mindy Pereira | 3263fa9 | 2012-01-04 10:15:32 -0800 | [diff] [blame] | 994 | public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6; |
| 995 | public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 996 | public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8; |
| 997 | public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9; |
| 998 | public static final int CONVERSATION_SENDING_STATE_COLUMN = 10; |
| 999 | public static final int CONVERSATION_PRIORITY_COLUMN = 11; |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1000 | public static final int CONVERSATION_READ_COLUMN = 12; |
| 1001 | public static final int CONVERSATION_STARRED_COLUMN = 13; |
Mindy Pereira | 00ffece | 2012-07-27 08:49:56 -0700 | [diff] [blame] | 1002 | public static final int CONVERSATION_RAW_FOLDERS_COLUMN = 14; |
| 1003 | public static final int CONVERSATION_FLAGS_COLUMN = 15; |
| 1004 | public static final int CONVERSATION_PERSONAL_LEVEL_COLUMN = 16; |
| 1005 | public static final int CONVERSATION_IS_SPAM_COLUMN = 17; |
| 1006 | public static final int CONVERSATION_IS_PHISHING_COLUMN = 18; |
| 1007 | public static final int CONVERSATION_MUTED_COLUMN = 19; |
| 1008 | public static final int CONVERSATION_COLOR_COLUMN = 20; |
| 1009 | public static final int CONVERSATION_ACCOUNT_URI_COLUMN = 21; |
| 1010 | public static final int CONVERSATION_SENDER_INFO_COLUMN = 22; |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 1011 | public static final int CONVERSATION_BASE_URI_COLUMN = 23; |
Paul Westbrook | b8361c9 | 2012-09-27 10:57:14 -0700 | [diff] [blame] | 1012 | public static final int CONVERSATION_REMOTE_COLUMN = 24; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 1013 | |
| 1014 | public static final class ConversationSendingState { |
Mindy Pereira | a457137 | 2012-01-12 14:04:21 -0800 | [diff] [blame] | 1015 | public static final int OTHER = 0; |
Paul Westbrook | 2c63630 | 2012-08-03 10:12:41 -0700 | [diff] [blame] | 1016 | public static final int QUEUED = 1; |
| 1017 | public static final int SENDING = 2; |
| 1018 | public static final int SENT = 3; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 1019 | public static final int SEND_ERROR = -1; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 1020 | } |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 1021 | |
| 1022 | public static final class ConversationPriority { |
Mindy Pereira | 2265752 | 2012-03-14 13:27:59 -0700 | [diff] [blame] | 1023 | public static final int DEFAULT = 0; |
| 1024 | public static final int IMPORTANT = 1; |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 1025 | public static final int LOW = 0; |
| 1026 | public static final int HIGH = 1; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 1027 | } |
Mindy Pereira | fa7ef6e | 2011-12-29 14:18:15 -0800 | [diff] [blame] | 1028 | |
Mindy Pereira | 2265752 | 2012-03-14 13:27:59 -0700 | [diff] [blame] | 1029 | public static final class ConversationPersonalLevel { |
| 1030 | public static final int NOT_TO_ME = 0; |
| 1031 | public static final int TO_ME_AND_OTHERS = 1; |
| 1032 | public static final int ONLY_TO_ME = 2; |
| 1033 | } |
| 1034 | |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1035 | public static final class ConversationFlags { |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1036 | public static final int REPLIED = 1<<2; |
| 1037 | public static final int FORWARDED = 1<<3; |
Mindy Pereira | d69f5ad | 2012-03-14 13:20:24 -0700 | [diff] [blame] | 1038 | public static final int CALENDAR_INVITE = 1<<4; |
Vikram Aggarwal | 859681b | 2012-02-03 10:02:24 -0800 | [diff] [blame] | 1039 | } |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1040 | |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 1041 | public static final class ConversationPhishing { |
| 1042 | public static final int NOT_PHISHING = 0; |
| 1043 | public static final int PHISHING = 1; |
| 1044 | } |
| 1045 | |
Vikram Aggarwal | 531488e | 2012-05-29 16:36:52 -0700 | [diff] [blame] | 1046 | /** |
| 1047 | * Names of columns representing fields in a Conversation. |
| 1048 | */ |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1049 | public static final class ConversationColumns { |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 1050 | public static final String URI = "conversationUri"; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1051 | /** |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1052 | * This string column contains the content provider uri to return the |
| 1053 | * list of messages for this conversation. |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1054 | * The cursor returned by this query can return a {@link android.os.Bundle} |
| 1055 | * from a call to {@link android.database.Cursor#getExtras()}. This Bundle may have |
| 1056 | * values with keys listed in {@link CursorExtraKeys} |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1057 | */ |
| 1058 | public static final String MESSAGE_LIST_URI = "messageListUri"; |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 1059 | /** |
| 1060 | * This string column contains the subject string for a conversation. |
| 1061 | */ |
| 1062 | public static final String SUBJECT = "subject"; |
| 1063 | /** |
| 1064 | * This string column contains the snippet string for a conversation. |
| 1065 | */ |
| 1066 | public static final String SNIPPET = "snippet"; |
| 1067 | /** |
Mindy Pereira | 648df3f | 2012-07-19 09:20:26 -0700 | [diff] [blame] | 1068 | * @deprecated |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 1069 | */ |
| 1070 | public static final String SENDER_INFO = "senderInfo"; |
| 1071 | /** |
Andy Huang | 351ad4e | 2012-12-06 16:04:58 -0800 | [diff] [blame] | 1072 | * This blob column contains the byte-array representation of the Parceled |
| 1073 | * ConversationInfo object for a conversation. |
Mindy Pereira | 648df3f | 2012-07-19 09:20:26 -0700 | [diff] [blame] | 1074 | */ |
| 1075 | public static final String CONVERSATION_INFO = "conversationInfo"; |
| 1076 | /** |
Mindy Pereira | 27a0cf0 | 2011-12-22 13:16:32 -0800 | [diff] [blame] | 1077 | * This long column contains the time in ms of the latest update to a |
| 1078 | * conversation. |
| 1079 | */ |
| 1080 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
| 1081 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1082 | /** |
| 1083 | * This boolean column contains whether any messages in this conversation |
| 1084 | * have attachments. |
| 1085 | */ |
| 1086 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
| 1087 | |
Mindy Pereira | 4db59c5 | 2012-01-12 09:45:13 -0800 | [diff] [blame] | 1088 | /** |
| 1089 | * This int column contains the number of messages in this conversation. |
| 1090 | * For unthreaded, this will always be 1. |
| 1091 | */ |
| 1092 | public static String NUM_MESSAGES = "numMessages"; |
| 1093 | |
| 1094 | /** |
| 1095 | * This int column contains the number of drafts associated with this |
| 1096 | * conversation. |
| 1097 | */ |
| 1098 | public static String NUM_DRAFTS = "numDrafts"; |
| 1099 | |
| 1100 | /** |
| 1101 | * This int column contains the state of drafts and replies associated |
| 1102 | * with this conversation. Use ConversationSendingState to interpret |
| 1103 | * this field. |
| 1104 | */ |
| 1105 | public static String SENDING_STATE = "sendingState"; |
| 1106 | |
| 1107 | /** |
| 1108 | * This int column contains the priority of this conversation. Use |
| 1109 | * ConversationPriority to interpret this field. |
| 1110 | */ |
| 1111 | public static String PRIORITY = "priority"; |
| 1112 | |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1113 | /** |
Mindy Pereira | 87d535f | 2012-03-23 11:15:56 -0700 | [diff] [blame] | 1114 | * This int column indicates whether the conversation has been read |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1115 | */ |
| 1116 | public static String READ = "read"; |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1117 | /** |
Mindy Pereira | 87d535f | 2012-03-23 11:15:56 -0700 | [diff] [blame] | 1118 | * This int column indicates whether the conversation has been starred |
Marc Blank | c8a9942 | 2012-01-19 14:27:47 -0800 | [diff] [blame] | 1119 | */ |
| 1120 | public static String STARRED = "starred"; |
| 1121 | |
Mindy Pereira | 36b6c8b | 2012-02-03 14:16:07 -0800 | [diff] [blame] | 1122 | /** |
Andy Huang | b2033d8 | 2012-12-07 19:30:57 -0800 | [diff] [blame] | 1123 | * This blob column contains the marshalled form of a Parceled |
| 1124 | * {@FolderList} object. Ideally, only ever use this for |
| 1125 | * rendering the folder list for a conversation. |
Mindy Pereira | cc8211d | 2012-03-12 10:35:37 -0700 | [diff] [blame] | 1126 | */ |
Mindy Pereira | 183718b | 2012-03-12 11:00:14 -0700 | [diff] [blame] | 1127 | public static final String RAW_FOLDERS = "rawFolders"; |
Mindy Pereira | 2265752 | 2012-03-14 13:27:59 -0700 | [diff] [blame] | 1128 | public static final String FLAGS = "conversationFlags"; |
Andy Huang | 1284fd6 | 2012-07-12 16:48:06 -0700 | [diff] [blame] | 1129 | /** |
| 1130 | * This int column indicates the personal level of a conversation per |
| 1131 | * {@link ConversationPersonalLevel}. |
| 1132 | */ |
Mindy Pereira | 2265752 | 2012-03-14 13:27:59 -0700 | [diff] [blame] | 1133 | public static final String PERSONAL_LEVEL = "personalLevel"; |
Mindy Pereira | 87d535f | 2012-03-23 11:15:56 -0700 | [diff] [blame] | 1134 | |
| 1135 | /** |
| 1136 | * This int column indicates whether the conversation is marked spam. |
| 1137 | */ |
| 1138 | public static final String SPAM = "spam"; |
| 1139 | |
| 1140 | /** |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 1141 | * This int column indicates whether the conversation is marked phishing. |
| 1142 | */ |
| 1143 | public static final String PHISHING = "phishing"; |
| 1144 | |
| 1145 | /** |
Mindy Pereira | 87d535f | 2012-03-23 11:15:56 -0700 | [diff] [blame] | 1146 | * This int column indicates whether the conversation was muted. |
| 1147 | */ |
| 1148 | public static final String MUTED = "muted"; |
| 1149 | |
Marc Blank | 92939fc | 2012-04-30 14:58:40 -0700 | [diff] [blame] | 1150 | /** |
| 1151 | * This int column contains a color for the conversation (used in Email only) |
| 1152 | */ |
| 1153 | public static final String COLOR = "color"; |
| 1154 | |
Marc Blank | a6b671d | 2012-05-25 12:52:02 -0700 | [diff] [blame] | 1155 | /** |
| 1156 | * This String column contains the Uri for this conversation's account |
| 1157 | */ |
| 1158 | public static final String ACCOUNT_URI = "accountUri"; |
Vikram Aggarwal | 66bc2aa | 2012-08-02 10:47:03 -0700 | [diff] [blame] | 1159 | /** |
Andy Huang | f98bc89 | 2012-08-07 18:22:09 -0700 | [diff] [blame] | 1160 | * This int column indicates whether a conversation is remote (non-local), and would require |
| 1161 | * a network fetch to load. |
| 1162 | */ |
| 1163 | public static final String REMOTE = "remote"; |
| 1164 | /** |
Vikram Aggarwal | 66bc2aa | 2012-08-02 10:47:03 -0700 | [diff] [blame] | 1165 | * This int column indicates whether the conversation was displayed on the UI and the |
| 1166 | * user got a chance to read it. The UI does not read this value, it is meant only to |
| 1167 | * write the status back to the provider. As a result, it is not available in the |
| 1168 | * {@link Conversation} object. |
| 1169 | */ |
Andy Huang | f98bc89 | 2012-08-07 18:22:09 -0700 | [diff] [blame] | 1170 | public static final String VIEWED = "viewed"; |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 1171 | /** |
| 1172 | * This String column contains the base uri for this conversation. This uri can be used |
| 1173 | * when handling relative urls in the message content |
| 1174 | */ |
| 1175 | public static final String CONVERSATION_BASE_URI = "conversationBaseUri"; |
| 1176 | |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 1177 | private ConversationColumns() { |
Andy Huang | 732600e | 2012-01-10 17:47:17 -0800 | [diff] [blame] | 1178 | } |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1179 | } |
| 1180 | |
Andy Huang | ca85441 | 2012-04-20 19:55:38 -0700 | [diff] [blame] | 1181 | public static final class ConversationCursorCommand { |
| 1182 | |
| 1183 | public static final String COMMAND_RESPONSE_OK = "ok"; |
| 1184 | public static final String COMMAND_RESPONSE_FAILED = "failed"; |
| 1185 | |
| 1186 | /** |
| 1187 | * This bundle key has a boolean value: true to allow cursor network access (whether this |
| 1188 | * is true by default is up to the provider), false to temporarily disable network access. |
| 1189 | * <p> |
| 1190 | * A provider that implements this command should include this key in its response with a |
| 1191 | * value of {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}. |
| 1192 | */ |
| 1193 | public static final String COMMAND_KEY_ALLOW_NETWORK_ACCESS = "allowNetwork"; |
| 1194 | |
Paul Westbrook | 9f119c7 | 2012-04-24 16:10:59 -0700 | [diff] [blame] | 1195 | /** |
| 1196 | * This bundle key has a boolean value: true to indicate that this cursor has been shown |
| 1197 | * to the user. |
Vikram Aggarwal | 69b5c30 | 2012-09-05 11:11:13 -0700 | [diff] [blame] | 1198 | * <p> |
| 1199 | * A provider that implements this command should include this key in its response with a |
| 1200 | * value of {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}. |
Paul Westbrook | 9f119c7 | 2012-04-24 16:10:59 -0700 | [diff] [blame] | 1201 | */ |
| 1202 | public static final String COMMAND_KEY_SET_VISIBILITY = "setVisibility"; |
| 1203 | |
Vikram Aggarwal | 69b5c30 | 2012-09-05 11:11:13 -0700 | [diff] [blame] | 1204 | /** |
| 1205 | * This key has a boolean value: true to indicate that this folder list is shown to the user |
| 1206 | * either on first call (launcher/widget/notification) or after switching from an existing |
| 1207 | * folder: Inbox -> Folder. Repeated calls are sent when switching back to the folder. Inbox |
| 1208 | * -> Folder -> Spam -> Folder will generate two calls to respond() with the value true for |
| 1209 | * "Folder". |
| 1210 | * <p> |
| 1211 | * A provider that implements this command should include the |
| 1212 | * {@link #COMMAND_KEY_SET_VISIBILITY} key in its response with a value of |
| 1213 | * {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}. This is <b>always</b> |
| 1214 | * set with {@link #COMMAND_KEY_SET_VISIBILITY} because this is only set when the folder |
| 1215 | * list is made visible. |
| 1216 | */ |
| 1217 | public static final String COMMAND_KEY_ENTERED_FOLDER = "enteredFolder"; |
| 1218 | |
Andy Huang | ca85441 | 2012-04-20 19:55:38 -0700 | [diff] [blame] | 1219 | private ConversationCursorCommand() {} |
| 1220 | } |
| 1221 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1222 | /** |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 1223 | * List of operations that can can be performed on a conversation. These operations are applied |
| 1224 | * with {@link ContentProvider#update(Uri, ContentValues, String, String[])} |
| 1225 | * where the conversation uri is specified, and the ContentValues specifies the operation to |
| 1226 | * be performed. |
| 1227 | * <p/> |
| 1228 | * The operation to be performed is specified in the ContentValues by |
| 1229 | * the {@link ConversationOperations#OPERATION_KEY} |
| 1230 | * <p/> |
| 1231 | * Note not all UI providers will support these operations. {@link AccountCapabilities} can |
| 1232 | * be used to determine which operations are supported. |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1233 | */ |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 1234 | public static final class ConversationOperations { |
| 1235 | /** |
| 1236 | * ContentValues key used to specify the operation to be performed |
| 1237 | */ |
| 1238 | public static final String OPERATION_KEY = "operation"; |
| 1239 | |
| 1240 | /** |
| 1241 | * Archive operation |
| 1242 | */ |
| 1243 | public static final String ARCHIVE = "archive"; |
| 1244 | |
| 1245 | /** |
| 1246 | * Mute operation |
| 1247 | */ |
| 1248 | public static final String MUTE = "mute"; |
| 1249 | |
| 1250 | /** |
| 1251 | * Report spam operation |
| 1252 | */ |
| 1253 | public static final String REPORT_SPAM = "report_spam"; |
| 1254 | |
Paul Westbrook | 77eee62 | 2012-07-10 13:41:57 -0700 | [diff] [blame] | 1255 | /** |
| 1256 | * Report not spam operation |
| 1257 | */ |
| 1258 | public static final String REPORT_NOT_SPAM = "report_not_spam"; |
| 1259 | |
Paul Westbrook | 76b2062 | 2012-07-12 11:45:43 -0700 | [diff] [blame] | 1260 | /** |
| 1261 | * Report phishing operation |
| 1262 | */ |
| 1263 | public static final String REPORT_PHISHING = "report_phishing"; |
| 1264 | |
Paul Westbrook | ef36254 | 2012-08-27 14:53:32 -0700 | [diff] [blame] | 1265 | /** |
| 1266 | * Discard drafts operation |
| 1267 | */ |
| 1268 | public static final String DISCARD_DRAFTS = "discard_drafts"; |
| 1269 | |
mindyp | cb0b30e | 2012-11-30 10:16:35 -0800 | [diff] [blame] | 1270 | /** |
| 1271 | * Update conversation folder(s) operation. ContentValues passed as part |
| 1272 | * of this update will be of the format (FOLDERS_UPDATED, csv of updated |
| 1273 | * folders) where the comma separated values of the updated folders will |
| 1274 | * be of the format: folderuri/ADD_VALUE. ADD_VALUE will be true if the |
| 1275 | * folder was added, false if it was removed. |
| 1276 | */ |
| 1277 | public static final String FOLDERS_UPDATED = "folders_updated"; |
| 1278 | public static final String FOLDERS_UPDATED_SPLIT_PATTERN = ","; |
Paul Westbrook | 5109c51 | 2012-11-05 11:00:30 -0800 | [diff] [blame] | 1279 | |
| 1280 | public static final class Parameters { |
| 1281 | /** |
| 1282 | * Boolean indicating whether the undo for this operation should be suppressed |
| 1283 | */ |
| 1284 | public static final String SUPPRESS_UNDO = "suppress_undo"; |
| 1285 | |
| 1286 | private Parameters() {} |
| 1287 | } |
| 1288 | |
Paul Westbrook | 334e64a | 2012-02-23 13:26:35 -0800 | [diff] [blame] | 1289 | private ConversationOperations() { |
| 1290 | } |
| 1291 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1292 | |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 1293 | /** |
| 1294 | * Methods that can be "called" using the account uri, through |
| 1295 | * {@link android.content.ContentResolver#call()} Note, the arg parmateter of call should be |
| 1296 | * the account uri. |
| 1297 | */ |
| 1298 | public static final class AccountCallMethods { |
| 1299 | /** |
| 1300 | * Save message method. The Bundle for the call to |
| 1301 | * {@link android.content.ContentResolver#call()} should have the columns specified in |
| 1302 | * {@link MessageColumns}, and if this is a save for an existing message, an entry for the |
| 1303 | * {@link MessageColumns#URI} should reference the existing message |
| 1304 | * |
| 1305 | * The Bundle returned will contain the message uri in the returned bundled with the |
| 1306 | * {@link MessageColumns#URI} key. |
| 1307 | */ |
| 1308 | public static final String SAVE_MESSAGE = "save_message"; |
| 1309 | |
| 1310 | /** |
| 1311 | * Send message method. The Bundle for the call to |
| 1312 | * {@link android.content.ContentResolver#call()} should have the columns specified in |
| 1313 | * {@link MessageColumns}, and if this is a send of an existing message, an entry for the |
| 1314 | * {@link MessageColumns#URI} should reference the existing message |
| 1315 | * |
| 1316 | * The Bundle returned will contain the message uri in the returned bundled with the |
| 1317 | * {@link MessageColumns#URI} key. |
| 1318 | */ |
| 1319 | public static final String SEND_MESSAGE = "send_message"; |
| 1320 | |
Scott Banachowski | 53a615d | 2012-12-19 15:31:20 -0800 | [diff] [blame] | 1321 | /** |
| 1322 | * Change account method. The Bundle for the call to |
| 1323 | * {@link android.content.ContentResolver#call()} should have the columns specified in |
| 1324 | * {@link SetCurrentAccountColumns} |
| 1325 | * |
| 1326 | * The Bundle returned will be empty. |
| 1327 | */ |
| 1328 | public static final String SET_CURRENT_ACCOUNT = "set_current_account"; |
| 1329 | |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 1330 | private AccountCallMethods() {} |
| 1331 | } |
| 1332 | |
Paul Westbrook | 3c7f94d | 2012-10-23 14:13:00 -0700 | [diff] [blame] | 1333 | /** |
| 1334 | * Keys used for parameters to {@link AccountCallMethods#SEND_MESSAGE} or |
| 1335 | * {@link AccountCallMethods#SAVE_MESSAGE} methods. |
| 1336 | */ |
| 1337 | public static final class SendOrSaveMethodParamKeys { |
| 1338 | /** |
| 1339 | * Bundle key used to store any opened file descriptors. |
| 1340 | * The keys of this Bundle are the contentUri for each attachment, and the |
| 1341 | * values are {@link android.os.ParcelFileDescriptor} objects. |
| 1342 | */ |
| 1343 | public static final String OPENED_FD_MAP = "opened_fds"; |
| 1344 | |
| 1345 | private SendOrSaveMethodParamKeys() {} |
| 1346 | } |
| 1347 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1348 | public static final class DraftType { |
Andy Huang | 97c25be | 2012-01-12 15:12:09 -0800 | [diff] [blame] | 1349 | public static final int NOT_A_DRAFT = 0; |
| 1350 | public static final int COMPOSE = 1; |
| 1351 | public static final int REPLY = 2; |
| 1352 | public static final int REPLY_ALL = 3; |
| 1353 | public static final int FORWARD = 4; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1354 | |
| 1355 | private DraftType() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1356 | } |
| 1357 | |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1358 | /** |
| 1359 | * Class for the enum values to determine whether this |
| 1360 | * string should be displayed as a high priority warning |
| 1361 | * or a low priority warning. The current design has |
| 1362 | * high priority warnings in red while low priority warnings |
| 1363 | * are grey. |
| 1364 | */ |
| 1365 | public static final class SpamWarningLevel { |
| 1366 | public static final int NO_WARNING = 0; |
| 1367 | public static final int LOW_WARNING = 1; |
| 1368 | public static final int HIGH_WARNING = 2; |
| 1369 | |
| 1370 | private SpamWarningLevel() {} |
| 1371 | } |
| 1372 | |
| 1373 | /** |
| 1374 | * Class for the enum values to determine which type |
| 1375 | * of link to show in the spam warning. |
| 1376 | */ |
| 1377 | public static final class SpamWarningLinkType { |
| 1378 | public static final int NO_LINK = 0; |
| 1379 | public static final int IGNORE_WARNING = 1; |
| 1380 | public static final int REPORT_PHISHING = 2; |
| 1381 | |
| 1382 | private SpamWarningLinkType() {} |
| 1383 | } |
| 1384 | |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1385 | public static final String[] MESSAGE_PROJECTION = { |
| 1386 | BaseColumns._ID, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 1387 | MessageColumns.SERVER_ID, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1388 | MessageColumns.URI, |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1389 | MessageColumns.CONVERSATION_ID, |
| 1390 | MessageColumns.SUBJECT, |
| 1391 | MessageColumns.SNIPPET, |
| 1392 | MessageColumns.FROM, |
| 1393 | MessageColumns.TO, |
| 1394 | MessageColumns.CC, |
| 1395 | MessageColumns.BCC, |
| 1396 | MessageColumns.REPLY_TO, |
| 1397 | MessageColumns.DATE_RECEIVED_MS, |
| 1398 | MessageColumns.BODY_HTML, |
| 1399 | MessageColumns.BODY_TEXT, |
| 1400 | MessageColumns.EMBEDS_EXTERNAL_RESOURCES, |
| 1401 | MessageColumns.REF_MESSAGE_ID, |
| 1402 | MessageColumns.DRAFT_TYPE, |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 1403 | MessageColumns.APPEND_REF_MESSAGE_CONTENT, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1404 | MessageColumns.HAS_ATTACHMENTS, |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 1405 | MessageColumns.ATTACHMENT_LIST_URI, |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1406 | MessageColumns.MESSAGE_FLAGS, |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1407 | MessageColumns.JOINED_ATTACHMENT_INFOS, |
| 1408 | MessageColumns.SAVE_MESSAGE_URI, |
Paul Westbrook | 104f729 | 2012-02-28 16:07:07 -0800 | [diff] [blame] | 1409 | MessageColumns.SEND_MESSAGE_URI, |
Mindy Pereira | e8caf12 | 2012-03-20 15:23:31 -0700 | [diff] [blame] | 1410 | MessageColumns.ALWAYS_SHOW_IMAGES, |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 1411 | MessageColumns.READ, |
| 1412 | MessageColumns.STARRED, |
Andy Huang | 5a92907 | 2012-03-23 20:17:10 -0700 | [diff] [blame] | 1413 | MessageColumns.QUOTE_START_POS, |
Mindy Pereira | 92551d0 | 2012-04-05 11:31:12 -0700 | [diff] [blame] | 1414 | MessageColumns.ATTACHMENTS, |
Mindy Pereira | 62de1b1 | 2012-04-06 12:17:56 -0700 | [diff] [blame] | 1415 | MessageColumns.CUSTOM_FROM_ADDRESS, |
Marc Blank | 3842af9 | 2012-04-27 09:06:09 -0700 | [diff] [blame] | 1416 | MessageColumns.MESSAGE_ACCOUNT_URI, |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1417 | MessageColumns.EVENT_INTENT_URI, |
| 1418 | MessageColumns.SPAM_WARNING_STRING, |
| 1419 | MessageColumns.SPAM_WARNING_LEVEL, |
Andrew Sapperstein | d5b369b | 2012-07-13 12:38:46 -0700 | [diff] [blame] | 1420 | MessageColumns.SPAM_WARNING_LINK_TYPE, |
Andy Huang | 47aa9c9 | 2012-07-31 15:37:21 -0700 | [diff] [blame] | 1421 | MessageColumns.VIA_DOMAIN, |
| 1422 | MessageColumns.IS_SENDING |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1423 | }; |
| 1424 | |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1425 | /** Separates attachment info parts in strings in a message. */ |
Andy Huang | 5c5fd57 | 2012-04-08 18:19:29 -0700 | [diff] [blame] | 1426 | @Deprecated |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1427 | public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n"; |
Mindy Pereira | a140607 | 2011-12-22 10:54:06 -0800 | [diff] [blame] | 1428 | public static final String MESSAGE_LIST_TYPE = |
| 1429 | "vnd.android.cursor.dir/vnd.com.android.mail.message"; |
| 1430 | public static final String MESSAGE_TYPE = |
| 1431 | "vnd.android.cursor.item/vnd.com.android.mail.message"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1432 | |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 1433 | public static final int MESSAGE_ID_COLUMN = 0; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 1434 | public static final int MESSAGE_SERVER_ID_COLUMN = 1; |
| 1435 | public static final int MESSAGE_URI_COLUMN = 2; |
Marc Blank | 26846d8 | 2012-03-22 18:12:54 -0700 | [diff] [blame] | 1436 | public static final int MESSAGE_CONVERSATION_URI_COLUMN = 3; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 1437 | public static final int MESSAGE_SUBJECT_COLUMN = 4; |
| 1438 | public static final int MESSAGE_SNIPPET_COLUMN = 5; |
| 1439 | public static final int MESSAGE_FROM_COLUMN = 6; |
| 1440 | public static final int MESSAGE_TO_COLUMN = 7; |
| 1441 | public static final int MESSAGE_CC_COLUMN = 8; |
| 1442 | public static final int MESSAGE_BCC_COLUMN = 9; |
| 1443 | public static final int MESSAGE_REPLY_TO_COLUMN = 10; |
| 1444 | public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11; |
Mindy Pereira | 1666816 | 2012-01-11 16:11:19 -0800 | [diff] [blame] | 1445 | public static final int MESSAGE_BODY_HTML_COLUMN = 12; |
| 1446 | public static final int MESSAGE_BODY_TEXT_COLUMN = 13; |
Mindy Pereira | 326c660 | 2012-01-04 15:32:42 -0800 | [diff] [blame] | 1447 | public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14; |
| 1448 | public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15; |
| 1449 | public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16; |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 1450 | public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17; |
| 1451 | public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18; |
| 1452 | public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19; |
| 1453 | public static final int MESSAGE_FLAGS_COLUMN = 20; |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1454 | public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21; |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1455 | public static final int MESSAGE_SAVE_URI_COLUMN = 22; |
| 1456 | public static final int MESSAGE_SEND_URI_COLUMN = 23; |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 1457 | public static final int MESSAGE_ALWAYS_SHOW_IMAGES_COLUMN = 24; |
| 1458 | public static final int MESSAGE_READ_COLUMN = 25; |
| 1459 | public static final int MESSAGE_STARRED_COLUMN = 26; |
Mindy Pereira | 4b8e44b | 2012-03-21 17:20:10 -0700 | [diff] [blame] | 1460 | public static final int QUOTED_TEXT_OFFSET_COLUMN = 27; |
Andy Huang | 5a92907 | 2012-03-23 20:17:10 -0700 | [diff] [blame] | 1461 | public static final int MESSAGE_ATTACHMENTS_COLUMN = 28; |
Mindy Pereira | 92551d0 | 2012-04-05 11:31:12 -0700 | [diff] [blame] | 1462 | public static final int MESSAGE_CUSTOM_FROM_ADDRESS_COLUMN = 29; |
Mindy Pereira | 62de1b1 | 2012-04-06 12:17:56 -0700 | [diff] [blame] | 1463 | public static final int MESSAGE_ACCOUNT_URI_COLUMN = 30; |
Marc Blank | 3842af9 | 2012-04-27 09:06:09 -0700 | [diff] [blame] | 1464 | public static final int MESSAGE_EVENT_INTENT_COLUMN = 31; |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1465 | public static final int MESSAGE_SPAM_WARNING_STRING_ID_COLUMN = 32; |
| 1466 | public static final int MESSAGE_SPAM_WARNING_LEVEL_COLUMN = 33; |
| 1467 | public static final int MESSAGE_SPAM_WARNING_LINK_TYPE_COLUMN = 34; |
Andrew Sapperstein | d5b369b | 2012-07-13 12:38:46 -0700 | [diff] [blame] | 1468 | public static final int MESSAGE_VIA_DOMAIN_COLUMN = 35; |
Andy Huang | 47aa9c9 | 2012-07-31 15:37:21 -0700 | [diff] [blame] | 1469 | public static final int MESSAGE_IS_SENDING_COLUMN = 36; |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1470 | |
| 1471 | public static final class CursorStatus { |
| 1472 | // The cursor is actively loading more data |
| 1473 | public static final int LOADING = 1 << 0; |
| 1474 | |
| 1475 | // The cursor is currently not loading more data, but more data may be available |
| 1476 | public static final int LOADED = 1 << 1; |
| 1477 | |
| 1478 | // An error occured while loading data |
| 1479 | public static final int ERROR = 1 << 2; |
| 1480 | |
| 1481 | // The cursor is loaded, and there will be no more data |
| 1482 | public static final int COMPLETE = 1 << 3; |
Paul Westbrook | 573b9e6 | 2012-08-02 14:56:17 -0700 | [diff] [blame] | 1483 | |
| 1484 | public static boolean isWaitingForResults(int cursorStatus) { |
| 1485 | return 0 != (cursorStatus & LOADING); |
| 1486 | } |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1487 | } |
| 1488 | |
| 1489 | |
| 1490 | public static final class CursorExtraKeys { |
| 1491 | /** |
| 1492 | * This integer column contains the staus of the message cursor. The value will be |
| 1493 | * one defined in {@link CursorStatus}. |
| 1494 | */ |
Paul Westbrook | 7a3e657 | 2012-08-02 16:33:58 -0700 | [diff] [blame] | 1495 | public static final String EXTRA_STATUS = "cursor_status"; |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1496 | |
| 1497 | /** |
| 1498 | * Used for finding the cause of an error. |
| 1499 | * TODO: define these values |
| 1500 | */ |
Paul Westbrook | 7a3e657 | 2012-08-02 16:33:58 -0700 | [diff] [blame] | 1501 | public static final String EXTRA_ERROR = "cursor_error"; |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1502 | |
| 1503 | } |
| 1504 | |
Paul Westbrook | 2388c5d | 2012-03-25 12:29:11 -0700 | [diff] [blame] | 1505 | public static final class AccountCursorExtraKeys { |
| 1506 | /** |
| 1507 | * This integer column contains the staus of the account cursor. The value will be |
| 1508 | * 1 if all accounts have been fully loaded or 0 if the account list hasn't been fully |
| 1509 | * initialized |
| 1510 | */ |
| 1511 | public static final String ACCOUNTS_LOADED = "accounts_loaded"; |
| 1512 | } |
| 1513 | |
Paul Westbrook | 9cf4389 | 2012-03-15 15:43:47 -0700 | [diff] [blame] | 1514 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1515 | public static final class MessageFlags { |
Andy Huang | 47aa9c9 | 2012-07-31 15:37:21 -0700 | [diff] [blame] | 1516 | public static final int REPLIED = 1 << 2; |
| 1517 | public static final int FORWARDED = 1 << 3; |
| 1518 | public static final int CALENDAR_INVITE = 1 << 4; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1519 | } |
| 1520 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1521 | public static final class MessageColumns { |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1522 | /** |
| 1523 | * This string column contains a content provider URI that points to this single message. |
| 1524 | */ |
Mindy Pereira | 6349a04 | 2012-01-04 11:25:01 -0800 | [diff] [blame] | 1525 | public static final String URI = "messageUri"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1526 | /** |
| 1527 | * This string column contains a server-assigned ID for this message. |
| 1528 | */ |
| 1529 | public static final String SERVER_ID = "serverMessageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1530 | public static final String CONVERSATION_ID = "conversationId"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1531 | /** |
| 1532 | * This string column contains the subject of a message. |
| 1533 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1534 | public static final String SUBJECT = "subject"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1535 | /** |
| 1536 | * This string column contains a snippet of the message body. |
| 1537 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1538 | public static final String SNIPPET = "snippet"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1539 | /** |
| 1540 | * This string column contains the single email address (and optionally name) of the sender. |
| 1541 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1542 | public static final String FROM = "fromAddress"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1543 | /** |
| 1544 | * This string column contains a comma-delimited list of "To:" recipient email addresses. |
| 1545 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1546 | public static final String TO = "toAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1547 | /** |
| 1548 | * This string column contains a comma-delimited list of "CC:" recipient email addresses. |
| 1549 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1550 | public static final String CC = "ccAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1551 | /** |
| 1552 | * This string column contains a comma-delimited list of "BCC:" recipient email addresses. |
| 1553 | * This value will be null for incoming messages. |
| 1554 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1555 | public static final String BCC = "bccAddresses"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1556 | /** |
| 1557 | * This string column contains the single email address (and optionally name) of the |
| 1558 | * sender's reply-to address. |
| 1559 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1560 | public static final String REPLY_TO = "replyToAddress"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1561 | /** |
| 1562 | * This long column contains the timestamp (in millis) of receipt of the message. |
| 1563 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1564 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1565 | /** |
| 1566 | * This string column contains the HTML form of the message body, if available. If not, |
| 1567 | * a provider must populate BODY_TEXT. |
| 1568 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1569 | public static final String BODY_HTML = "bodyHtml"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1570 | /** |
| 1571 | * This string column contains the plaintext form of the message body, if HTML is not |
| 1572 | * otherwise available. If HTML is available, this value should be left empty (null). |
| 1573 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1574 | public static final String BODY_TEXT = "bodyText"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1575 | public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources"; |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 1576 | /** |
| 1577 | * This string column contains an opaque string used by the sendMessage api. |
| 1578 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1579 | public static final String REF_MESSAGE_ID = "refMessageId"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1580 | /** |
Andy Huang | 97c25be | 2012-01-12 15:12:09 -0800 | [diff] [blame] | 1581 | * This integer column contains the type of this draft, or zero (0) if this message is not a |
| 1582 | * draft. See {@link DraftType} for possible values. |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1583 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 1584 | public static final String DRAFT_TYPE = "draftType"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1585 | /** |
| 1586 | * This boolean column indicates whether an outgoing message should trigger special quoted |
| 1587 | * text processing upon send. The value should default to zero (0) for protocols that do |
| 1588 | * not support or require this flag, and for all incoming messages. |
| 1589 | */ |
Mindy Pereira | 3ce64e7 | 2012-01-13 14:29:45 -0800 | [diff] [blame] | 1590 | public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1591 | /** |
| 1592 | * This boolean column indicates whether a message has attachments. The list of attachments |
| 1593 | * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}. |
| 1594 | */ |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1595 | public static final String HAS_ATTACHMENTS = "hasAttachments"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1596 | /** |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1597 | * This string column contains the content provider URI for the list of |
| 1598 | * attachments associated with this message. |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1599 | */ |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1600 | public static final String ATTACHMENT_LIST_URI = "attachmentListUri"; |
Andy Huang | db97747 | 2012-01-11 19:53:25 -0800 | [diff] [blame] | 1601 | /** |
| 1602 | * This long column is a bit field of flags defined in {@link MessageFlags}. |
| 1603 | */ |
Andy Huang | 732600e | 2012-01-10 17:47:17 -0800 | [diff] [blame] | 1604 | public static final String MESSAGE_FLAGS = "messageFlags"; |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1605 | /** |
| 1606 | * This string column contains a specially formatted string representing all |
| 1607 | * attachments that we added to a message that is being sent or saved. |
Andy Huang | 5a92907 | 2012-03-23 20:17:10 -0700 | [diff] [blame] | 1608 | * |
Andy Huang | 5c5fd57 | 2012-04-08 18:19:29 -0700 | [diff] [blame] | 1609 | * TODO: remove this and use {@link #ATTACHMENTS} instead |
Mindy Pereira | f944e96 | 2012-01-17 11:43:36 -0800 | [diff] [blame] | 1610 | */ |
Andy Huang | 5c5fd57 | 2012-04-08 18:19:29 -0700 | [diff] [blame] | 1611 | @Deprecated |
Mindy Pereira | 84554ec | 2012-01-17 14:44:44 -0800 | [diff] [blame] | 1612 | public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos"; |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1613 | /** |
| 1614 | * This string column contains the content provider URI for saving this |
| 1615 | * message. |
| 1616 | */ |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 1617 | @Deprecated |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1618 | public static final String SAVE_MESSAGE_URI = "saveMessageUri"; |
| 1619 | /** |
| 1620 | * This string column contains content provider URI for sending this |
| 1621 | * message. |
| 1622 | */ |
Paul Westbrook | 72e2ea8 | 2012-10-22 16:25:22 -0700 | [diff] [blame] | 1623 | @Deprecated |
Mindy Pereira | 7ed1c11 | 2012-01-18 10:59:25 -0800 | [diff] [blame] | 1624 | public static final String SEND_MESSAGE_URI = "sendMessageUri"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1625 | |
Paul Westbrook | 104f729 | 2012-02-28 16:07:07 -0800 | [diff] [blame] | 1626 | /** |
| 1627 | * This integer column represents whether the user has specified that images should always |
| 1628 | * be shown. The value of "1" indicates that the user has specified that images should be |
| 1629 | * shown, while the value of "0" indicates that the user should be prompted before loading |
| 1630 | * any external images. |
| 1631 | */ |
| 1632 | public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages"; |
| 1633 | |
Mindy Pereira | e8caf12 | 2012-03-20 15:23:31 -0700 | [diff] [blame] | 1634 | /** |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 1635 | * This boolean column indicates whether the message has been read |
| 1636 | */ |
| 1637 | public static String READ = "read"; |
| 1638 | |
| 1639 | /** |
| 1640 | * This boolean column indicates whether the message has been starred |
| 1641 | */ |
| 1642 | public static String STARRED = "starred"; |
| 1643 | |
| 1644 | /** |
Mindy Pereira | e8caf12 | 2012-03-20 15:23:31 -0700 | [diff] [blame] | 1645 | * This integer column represents the offset in the message of quoted |
| 1646 | * text. If include_quoted_text is zero, the value contained in this |
| 1647 | * column is invalid. |
| 1648 | */ |
| 1649 | public static final String QUOTE_START_POS = "quotedTextStartPos"; |
| 1650 | |
Andy Huang | 5a92907 | 2012-03-23 20:17:10 -0700 | [diff] [blame] | 1651 | /** |
| 1652 | * This string columns contains a JSON array of serialized {@link Attachment} objects. |
| 1653 | */ |
| 1654 | public static final String ATTACHMENTS = "attachments"; |
Mindy Pereira | 92551d0 | 2012-04-05 11:31:12 -0700 | [diff] [blame] | 1655 | public static final String CUSTOM_FROM_ADDRESS = "customFrom"; |
Mindy Pereira | 62de1b1 | 2012-04-06 12:17:56 -0700 | [diff] [blame] | 1656 | /** |
| 1657 | * Uri of the account associated with this message. Except in the case |
| 1658 | * of showing a combined view, this column is almost always empty. |
| 1659 | */ |
| 1660 | public static final String MESSAGE_ACCOUNT_URI = "messageAccountUri"; |
Marc Blank | 3842af9 | 2012-04-27 09:06:09 -0700 | [diff] [blame] | 1661 | /** |
Andy Huang | e623a0f | 2012-07-12 15:01:23 -0700 | [diff] [blame] | 1662 | * Intent Uri to launch when the user wants to view an event in their calendar, or null. |
Marc Blank | 3842af9 | 2012-04-27 09:06:09 -0700 | [diff] [blame] | 1663 | */ |
| 1664 | public static final String EVENT_INTENT_URI = "eventIntentUri"; |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1665 | /** |
Andrew Sapperstein | d5b369b | 2012-07-13 12:38:46 -0700 | [diff] [blame] | 1666 | * This string column contains the string for the spam |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1667 | * warning of this message, or null if there is no spam warning for the message. |
| 1668 | */ |
| 1669 | public static final String SPAM_WARNING_STRING = "spamWarningString"; |
| 1670 | /** |
| 1671 | * This integer column contains the level of spam warning of this message, |
| 1672 | * or zero (0) if this message does not have a warning level. |
| 1673 | * See {@link SpamWarningLevel} for possible values. |
| 1674 | */ |
| 1675 | public static final String SPAM_WARNING_LEVEL = "spamWarningLevel"; |
| 1676 | /** |
| 1677 | * This integer column contains the type of link for the spam warning |
| 1678 | * of this message, or zero (0) if this message does not have a link type. |
| 1679 | * See {@link SpamWarningLinkType} for possible values. |
| 1680 | */ |
| 1681 | public static final String SPAM_WARNING_LINK_TYPE = "spamWarningLinkType"; |
Andrew Sapperstein | d5b369b | 2012-07-13 12:38:46 -0700 | [diff] [blame] | 1682 | /** |
| 1683 | * This string column contains the string for the via domain |
| 1684 | * to be included if this message was sent via an alternate |
| 1685 | * domain. This column should be null if no via domain exists. |
| 1686 | */ |
| 1687 | public static final String VIA_DOMAIN = "viaDomain"; |
Andy Huang | 47aa9c9 | 2012-07-31 15:37:21 -0700 | [diff] [blame] | 1688 | /** |
| 1689 | * This boolean column indicates whether the message is an outgoing message in the process |
| 1690 | * of being sent (will be zero for incoming messages and messages that are already sent). |
| 1691 | */ |
| 1692 | public static final String IS_SENDING = "isSending"; |
Andrew Sapperstein | 3b08c51 | 2012-07-11 16:51:07 -0700 | [diff] [blame] | 1693 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1694 | private MessageColumns() {} |
| 1695 | } |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1696 | |
Scott Banachowski | 53a615d | 2012-12-19 15:31:20 -0800 | [diff] [blame] | 1697 | public static final class SetCurrentAccountColumns { |
| 1698 | /** |
| 1699 | * This column contains the Account object Parcelable. |
| 1700 | */ |
| 1701 | public static final String ACCOUNT = "account"; |
| 1702 | |
| 1703 | private SetCurrentAccountColumns() {} |
| 1704 | } |
| 1705 | |
Marc Blank | 922c3eb | 2012-04-24 08:41:53 -0700 | [diff] [blame] | 1706 | /** |
| 1707 | * List of operations that can can be performed on a message. These operations are applied |
| 1708 | * with {@link ContentProvider#update(Uri, ContentValues, String, String[])} |
| 1709 | * where the message uri is specified, and the ContentValues specifies the operation to |
| 1710 | * be performed, e.g. values.put(RESPOND_COLUMN, RESPOND_ACCEPT) |
| 1711 | * <p/> |
| 1712 | * Note not all UI providers will support these operations. |
| 1713 | */ |
| 1714 | public static final class MessageOperations { |
| 1715 | /** |
| 1716 | * Respond to a calendar invitation |
| 1717 | */ |
| 1718 | public static final String RESPOND_COLUMN = "respond"; |
| 1719 | |
| 1720 | public static final int RESPOND_ACCEPT = 1; |
| 1721 | public static final int RESPOND_TENTATIVE = 2; |
| 1722 | public static final int RESPOND_DECLINE = 3; |
| 1723 | |
| 1724 | private MessageOperations() { |
| 1725 | } |
| 1726 | } |
| 1727 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1728 | public static final String ATTACHMENT_LIST_TYPE = |
| 1729 | "vnd.android.cursor.dir/vnd.com.android.mail.attachment"; |
| 1730 | public static final String ATTACHMENT_TYPE = |
| 1731 | "vnd.android.cursor.item/vnd.com.android.mail.attachment"; |
| 1732 | |
| 1733 | public static final String[] ATTACHMENT_PROJECTION = { |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1734 | AttachmentColumns.NAME, |
| 1735 | AttachmentColumns.SIZE, |
Mindy Pereira | 7a07fb4 | 2012-01-11 10:32:48 -0800 | [diff] [blame] | 1736 | AttachmentColumns.URI, |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1737 | AttachmentColumns.CONTENT_TYPE, |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1738 | AttachmentColumns.STATE, |
| 1739 | AttachmentColumns.DESTINATION, |
| 1740 | AttachmentColumns.DOWNLOADED_SIZE, |
| 1741 | AttachmentColumns.CONTENT_URI, |
| 1742 | AttachmentColumns.THUMBNAIL_URI, |
Mark Wei | bbe74ae | 2012-11-19 11:20:09 -0800 | [diff] [blame] | 1743 | AttachmentColumns.PREVIEW_INTENT_URI, |
| 1744 | AttachmentColumns.PROVIDER_DATA |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1745 | }; |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 1746 | private static final String EMAIL_SEPARATOR_PATTERN = "\n"; |
Andy Huang | 109369d | 2012-03-07 20:05:31 -0800 | [diff] [blame] | 1747 | public static final int ATTACHMENT_NAME_COLUMN = 0; |
| 1748 | public static final int ATTACHMENT_SIZE_COLUMN = 1; |
| 1749 | public static final int ATTACHMENT_URI_COLUMN = 2; |
| 1750 | public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 3; |
| 1751 | public static final int ATTACHMENT_STATE_COLUMN = 4; |
| 1752 | public static final int ATTACHMENT_DESTINATION_COLUMN = 5; |
| 1753 | public static final int ATTACHMENT_DOWNLOADED_SIZE_COLUMN = 6; |
| 1754 | public static final int ATTACHMENT_CONTENT_URI_COLUMN = 7; |
| 1755 | public static final int ATTACHMENT_THUMBNAIL_URI_COLUMN = 8; |
| 1756 | public static final int ATTACHMENT_PREVIEW_INTENT_COLUMN = 9; |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1757 | |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1758 | /** |
| 1759 | * Valid states for the {@link AttachmentColumns#STATE} column. |
| 1760 | * |
| 1761 | */ |
| 1762 | public static final class AttachmentState { |
| 1763 | /** |
| 1764 | * The full attachment is not present on device. When used as a command, |
| 1765 | * setting this state will tell the provider to cancel a download in |
| 1766 | * progress. |
| 1767 | * <p> |
| 1768 | * Valid next states: {@link #DOWNLOADING} |
| 1769 | */ |
| 1770 | public static final int NOT_SAVED = 0; |
| 1771 | /** |
| 1772 | * The most recent attachment download attempt failed. The current UI |
| 1773 | * design does not require providers to persist this state, but |
| 1774 | * providers must return this state at least once after a download |
| 1775 | * failure occurs. This state may not be used as a command. |
| 1776 | * <p> |
| 1777 | * Valid next states: {@link #DOWNLOADING} |
| 1778 | */ |
| 1779 | public static final int FAILED = 1; |
| 1780 | /** |
| 1781 | * The attachment is currently being downloaded by the provider. |
| 1782 | * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current |
| 1783 | * download progress while in this state. When used as a command, |
| 1784 | * setting this state will tell the provider to initiate a download to |
| 1785 | * the accompanying destination in {@link AttachmentColumns#DESTINATION} |
| 1786 | * . |
| 1787 | * <p> |
| 1788 | * Valid next states: {@link #NOT_SAVED}, {@link #FAILED}, |
| 1789 | * {@link #SAVED} |
| 1790 | */ |
| 1791 | public static final int DOWNLOADING = 2; |
| 1792 | /** |
| 1793 | * The attachment was successfully downloaded to the destination in |
| 1794 | * {@link AttachmentColumns#DESTINATION}. If a provider later detects |
| 1795 | * that a download is missing, it should reset the state to |
| 1796 | * {@link #NOT_SAVED}. This state may not be used as a command on its |
| 1797 | * own. To move a file from cache to external, update |
| 1798 | * {@link AttachmentColumns#DESTINATION}. |
| 1799 | * <p> |
| 1800 | * Valid next states: {@link #NOT_SAVED} |
| 1801 | */ |
| 1802 | public static final int SAVED = 3; |
Mark Wei | 47ca4e2 | 2012-10-17 16:20:15 -0700 | [diff] [blame] | 1803 | /** |
| 1804 | * This is only used as a command, not as a state. The attachment is |
| 1805 | * currently being redownloaded by the provider. |
| 1806 | * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current |
| 1807 | * download progress while in this state. When used as a command, |
| 1808 | * setting this state will tell the provider to initiate a download to |
| 1809 | * the accompanying destination in {@link AttachmentColumns#DESTINATION} |
| 1810 | * . |
| 1811 | * <p> |
| 1812 | * Valid next states: {@link #NOT_SAVED}, {@link #FAILED}, |
| 1813 | * {@link #SAVED} |
| 1814 | */ |
| 1815 | public static final int REDOWNLOADING = 4; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1816 | |
| 1817 | private AttachmentState() {} |
| 1818 | } |
| 1819 | |
| 1820 | public static final class AttachmentDestination { |
| 1821 | |
| 1822 | /** |
| 1823 | * The attachment will be or is already saved to the app-private cache partition. |
| 1824 | */ |
| 1825 | public static final int CACHE = 0; |
| 1826 | /** |
| 1827 | * The attachment will be or is already saved to external shared device storage. |
| 1828 | */ |
| 1829 | public static final int EXTERNAL = 1; |
| 1830 | |
| 1831 | private AttachmentDestination() {} |
| 1832 | } |
| 1833 | |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1834 | public static final class AttachmentColumns { |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1835 | /** |
| 1836 | * This string column is the attachment's file name, intended for display in UI. It is not |
| 1837 | * the full path of the file. |
| 1838 | */ |
Paul Westbrook | c97d8ac | 2012-03-23 15:21:48 -0700 | [diff] [blame] | 1839 | public static final String NAME = OpenableColumns.DISPLAY_NAME; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1840 | /** |
| 1841 | * This integer column is the file size of the attachment, in bytes. |
| 1842 | */ |
Paul Westbrook | c97d8ac | 2012-03-23 15:21:48 -0700 | [diff] [blame] | 1843 | public static final String SIZE = OpenableColumns.SIZE; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1844 | /** |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1845 | * This column is a {@link android.net.Uri} that can be queried to |
| 1846 | * monitor download state and progress for this individual attachment |
| 1847 | * (resulting cursor has one single row for this attachment). |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1848 | */ |
Mindy Pereira | 7a07fb4 | 2012-01-11 10:32:48 -0800 | [diff] [blame] | 1849 | public static final String URI = "uri"; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1850 | /** |
| 1851 | * This string column is the MIME type of the attachment. |
| 1852 | */ |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1853 | public static final String CONTENT_TYPE = "contentType"; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1854 | /** |
| 1855 | * This integer column is the current downloading state of the |
| 1856 | * attachment as defined in {@link AttachmentState}. |
| 1857 | * <p> |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 1858 | * Providers must accept updates to {@link #URI} with new values of |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1859 | * this column to initiate or cancel downloads. |
| 1860 | */ |
| 1861 | public static final String STATE = "state"; |
| 1862 | /** |
| 1863 | * This integer column is the file destination for the current download |
| 1864 | * in progress (when {@link #STATE} is |
| 1865 | * {@link AttachmentState#DOWNLOADING}) or the resulting downloaded file |
| 1866 | * ( when {@link #STATE} is {@link AttachmentState#SAVED}), as defined |
| 1867 | * in {@link AttachmentDestination}. This value is undefined in any |
| 1868 | * other state. |
| 1869 | * <p> |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 1870 | * Providers must accept updates to {@link #URI} with new values of |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1871 | * this column to move an existing downloaded file. |
| 1872 | */ |
| 1873 | public static final String DESTINATION = "destination"; |
| 1874 | /** |
| 1875 | * This integer column is the current number of bytes downloaded when |
| 1876 | * {@link #STATE} is {@link AttachmentState#DOWNLOADING}. This value is |
| 1877 | * undefined in any other state. |
| 1878 | */ |
| 1879 | public static final String DOWNLOADED_SIZE = "downloadedSize"; |
| 1880 | /** |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1881 | * This column is a {@link android.net.Uri} that points to the |
| 1882 | * downloaded local file when {@link #STATE} is |
| 1883 | * {@link AttachmentState#SAVED}. This value is undefined in any other |
| 1884 | * state. |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1885 | */ |
| 1886 | public static final String CONTENT_URI = "contentUri"; |
| 1887 | /** |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1888 | * This column is a {@link android.net.Uri} that points to a local |
| 1889 | * thumbnail file for the attachment. Providers that do not support |
| 1890 | * downloading attachment thumbnails may leave this null. |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1891 | */ |
| 1892 | public static final String THUMBNAIL_URI = "thumbnailUri"; |
| 1893 | /** |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1894 | * This column is an {@link android.net.Uri} used in an |
| 1895 | * {@link android.content.Intent#ACTION_VIEW} Intent to launch a preview |
| 1896 | * activity that allows the user to efficiently view an attachment |
| 1897 | * without having to first download the entire file. Providers that do |
| 1898 | * not support previewing attachments may leave this null. |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1899 | */ |
Paul Westbrook | d49db8e | 2012-08-03 17:58:46 -0700 | [diff] [blame] | 1900 | public static final String PREVIEW_INTENT_URI = "previewIntentUri"; |
Mark Wei | bbe74ae | 2012-11-19 11:20:09 -0800 | [diff] [blame] | 1901 | /** |
| 1902 | * This column contains provider-specific private data as JSON string. |
| 1903 | */ |
| 1904 | public static final String PROVIDER_DATA = "providerData"; |
Andy Huang | e0b83b8 | 2012-03-06 19:57:04 -0800 | [diff] [blame] | 1905 | |
| 1906 | private AttachmentColumns() {} |
Mindy Pereira | f30cc09 | 2011-12-29 14:02:40 -0800 | [diff] [blame] | 1907 | } |
Mindy Pereira | 013194c | 2012-01-06 15:09:33 -0800 | [diff] [blame] | 1908 | |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1909 | public static final class AttachmentContentValueKeys { |
| 1910 | public static final String RENDITION = "rendition"; |
Mark Wei | 2674535 | 2013-01-17 21:40:34 -0800 | [diff] [blame] | 1911 | public static final String ADDITIONAL_PRIORITY = "additionalPriority"; |
| 1912 | public static final String DELAY_DOWNLOAD = "delayDownload"; |
Mark Wei | 1aee17e | 2013-01-14 14:47:16 -0800 | [diff] [blame] | 1913 | } |
| 1914 | |
| 1915 | /** |
| 1916 | * Indicates a version of an attachment. |
| 1917 | */ |
| 1918 | public static final class AttachmentRendition { |
| 1919 | |
| 1920 | /** A smaller or simpler version of the attachment, such as a scaled-down image or an HTML |
| 1921 | * version of a document. Not always available. |
| 1922 | */ |
| 1923 | public static final int SIMPLE = 0; |
| 1924 | /** |
| 1925 | * The full version of an attachment if it can be handled on the device, otherwise the |
| 1926 | * preview. |
| 1927 | */ |
| 1928 | public static final int BEST = 1; |
| 1929 | |
| 1930 | public static int parseRendition(String rendition) { |
| 1931 | return rendition.equalsIgnoreCase("BEST") ? BEST : SIMPLE; |
| 1932 | } |
| 1933 | |
| 1934 | public static String toString(int rendition) { |
| 1935 | return rendition == BEST ? "BEST" : "SIMPLE"; |
| 1936 | } |
| 1937 | } |
| 1938 | |
Mindy Pereira | 013194c | 2012-01-06 15:09:33 -0800 | [diff] [blame] | 1939 | public static String getAttachmentTypeSetting() { |
| 1940 | // TODO: query the account to see what kinds of attachments it supports? |
| 1941 | return "com.google.android.gm.allowAddAnyAttachment"; |
| 1942 | } |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 1943 | |
| 1944 | public static void incrementRecipientsTimesContacted(Context context, String addressString) { |
| 1945 | DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context); |
| 1946 | ArrayList<String> recipients = new ArrayList<String>(); |
mindyp | 845f87e | 2012-09-24 15:14:49 -0700 | [diff] [blame] | 1947 | if (TextUtils.isEmpty(addressString)) { |
| 1948 | return; |
| 1949 | } |
| 1950 | Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressString); |
| 1951 | for (int i = 0; i < tokens.length;i++) { |
| 1952 | recipients.add(tokens[i].getAddress()); |
Mindy Pereira | 82cc566 | 2012-01-09 17:29:30 -0800 | [diff] [blame] | 1953 | } |
| 1954 | statsUpdater.updateWithAddress(recipients); |
| 1955 | } |
Marc Blank | b31ab5a | 2012-02-01 12:28:29 -0800 | [diff] [blame] | 1956 | |
| 1957 | public static final String[] UNDO_PROJECTION = { |
| 1958 | ConversationColumns.MESSAGE_LIST_URI |
| 1959 | }; |
| 1960 | public static final int UNDO_MESSAGE_LIST_COLUMN = 0; |
Marc Blank | dd10bc8 | 2012-02-01 19:10:46 -0800 | [diff] [blame] | 1961 | |
| 1962 | // Parameter used to indicate the sequence number for an undoable operation |
| 1963 | public static final String SEQUENCE_QUERY_PARAMETER = "seq"; |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1964 | |
Scott Kennedy | 1007e70 | 2012-12-20 11:18:45 -0800 | [diff] [blame] | 1965 | /** |
| 1966 | * Parameter used to force UI notifications in an operation involving |
| 1967 | * {@link ConversationOperations#OPERATION_KEY}. |
| 1968 | */ |
| 1969 | public static final String FORCE_UI_NOTIFICATIONS_QUERY_PARAMETER = "forceUiNotifications"; |
| 1970 | |
Scott Kennedy | 0d0f8b0 | 2012-10-12 15:18:18 -0700 | [diff] [blame] | 1971 | public static final String AUTO_ADVANCE_MODE_OLDER = "older"; |
| 1972 | public static final String AUTO_ADVANCE_MODE_NEWER = "newer"; |
| 1973 | public static final String AUTO_ADVANCE_MODE_LIST = "list"; |
| 1974 | |
Vikram Aggarwal | c769422 | 2012-04-23 13:37:01 -0700 | [diff] [blame] | 1975 | /** |
| 1976 | * Settings for auto advancing when the current conversation has been destroyed. |
| 1977 | */ |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1978 | public static final class AutoAdvance { |
Vikram Aggarwal | c769422 | 2012-04-23 13:37:01 -0700 | [diff] [blame] | 1979 | /** No setting specified. */ |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1980 | public static final int UNSET = 0; |
Vikram Aggarwal | c769422 | 2012-04-23 13:37:01 -0700 | [diff] [blame] | 1981 | /** Go to the older message (if available) */ |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1982 | public static final int OLDER = 1; |
Vikram Aggarwal | c769422 | 2012-04-23 13:37:01 -0700 | [diff] [blame] | 1983 | /** Go to the newer message (if available) */ |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1984 | public static final int NEWER = 2; |
Vikram Aggarwal | c769422 | 2012-04-23 13:37:01 -0700 | [diff] [blame] | 1985 | /** Go back to conversation list*/ |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 1986 | public static final int LIST = 3; |
Vikram Aggarwal | 82d3750 | 2013-01-10 16:18:49 -0800 | [diff] [blame] | 1987 | /** The default option is to go to the list */ |
| 1988 | public static final int DEFAULT = LIST; |
Scott Kennedy | 0d0f8b0 | 2012-10-12 15:18:18 -0700 | [diff] [blame] | 1989 | |
| 1990 | /** |
| 1991 | * Gets the int value for the given auto advance setting. |
| 1992 | * |
| 1993 | * @param autoAdvanceSetting The string setting, such as "newer", "older", "list" |
| 1994 | */ |
| 1995 | public static int getAutoAdvanceInt(final String autoAdvanceSetting) { |
| 1996 | final int autoAdvance; |
| 1997 | |
| 1998 | if (AUTO_ADVANCE_MODE_NEWER.equals(autoAdvanceSetting)) { |
| 1999 | autoAdvance = UIProvider.AutoAdvance.NEWER; |
| 2000 | } else if (AUTO_ADVANCE_MODE_OLDER.equals(autoAdvanceSetting)) { |
| 2001 | autoAdvance = UIProvider.AutoAdvance.OLDER; |
| 2002 | } else if (AUTO_ADVANCE_MODE_LIST.equals(autoAdvanceSetting)) { |
| 2003 | autoAdvance = UIProvider.AutoAdvance.LIST; |
| 2004 | } else { |
| 2005 | autoAdvance = UIProvider.AutoAdvance.UNSET; |
| 2006 | } |
| 2007 | |
| 2008 | return autoAdvance; |
| 2009 | } |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 2010 | } |
| 2011 | |
Mindy Pereira | 71a8f5e | 2012-07-25 14:33:18 -0700 | [diff] [blame] | 2012 | /** |
| 2013 | * Settings for what swipe should do. |
| 2014 | */ |
| 2015 | public static final class Swipe { |
| 2016 | /** Archive or remove label, if available. */ |
| 2017 | public static final int ARCHIVE = 0; |
| 2018 | /** Delete */ |
| 2019 | public static final int DELETE = 1; |
| 2020 | /** No swipe */ |
| 2021 | public static final int DISABLED = 2; |
Mindy Pereira | e58222b | 2012-07-25 14:33:18 -0700 | [diff] [blame] | 2022 | /** Default is delete */ |
Mindy Pereira | 1c605fe | 2012-07-25 16:17:15 -0700 | [diff] [blame] | 2023 | public static final int DEFAULT = ARCHIVE; |
Mindy Pereira | 71a8f5e | 2012-07-25 14:33:18 -0700 | [diff] [blame] | 2024 | } |
| 2025 | |
Paul Westbrook | fa255c0 | 2012-10-13 14:32:52 -0700 | [diff] [blame] | 2026 | /** |
| 2027 | * Settings for Conversation view mode. |
| 2028 | */ |
| 2029 | public static final class ConversationViewMode { |
| 2030 | /** |
| 2031 | * The user hasn't specified a mode. |
| 2032 | */ |
| 2033 | public static final int UNDEFINED = -1; |
| 2034 | /** |
| 2035 | * Default to fit the conversation to screen view |
| 2036 | */ |
| 2037 | public static final int OVERVIEW = 0; |
| 2038 | /** |
| 2039 | * Conversation text size should be the device default, and wide conversations may |
| 2040 | * require panning |
| 2041 | */ |
| 2042 | public static final int READING = 1; |
| 2043 | } |
| 2044 | |
Paul Westbrook | 63eef79 | 2012-02-27 14:01:06 -0800 | [diff] [blame] | 2045 | public static final class SnapHeaderValue { |
| 2046 | public static final int ALWAYS = 0; |
| 2047 | public static final int PORTRAIT_ONLY = 1; |
| 2048 | public static final int NEVER = 2; |
| 2049 | } |
| 2050 | |
| 2051 | public static final class MessageTextSize { |
| 2052 | public static final int TINY = -2; |
| 2053 | public static final int SMALL = -1; |
| 2054 | public static final int NORMAL = 0; |
| 2055 | public static final int LARGE = 1; |
| 2056 | public static final int HUGE = 2; |
| 2057 | } |
| 2058 | |
| 2059 | public static final class DefaultReplyBehavior { |
| 2060 | public static final int REPLY = 0; |
| 2061 | public static final int REPLY_ALL = 1; |
| 2062 | } |
| 2063 | |
Paul Westbrook | ee0fda7 | 2012-03-19 10:13:36 -0700 | [diff] [blame] | 2064 | /** |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2065 | * Action for an intent used to update/create new notifications. The mime type of this |
Paul Westbrook | ee0fda7 | 2012-03-19 10:13:36 -0700 | [diff] [blame] | 2066 | * intent should be set to the mimeType of the account that is generating this notification. |
| 2067 | * An intent of this action is required to have the following extras: |
Andy Huang | d8e249e | 2012-03-21 17:01:37 -0700 | [diff] [blame] | 2068 | * {@link UpdateNotificationExtras#EXTRA_FOLDER} {@link UpdateNotificationExtras#EXTRA_ACCOUNT} |
Paul Westbrook | ee0fda7 | 2012-03-19 10:13:36 -0700 | [diff] [blame] | 2069 | */ |
| 2070 | public static final String ACTION_UPDATE_NOTIFICATION = |
| 2071 | "com.android.mail.action.update_notification"; |
| 2072 | |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2073 | public static final class UpdateNotificationExtras { |
| 2074 | /** |
Paul Westbrook | 6ead20d | 2012-03-19 14:48:14 -0700 | [diff] [blame] | 2075 | * Parcelable extra containing a {@link Uri} to a {@link Folder} |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2076 | */ |
| 2077 | public static final String EXTRA_FOLDER = "notification_extra_folder"; |
Paul Westbrook | ee0fda7 | 2012-03-19 10:13:36 -0700 | [diff] [blame] | 2078 | |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2079 | /** |
Paul Westbrook | 6ead20d | 2012-03-19 14:48:14 -0700 | [diff] [blame] | 2080 | * Parcelable extra containing a {@link Uri} to an {@link Account} |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2081 | */ |
| 2082 | public static final String EXTRA_ACCOUNT = "notification_extra_account"; |
Paul Westbrook | 6ead20d | 2012-03-19 14:48:14 -0700 | [diff] [blame] | 2083 | |
| 2084 | /** |
| 2085 | * Integer extra containing the update unread count for the account/folder. |
| 2086 | * If this value is 0, the UI will not block the intent to allow code to clear notifications |
| 2087 | * to run. |
| 2088 | */ |
| 2089 | public static final String EXTRA_UPDATED_UNREAD_COUNT = "notification_updated_unread_count"; |
Marc Blank | bc6ba05 | 2012-03-19 10:46:07 -0700 | [diff] [blame] | 2090 | } |
Paul Westbrook | e550355 | 2012-03-28 00:35:57 -0700 | [diff] [blame] | 2091 | |
| 2092 | public static final class EditSettingsExtras { |
| 2093 | /** |
| 2094 | * Parcelable extra containing account for which the user wants to |
| 2095 | * modify settings |
| 2096 | */ |
| 2097 | public static final String EXTRA_ACCOUNT = "extra_account"; |
| 2098 | |
| 2099 | /** |
| 2100 | * Parcelable extra containing folder for which the user wants to |
| 2101 | * modify settings |
| 2102 | */ |
| 2103 | public static final String EXTRA_FOLDER = "extra_folder"; |
Paul Westbrook | 18babd2 | 2012-04-09 22:17:08 -0700 | [diff] [blame] | 2104 | |
| 2105 | /** |
| 2106 | * Boolean extra which is set true if the user wants to "manage folders" |
| 2107 | */ |
| 2108 | public static final String EXTRA_MANAGE_FOLDERS = "extra_manage_folders"; |
Paul Westbrook | e550355 | 2012-03-28 00:35:57 -0700 | [diff] [blame] | 2109 | } |
Paul Westbrook | 17beb0b | 2012-08-20 13:34:37 -0700 | [diff] [blame] | 2110 | |
| 2111 | public static final class SendFeedbackExtras { |
| 2112 | /** |
| 2113 | * Optional boolean extras which indicates that the user is reporting a problem. |
| 2114 | */ |
| 2115 | public static final String EXTRA_REPORTING_PROBLEM = "reporting_problem"; |
| 2116 | } |
Mark Wei | 9982fdb | 2012-08-30 18:27:46 -0700 | [diff] [blame] | 2117 | |
| 2118 | public static final class ViewProxyExtras { |
| 2119 | /** |
| 2120 | * Uri extra passed to the proxy which indicates the original Uri that was intended to be |
| 2121 | * viewed. |
| 2122 | */ |
| 2123 | public static final String EXTRA_ORIGINAL_URI = "original_uri"; |
| 2124 | /** |
| 2125 | * Parcelable extra passed to the proxy which indicates the account being viewed from. |
| 2126 | */ |
| 2127 | public static final String EXTRA_ACCOUNT = "account"; |
| 2128 | /** |
| 2129 | * String extra passed from the proxy which indicates the salt used to generate the digest. |
| 2130 | */ |
| 2131 | public static final String EXTRA_SALT = "salt"; |
| 2132 | /** |
| 2133 | * Byte[] extra passed from the proxy which indicates the digest of the salted account name. |
| 2134 | */ |
| 2135 | public static final String EXTRA_ACCOUNT_DIGEST = "digest"; |
| 2136 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 2137 | } |