Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2011, Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.email.providers; |
| 18 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 19 | import android.provider.BaseColumns; |
| 20 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 21 | import java.lang.String; |
| 22 | |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 23 | |
| 24 | public class UIProvider { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 25 | // The actual content provider should define its own authority |
| 26 | //public static final String AUTHORITY = "com.android.email.providers"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 27 | |
| 28 | public static final String ACCOUNT_LIST_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 29 | "vnd.android.cursor.dir/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 30 | public static final String ACCOUNT_TYPE = |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 31 | "vnd.android.cursor.item/vnd.com.android.mail.account"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 32 | |
| 33 | public static final String[] ACCOUNTS_PROJECTION = { |
| 34 | BaseColumns._ID, |
| 35 | AccountColumns.NAME, |
| 36 | AccountColumns.PROVIDER_VERSION, |
| 37 | AccountColumns.URI, |
| 38 | AccountColumns.CAPABILITIES, |
| 39 | AccountColumns.FOLDER_LIST_URI, |
| 40 | AccountColumns.SEARCH_URI, |
| 41 | AccountColumns.ACCOUNT_FROM_ADDRESSES_URI, |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 42 | AccountColumns.SAVE_NEW_DRAFT_URI, |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 43 | AccountColumns.SEND_MESSAGE_URI |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | public static final class AccountCapabilities { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 47 | public static final int SYNCABLE_FOLDERS = 0x0001; |
| 48 | public static final int REPORT_SPAM = 0x0002; |
| 49 | public static final int ARCHIVE = 0x0004; |
| 50 | public static final int MUTE = 0x0008; |
| 51 | public static final int SERVER_SEARCH = 0x0010; |
| 52 | public static final int FOLDER_SERVER_SEARCH = 0x0020; |
| 53 | public static final int SANITIZED_HTML = 0x0040; |
| 54 | public static final int DRAFT_SYNCHRONIZATION = 0x0080; |
| 55 | public static final int MULTIPLE_FROM_ADDRESSES = 0x0100; |
| 56 | public static final int SMART_REPLY = 0x0200; |
| 57 | public static final int LOCAL_SEARCH = 0x0400; |
| 58 | public static final int THREADED_CONVERSATIONS = 0x0800; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | public static final class AccountColumns { |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 62 | /** |
| 63 | * This string column contains the human visible name for the account. |
| 64 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 65 | public static final String NAME = "name"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * This integer column returns the version of the UI provider schema from which this |
| 69 | * account provider will return results. |
| 70 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 71 | public static final String PROVIDER_VERSION = "providerVersion"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * This string column contains the uri to directly access the information for this account. |
| 75 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 76 | public static final String URI = "uri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * This integer column contains a bit field of the possible cabibilities that this account |
| 80 | * supports. |
| 81 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 82 | public static final String CAPABILITIES = "capabilities"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 83 | |
| 84 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 85 | * This string column contains the content provider uri to return the |
| 86 | * list of top level folders for this account. |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 87 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 88 | public static final String FOLDER_LIST_URI = "folderListUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * This string column contains the content provider uri that can be queried for search |
| 92 | * results. |
| 93 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 94 | public static final String SEARCH_URI = "searchUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 95 | |
| 96 | /** |
| 97 | * This string column contains the content provider uri that can be queried to access the |
| 98 | * from addresses for this account. |
| 99 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 100 | public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * This string column contains the content provider uri that can be used to save (insert) |
| 104 | * new draft messages for this account. |
| 105 | */ |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 106 | public static final String SAVE_NEW_DRAFT_URI = "saveNewDraftUri"; |
| 107 | |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 108 | /** |
| 109 | * This string column contains the content provider uri that can be used to send |
| 110 | * a message for this account. |
| 111 | * NOTE: This might be better to be an update operation on the messageUri. |
| 112 | */ |
| 113 | public static final String SEND_MESSAGE_URI = "sendMessageUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 114 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 115 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 116 | // We define a "folder" as anything that contains a list of conversations. |
| 117 | public static final String FOLDER_LIST_TYPE = |
| 118 | "vnd.android.cursor.dir/vnd.com.android.mail.folder"; |
| 119 | public static final String FOLDER_TYPE = |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 120 | "vnd.android.cursor.item/vnd.com.android.mail.folder"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 121 | |
| 122 | public static final String[] FOLDERS_PROJECTION = { |
| 123 | BaseColumns._ID, |
| 124 | FolderColumns.NAME, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 125 | FolderColumns.HAS_CHILDREN, |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame^] | 126 | FolderColumns.CAPABILITIES, |
| 127 | FolderColumns.SYNC_FREQUENCY, |
| 128 | FolderColumns.SYNC_WINDOW, |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 129 | FolderColumns.CONVERSATION_LIST_URI, |
| 130 | FolderColumns.CHILD_FOLDERS_LIST_URI |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 131 | }; |
| 132 | |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame^] | 133 | public static final class FolderCapabilities { |
| 134 | public static final int SYNCABLE = 0x0001; |
| 135 | public static final int PARENT = 0x0002; |
| 136 | public static final int CAN_HOLD_MAIL = 0x0004; |
| 137 | public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; |
| 138 | } |
| 139 | |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 140 | public static final class FolderColumns { |
| 141 | /** |
| 142 | * This string column contains the human visible name for the folder. |
| 143 | */ |
| 144 | public static final String NAME = "name"; |
| 145 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame^] | 146 | * This int column represents the capabilities of the folder specified by |
| 147 | * FolderCapabilities flags. |
| 148 | */ |
| 149 | public static String CAPABILITIES = "capabilities"; |
| 150 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 151 | * This boolean column represents whether or not this folder has any |
| 152 | * child folders. |
| 153 | */ |
| 154 | public static String HAS_CHILDREN = "hasChildren"; |
| 155 | /** |
Mindy Pereira | 0973b20 | 2011-12-21 15:48:12 -0800 | [diff] [blame^] | 156 | * This int column represents how often the folder should be synced. |
| 157 | */ |
| 158 | public static String SYNC_FREQUENCY = "syncFrequency"; |
| 159 | /** |
| 160 | * This int column represents how large the sync window is. |
| 161 | */ |
| 162 | public static String SYNC_WINDOW = "syncWindow"; |
| 163 | /** |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 164 | * This string column contains the content provider uri to return the |
| 165 | * list of conversations for this folder. |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 166 | */ |
| 167 | public static final String CONVERSATION_LIST_URI = "conversationListUri"; |
Mindy Pereira | 750cc73 | 2011-12-21 13:32:29 -0800 | [diff] [blame] | 168 | /** |
| 169 | * This string column contains the content provider uri to return the |
| 170 | * list of child folders of this folder. |
| 171 | */ |
| 172 | public static String CHILD_FOLDERS_LIST_URI = "childFoldersListUri"; |
Mindy Pereira | 3a565bf | 2011-12-21 11:26:21 -0800 | [diff] [blame] | 173 | |
| 174 | public FolderColumns() {}; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Returns a uri that, when queried, will return a cursor with a list of information for the |
| 179 | * list of configured accounts. |
| 180 | * @return |
| 181 | */ |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 182 | // TODO: create a static registry for the starting point for the UI provider. |
| 183 | // public static Uri getAccountsUri() { |
| 184 | // return Uri.parse(BASE_URI_STRING + "/"); |
| 185 | // } |
| 186 | |
| 187 | public static final class DraftType { |
| 188 | public static final String COMPOSE = "compose"; |
| 189 | public static final String REPLY = "reply"; |
| 190 | public static final String REPLY_ALL = "replyAll"; |
| 191 | public static final String FORWARD = "forward"; |
| 192 | |
| 193 | private DraftType() {} |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | |
| 197 | public static final class MessageColumns { |
| 198 | public static final String ID = "_id"; |
| 199 | public static final String URI = "uri"; |
| 200 | public static final String MESSAGE_ID = "messageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 201 | public static final String CONVERSATION_ID = "conversationId"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 202 | public static final String SUBJECT = "subject"; |
| 203 | public static final String SNIPPET = "snippet"; |
| 204 | public static final String FROM = "fromAddress"; |
| 205 | public static final String TO = "toAddresses"; |
| 206 | public static final String CC = "ccAddresses"; |
| 207 | public static final String BCC = "bccAddresses"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 208 | public static final String REPLY_TO = "replyToAddress"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 209 | public static final String DATE_RECEIVED_MS = "dateReceivedMs"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 210 | public static final String BODY_HTML = "bodyHtml"; |
| 211 | public static final String BODY_TEXT = "bodyText"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 212 | public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources"; |
| 213 | public static final String REF_MESSAGE_ID = "refMessageId"; |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 214 | public static final String DRAFT_TYPE = "draftType"; |
Mindy Pereira | 6f92de6 | 2011-12-19 11:31:48 -0800 | [diff] [blame] | 215 | public static final String INCLUDE_QUOTED_TEXT = "includeQuotedText"; |
| 216 | public static final String QUOTE_START_POS = "quoteStartPos"; |
| 217 | public static final String CLIENT_CREATED = "clientCreated"; |
| 218 | public static final String CUSTOM_FROM_ADDRESS = "customFromAddress"; |
| 219 | |
| 220 | // TODO: Add attachments, flags |
| 221 | |
| 222 | private MessageColumns() {} |
| 223 | } |
Paul Westbrook | 82ea6da | 2011-12-15 11:03:51 -0800 | [diff] [blame] | 224 | } |