blob: 40b90cd893008f3f0ecab067b0f6597de12432db [file] [log] [blame]
Mindy Pereira6f92de62011-12-19 11:31:48 -08001/**
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
17package com.android.email.providers;
18
19import android.net.Uri;
20import android.provider.BaseColumns;
21
Paul Westbrook82ea6da2011-12-15 11:03:51 -080022import java.lang.String;
23
Mindy Pereira6f92de62011-12-19 11:31:48 -080024
25public class UIProvider {
Paul Westbrook82ea6da2011-12-15 11:03:51 -080026 // The actual content provider should define its own authority
27 //public static final String AUTHORITY = "com.android.email.providers";
Mindy Pereira6f92de62011-12-19 11:31:48 -080028
29 public static final String ACCOUNT_LIST_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080030 "vnd.android.cursor.dir/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080031 public static final String ACCOUNT_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080032 "vnd.android.cursor.item/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080033
34 public static final String[] ACCOUNTS_PROJECTION = {
35 BaseColumns._ID,
36 AccountColumns.NAME,
37 AccountColumns.PROVIDER_VERSION,
38 AccountColumns.URI,
39 AccountColumns.CAPABILITIES,
40 AccountColumns.FOLDER_LIST_URI,
41 AccountColumns.SEARCH_URI,
42 AccountColumns.ACCOUNT_FROM_ADDRESSES_URI,
Paul Westbrook82ea6da2011-12-15 11:03:51 -080043 AccountColumns.SAVE_NEW_DRAFT_URI,
44 AccountColumns.SEND_MESSAGE_URI,
Mindy Pereira6f92de62011-12-19 11:31:48 -080045 };
46
47 public static final class AccountCapabilities {
Paul Westbrook82ea6da2011-12-15 11:03:51 -080048 public static final int SYNCABLE_FOLDERS = 0x0001;
49 public static final int REPORT_SPAM = 0x0002;
50 public static final int ARCHIVE = 0x0004;
51 public static final int MUTE = 0x0008;
52 public static final int SERVER_SEARCH = 0x0010;
53 public static final int FOLDER_SERVER_SEARCH = 0x0020;
54 public static final int SANITIZED_HTML = 0x0040;
55 public static final int DRAFT_SYNCHRONIZATION = 0x0080;
56 public static final int MULTIPLE_FROM_ADDRESSES = 0x0100;
57 public static final int SMART_REPLY = 0x0200;
58 public static final int LOCAL_SEARCH = 0x0400;
59 public static final int THREADED_CONVERSATIONS = 0x0800;
Mindy Pereira6f92de62011-12-19 11:31:48 -080060 }
61
62 public static final class AccountColumns {
Paul Westbrook82ea6da2011-12-15 11:03:51 -080063 /**
64 * This string column contains the human visible name for the account.
65 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080066 public static final String NAME = "name";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080067
68 /**
69 * This integer column returns the version of the UI provider schema from which this
70 * account provider will return results.
71 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080072 public static final String PROVIDER_VERSION = "providerVersion";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080073
74 /**
75 * This string column contains the uri to directly access the information for this account.
76 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080077 public static final String URI = "uri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080078
79 /**
80 * This integer column contains a bit field of the possible cabibilities that this account
81 * supports.
82 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080083 public static final String CAPABILITIES = "capabilities";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080084
85 /**
86 * This string column contains the content provider uri to return the list of folders for
87 * this account.
88 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080089 public static final String FOLDER_LIST_URI = "folderListUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080090
91 /**
92 * This string column contains the content provider uri that can be queried for search
93 * results.
94 */
Mindy Pereira6f92de62011-12-19 11:31:48 -080095 public static final String SEARCH_URI = "searchUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -080096
97 /**
98 * This string column contains the content provider uri that can be queried to access the
99 * from addresses for this account.
100 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800101 public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800102
103 /**
104 * This string column contains the content provider uri that can be used to save (insert)
105 * new draft messages for this account.
106 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800107 public static final String SAVE_NEW_DRAFT_URI = "saveNewDraftUri";
108
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800109 /**
110 * This string column contains the content provider uri that can be used to send
111 * a message for this account.
112 * NOTE: This might be better to be an update operation on the messageUri.
113 */
114 public static final String SEND_MESSAGE_URI = "sendMessageUri";
115
Mindy Pereira6f92de62011-12-19 11:31:48 -0800116 private AccountColumns() {};
117 }
118
119 /**
120 * Returns a uri that, when queried, will return a cursor with a list of information for the
121 * list of configured accounts.
122 * @return
123 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800124 // TODO: create a static registry for the starting point for the UI provider.
125// public static Uri getAccountsUri() {
126// return Uri.parse(BASE_URI_STRING + "/");
127// }
128
129 public static final class DraftType {
130 public static final String COMPOSE = "compose";
131 public static final String REPLY = "reply";
132 public static final String REPLY_ALL = "replyAll";
133 public static final String FORWARD = "forward";
134
135 private DraftType() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800136 }
137
138
139 public static final class MessageColumns {
140 public static final String ID = "_id";
141 public static final String URI = "uri";
142 public static final String MESSAGE_ID = "messageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800143 public static final String CONVERSATION_ID = "conversationId";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800144 public static final String SUBJECT = "subject";
145 public static final String SNIPPET = "snippet";
146 public static final String FROM = "fromAddress";
147 public static final String TO = "toAddresses";
148 public static final String CC = "ccAddresses";
149 public static final String BCC = "bccAddresses";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800150 public static final String REPLY_TO = "replyToAddress";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800151 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800152 public static final String BODY_HTML = "bodyHtml";
153 public static final String BODY_TEXT = "bodyText";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800154 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources";
155 public static final String REF_MESSAGE_ID = "refMessageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800156 public static final String DRAFT_TYPE = "draftType";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800157 public static final String INCLUDE_QUOTED_TEXT = "includeQuotedText";
158 public static final String QUOTE_START_POS = "quoteStartPos";
159 public static final String CLIENT_CREATED = "clientCreated";
160 public static final String CUSTOM_FROM_ADDRESS = "customFromAddress";
161
162 // TODO: Add attachments, flags
163
164 private MessageColumns() {}
165 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800166}