UIProvider.java revision 517743ef4e3e4ac103a3c096b9e3c894da7ed87a
1/******************************************************************************* 2 * Copyright (C) 2011 Google Inc. 3 * Licensed to The Android Open Source Project. 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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 *******************************************************************************/ 17 18package com.android.mail.providers; 19 20import android.content.ContentProvider; 21import android.content.ContentValues; 22import android.content.Context; 23import android.content.Intent; 24import android.net.Uri; 25import android.provider.BaseColumns; 26import android.text.TextUtils; 27 28import com.android.common.contacts.DataUsageStatUpdater; 29 30import java.util.ArrayList; 31 32public class UIProvider { 33 public static final String EMAIL_SEPARATOR = "\n"; 34 public static final long INVALID_CONVERSATION_ID = -1; 35 public static final long INVALID_MESSAGE_ID = -1; 36 37 /** 38 * Values for the current state of a Folder/Account; note that it's possible that more than one 39 * sync is in progress 40 */ 41 public static final class SyncStatus { 42 // No sync in progress 43 public static final int NO_SYNC = 0; 44 // A user-requested sync/refresh is in progress 45 public static final int USER_REFRESH = 1<<0; 46 // A user-requested query is in progress 47 public static final int USER_QUERY = 1<<1; 48 // A user request for additional results is in progress 49 public static final int USER_MORE_RESULTS = 1<<2; 50 // A background sync is in progress 51 public static final int BACKGROUND_SYNC = 1<<3; 52 } 53 54 /** 55 * Values for the result of the last attempted sync of a Folder/Account 56 */ 57 public static final class LastSyncResult { 58 // The sync completed successfully 59 public static final int SUCCESS = 0; 60 // The sync wasn't completed due to a connection error 61 public static final int CONNECTION_ERROR = 1; 62 // The sync wasn't completed due to an authentication error 63 public static final int AUTH_ERROR = 2; 64 // The sync wasn't completed due to a security error 65 public static final int SECURITY_ERROR = 3; 66 // The sync wasn't completed due to a low memory condition 67 public static final int STORAGE_ERROR = 4; 68 // The sync wasn't completed due to an internal error/exception 69 public static final int INTERNAL_ERROR = 5; 70 } 71 72 // The actual content provider should define its own authority 73 public static final String AUTHORITY = "com.android.mail.providers"; 74 75 public static final String ACCOUNT_LIST_TYPE = 76 "vnd.android.cursor.dir/vnd.com.android.mail.account"; 77 public static final String ACCOUNT_TYPE = 78 "vnd.android.cursor.item/vnd.com.android.mail.account"; 79 80 /** 81 * Query parameter key that can be used to control the behavior of list queries. The value 82 * must be a serialized {@link ListParams} object. UIProvider implementations are not 83 * required to respect this query parameter 84 */ 85 public static final String LIST_PARAMS_QUERY_PARAMETER = "listParams"; 86 87 public static final String[] ACCOUNTS_PROJECTION = { 88 BaseColumns._ID, 89 AccountColumns.NAME, 90 AccountColumns.PROVIDER_VERSION, 91 AccountColumns.URI, 92 AccountColumns.CAPABILITIES, 93 AccountColumns.FOLDER_LIST_URI, 94 AccountColumns.SEARCH_URI, 95 AccountColumns.ACCOUNT_FROM_ADDRESSES_URI, 96 AccountColumns.SAVE_DRAFT_URI, 97 AccountColumns.SEND_MAIL_URI, 98 AccountColumns.EXPUNGE_MESSAGE_URI, 99 AccountColumns.UNDO_URI, 100 AccountColumns.SETTINGS_INTENT_URI, 101 AccountColumns.SETTINGS_QUERY_URI, 102 AccountColumns.SYNC_STATUS, 103 AccountColumns.HELP_INTENT_URI, 104 AccountColumns.SEND_FEEDBACK_INTENT_URI, 105 AccountColumns.COMPOSE_URI, 106 AccountColumns.MIME_TYPE, 107 AccountColumns.RECENT_FOLDER_LIST_URI 108 }; 109 110 public static final int ACCOUNT_ID_COLUMN = 0; 111 public static final int ACCOUNT_NAME_COLUMN = 1; 112 public static final int ACCOUNT_PROVIDER_VERISON_COLUMN = 2; 113 public static final int ACCOUNT_URI_COLUMN = 3; 114 public static final int ACCOUNT_CAPABILITIES_COLUMN = 4; 115 public static final int ACCOUNT_FOLDER_LIST_URI_COLUMN = 5; 116 public static final int ACCOUNT_SEARCH_URI_COLUMN = 6; 117 public static final int ACCOUNT_FROM_ADDRESSES_URI_COLUMN = 7; 118 public static final int ACCOUNT_SAVE_DRAFT_URI_COLUMN = 8; 119 public static final int ACCOUNT_SEND_MESSAGE_URI_COLUMN = 9; 120 public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10; 121 public static final int ACCOUNT_UNDO_URI_COLUMN = 11; 122 public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12; 123 public static final int ACCOUNT_SETTINGS_QUERY_URI_COLUMN = 13; 124 public static final int ACCOUNT_SYNC_STATUS_COLUMN = 14; 125 public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 15; 126 public static final int ACCOUNT_SEND_FEEDBACK_INTENT_URI_COLUMN = 16; 127 public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 17; 128 public static final int ACCOUNT_MIME_TYPE_COLUMN = 18; 129 public static final int ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN = 19; 130 131 public static final class AccountCapabilities { 132 /** 133 * Whether folders can be synchronized back to the server. 134 */ 135 public static final int SYNCABLE_FOLDERS = 0x0001; 136 /** 137 * Whether the server allows reporting spam back. 138 */ 139 public static final int REPORT_SPAM = 0x0002; 140 /** 141 * Whether the server supports a concept of Archive: removing mail from the Inbox but 142 * keeping it around. 143 */ 144 public static final int ARCHIVE = 0x0004; 145 /** 146 * Whether the server will stop notifying on updates to this thread? This requires 147 * THREADED_CONVERSATIONS to be true, otherwise it should be ignored. 148 */ 149 public static final int MUTE = 0x0008; 150 /** 151 * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS 152 * to be true, otherwise it should be ignored. 153 */ 154 public static final int SERVER_SEARCH = 0x0010; 155 /** 156 * Whether the server supports constraining search to a single folder. Requires 157 * SYNCABLE_FOLDERS, otherwise it should be ignored. 158 */ 159 public static final int FOLDER_SERVER_SEARCH = 0x0020; 160 /** 161 * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML). 162 */ 163 public static final int SANITIZED_HTML = 0x0040; 164 /** 165 * Whether the server allows synchronization of draft messages. This does NOT require 166 * SYNCABLE_FOLDERS to be set. 167 */ 168 public static final int DRAFT_SYNCHRONIZATION = 0x0080; 169 /** 170 * Does the server allow the user to compose mails (and reply) using addresses other than 171 * their account name? For instance, GMail allows users to set FROM addresses that are 172 * different from account@gmail.com address. For instance, user@gmail.com could have another 173 * FROM: address like user@android.com. If the user has enabled multiple FROM address, he 174 * can compose (and reply) using either address. 175 */ 176 public static final int MULTIPLE_FROM_ADDRESSES = 0x0100; 177 /** 178 * Whether the server allows the original message to be included in the reply by setting a 179 * flag on the reply. If we can avoid including the entire previous message, we save on 180 * bandwidth (replies are shorter). 181 */ 182 public static final int SMART_REPLY = 0x0200; 183 /** 184 * Does this account support searching locally, on the device? This requires the backend 185 * storage to support a mechanism for searching. 186 */ 187 public static final int LOCAL_SEARCH = 0x0400; 188 /** 189 * Whether the server supports a notion of threaded conversations: where replies to messages 190 * are tagged to keep conversations grouped. This could be full threading (each message 191 * lists its parent) or conversation-level threading (each message lists one conversation 192 * which it belongs to) 193 */ 194 public static final int THREADED_CONVERSATIONS = 0x0800; 195 /** 196 * Whether the server supports allowing a conversation to be in multiple folders. (Or allows 197 * multiple folders on a single conversation) 198 */ 199 public static final int MULTIPLE_FOLDERS_PER_CONV = 0x1000; 200 /** 201 * Whether the provider supports undoing operations. If it doesn't, never show the undo bar. 202 */ 203 public static final int UNDO = 0x2000; 204 /** 205 * Whether the account provides help content. 206 */ 207 public static final int HELP_CONTENT = 0x4000; 208 /** 209 * Whether the account provides a way to send feedback content. 210 */ 211 public static final int SEND_FEEDBACK = 0x8000; 212 /** 213 * Whether the account provides a mechanism for marking conversations as important. 214 */ 215 public static final int MARK_IMPORTANT = 0x10000; 216 /** 217 * Whether initial conversation queries should use a limit parameter 218 */ 219 public static final int INITIAL_CONVERSATION_LIMIT = 0x20000; 220 } 221 222 public static final class AccountColumns { 223 /** 224 * This string column contains the human visible name for the account. 225 */ 226 public static final String NAME = "name"; 227 228 /** 229 * This integer contains the type of the account: Google versus non google. This is not 230 * returned by the UIProvider, rather this is a notion in the system. 231 */ 232 public static final String TYPE = "type"; 233 234 /** 235 * This integer column returns the version of the UI provider schema from which this 236 * account provider will return results. 237 */ 238 public static final String PROVIDER_VERSION = "providerVersion"; 239 240 /** 241 * This string column contains the uri to directly access the information for this account. 242 */ 243 public static final String URI = "accountUri"; 244 245 /** 246 * This integer column contains a bit field of the possible capabilities that this account 247 * supports. 248 */ 249 public static final String CAPABILITIES = "capabilities"; 250 251 /** 252 * This string column contains the content provider uri to return the 253 * list of top level folders for this account. 254 */ 255 public static final String FOLDER_LIST_URI = "folderListUri"; 256 257 /** 258 * This string column contains the content provider uri that can be queried for search 259 * results. 260 * The supported query parameters are limited to those listed 261 * in {@link SearchQueryParameters} 262 * The cursor returned from this query is expected have one row, where the columnm are a 263 * subset of the columns specified in {@link FolderColumns} 264 */ 265 public static final String SEARCH_URI = "searchUri"; 266 267 /** 268 * This string column contains the content provider uri that can be queried to access the 269 * from addresses for this account. 270 */ 271 public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri"; 272 273 /** 274 * This string column contains the content provider uri that can be used to save (insert) 275 * new draft messages for this account. NOTE: This might be better to 276 * be an update operation on the messageUri. 277 */ 278 public static final String SAVE_DRAFT_URI = "saveDraftUri"; 279 280 /** 281 * This string column contains the content provider uri that can be used to send 282 * a message for this account. 283 * NOTE: This might be better to be an update operation on the messageUri. 284 */ 285 public static final String SEND_MAIL_URI = "sendMailUri"; 286 287 /** 288 * This string column contains the content provider uri that can be used 289 * to expunge a message from this account. NOTE: This might be better to 290 * be an update operation on the messageUri. 291 * When {@link android.content.ContentResolver#update()} is called with this uri, the 292 * {@link ContentValues} object is expected to have {@link BaseColumns._ID} specified with 293 * the local message id of the message. 294 */ 295 public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri"; 296 297 /** 298 * This string column contains the content provider uri that can be used 299 * to undo the last committed action. 300 */ 301 public static final String UNDO_URI = "undoUri"; 302 303 /** 304 * Uri for EDIT intent that will cause the settings screens for this account type to be 305 * shown. 306 * TODO: When we want to support a heterogeneous set of account types, this value may need 307 * to be moved to a global content provider. 308 */ 309 public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri"; 310 311 /** 312 * This string column contains the content provider uri that can be used to query user 313 * settings/preferences. 314 * 315 * The cursor returned by this query support columns declared in {@link SettingsColumns} 316 */ 317 public static final String SETTINGS_QUERY_URI = "accountSettingsQueryUri"; 318 319 /** 320 * Uri for VIEW intent that will cause the help screens for this account type to be 321 * shown. 322 * TODO: When we want to support a heterogeneous set of account types, this value may need 323 * to be moved to a global content provider. 324 */ 325 public static String HELP_INTENT_URI = "helpIntentUri"; 326 327 /** 328 * Uri for VIEW intent that will cause the send feedback for this account type to be 329 * shown. 330 * TODO: When we want to support a heterogeneous set of account types, this value may need 331 * to be moved to a global content provider. 332 */ 333 public static String SEND_FEEDBACK_INTENT_URI = "sendFeedbackIntentUri"; 334 335 /** 336 * This int column contains the current sync status of the account (the logical AND of the 337 * sync status of folders in this account) 338 */ 339 public static final String SYNC_STATUS = "syncStatus"; 340 /** 341 * Uri for VIEW intent that will cause the compose screens for this type 342 * of account to be shown. 343 */ 344 public static final String COMPOSE_URI = "composeUri"; 345 /** 346 * Mime-type defining this account. 347 */ 348 public static final String MIME_TYPE = "mimeType"; 349 /** 350 * URI for location of recent folders viewed on this account. 351 */ 352 public static final String RECENT_FOLDER_LIST_URI = "recentFolderListUri"; 353 } 354 355 public static final class SearchQueryParameters { 356 /** 357 * Parameter used to specify the search query. 358 */ 359 public static final String QUERY = "query"; 360 361 /** 362 * If specified, the query results will be limited to this folder. 363 */ 364 public static final String FOLDER = "folder"; 365 366 private SearchQueryParameters() {} 367 } 368 369 public static final class ConversationListQueryParameters { 370 public static final String DEFAULT_LIMIT = "50"; 371 /** 372 * Parameter used to limit the number of rows returned by a conversation list query 373 */ 374 public static final String LIMIT = "limit"; 375 376 /** 377 * Parameter used to control whether the this query a remote server. 378 */ 379 public static final String USE_NETWORK = "use_network"; 380 381 private ConversationListQueryParameters() {} 382 } 383 384 // We define a "folder" as anything that contains a list of conversations. 385 public static final String FOLDER_LIST_TYPE = 386 "vnd.android.cursor.dir/vnd.com.android.mail.folder"; 387 public static final String FOLDER_TYPE = 388 "vnd.android.cursor.item/vnd.com.android.mail.folder"; 389 390 public static final String[] FOLDERS_PROJECTION = { 391 BaseColumns._ID, 392 FolderColumns.URI, 393 FolderColumns.NAME, 394 FolderColumns.HAS_CHILDREN, 395 FolderColumns.CAPABILITIES, 396 FolderColumns.SYNC_WINDOW, 397 FolderColumns.CONVERSATION_LIST_URI, 398 FolderColumns.CHILD_FOLDERS_LIST_URI, 399 FolderColumns.UNREAD_COUNT, 400 FolderColumns.TOTAL_COUNT, 401 FolderColumns.REFRESH_URI, 402 FolderColumns.SYNC_STATUS, 403 FolderColumns.LAST_SYNC_RESULT, 404 FolderColumns.TYPE, 405 FolderColumns.ICON_RES_ID, 406 FolderColumns.BG_COLOR, 407 FolderColumns.FG_COLOR, 408 FolderColumns.LOAD_MORE_URI 409 }; 410 411 public static final int FOLDER_ID_COLUMN = 0; 412 public static final int FOLDER_URI_COLUMN = 1; 413 public static final int FOLDER_NAME_COLUMN = 2; 414 public static final int FOLDER_HAS_CHILDREN_COLUMN = 3; 415 public static final int FOLDER_CAPABILITIES_COLUMN = 4; 416 public static final int FOLDER_SYNC_WINDOW_COLUMN = 5; 417 public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6; 418 public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7; 419 public static final int FOLDER_UNREAD_COUNT_COLUMN = 8; 420 public static final int FOLDER_TOTAL_COUNT_COLUMN = 9; 421 public static final int FOLDER_REFRESH_URI_COLUMN = 10; 422 public static final int FOLDER_SYNC_STATUS_COLUMN = 11; 423 public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12; 424 public static final int FOLDER_TYPE_COLUMN = 13; 425 public static final int FOLDER_ICON_RES_ID_COLUMN = 14; 426 public static final int FOLDER_BG_COLOR_COLUMN = 15; 427 public static final int FOLDER_FG_COLOR_COLUMN = 16; 428 public static final int FOLDER_LOAD_MORE_URI_COLUMN = 17; 429 430 public static final class FolderType { 431 public static final int DEFAULT = 0; 432 public static final int INBOX = 1; 433 public static final int DRAFT = 2; 434 public static final int OUTBOX = 3; 435 public static final int SENT = 4; 436 public static final int TRASH = 5; 437 public static final int SPAM = 6; 438 } 439 440 public static final class FolderCapabilities { 441 public static final int SYNCABLE = 0x0001; 442 public static final int PARENT = 0x0002; 443 public static final int CAN_HOLD_MAIL = 0x0004; 444 public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008; 445 /** 446 * For accounts that support archive, this will indicate that this folder supports 447 * the archive functionality. 448 */ 449 public static final int ARCHIVE = 0x0010; 450 451 /** 452 * For accounts that support report spam, this will indicate that this folder supports 453 * the report spam functionality. 454 */ 455 public static final int REPORT_SPAM = 0x0020; 456 457 /** 458 * For accounts that support mute, this will indicate if a mute is performed from within 459 * this folder, the action is destructive. 460 */ 461 public static final int DESTRUCTIVE_MUTE = 0x0040; 462 } 463 464 public static final class FolderColumns { 465 /** 466 * This string column contains the uri of the folder. 467 */ 468 public static final String URI = "folderUri"; 469 /** 470 * This string column contains the human visible name for the folder. 471 */ 472 public static final String NAME = "name"; 473 /** 474 * This int column represents the capabilities of the folder specified by 475 * FolderCapabilities flags. 476 */ 477 public static String CAPABILITIES = "capabilities"; 478 /** 479 * This int column represents whether or not this folder has any 480 * child folders. 481 */ 482 public static String HAS_CHILDREN = "hasChildren"; 483 /** 484 * This int column represents how large the sync window is. 485 */ 486 public static String SYNC_WINDOW = "syncWindow"; 487 /** 488 * This string column contains the content provider uri to return the 489 * list of conversations for this folder. 490 */ 491 public static final String CONVERSATION_LIST_URI = "conversationListUri"; 492 /** 493 * This string column contains the content provider uri to return the 494 * list of child folders of this folder. 495 */ 496 public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri"; 497 498 public static final String UNREAD_COUNT = "unreadCount"; 499 500 public static final String TOTAL_COUNT = "totalCount"; 501 /** 502 * This string column contains the content provider uri to force a 503 * refresh of this folder. 504 */ 505 public static final String REFRESH_URI = "refreshUri"; 506 /** 507 * This int column contains current sync status of the folder; some combination of the 508 * SyncStatus bits defined above 509 */ 510 public static final String SYNC_STATUS = "syncStatus"; 511 /** 512 * This int column contains the sync status of the last sync attempt; one of the 513 * LastSyncStatus values defined above 514 */ 515 public static final String LAST_SYNC_RESULT = "lastSyncResult"; 516 /** 517 * This long column contains the icon res id for this folder, or 0 if there is none. 518 */ 519 public static final String ICON_RES_ID = "iconResId"; 520 /** 521 * This int column contains the type of the folder. Zero is default. 522 */ 523 public static final String TYPE = "type"; 524 /** 525 * String representing the integer background color associated with this 526 * folder, or null. 527 */ 528 public static final String BG_COLOR = "bgColor"; 529 /** 530 * String representing the integer of the foreground color associated 531 * with this folder, or null. 532 */ 533 public static final String FG_COLOR = "fgColor"; 534 /** 535 * String with the content provider Uri used to request more items in the folder, or null. 536 */ 537 public static final String LOAD_MORE_URI = "loadMoreUri"; 538 public FolderColumns() {} 539 } 540 541 // We define a "folder" as anything that contains a list of conversations. 542 public static final String CONVERSATION_LIST_TYPE = 543 "vnd.android.cursor.dir/vnd.com.android.mail.conversation"; 544 public static final String CONVERSATION_TYPE = 545 "vnd.android.cursor.item/vnd.com.android.mail.conversation"; 546 547 548 public static final String[] CONVERSATION_PROJECTION = { 549 BaseColumns._ID, 550 ConversationColumns.URI, 551 ConversationColumns.MESSAGE_LIST_URI, 552 ConversationColumns.SUBJECT, 553 ConversationColumns.SNIPPET, 554 ConversationColumns.SENDER_INFO, 555 ConversationColumns.DATE_RECEIVED_MS, 556 ConversationColumns.HAS_ATTACHMENTS, 557 ConversationColumns.NUM_MESSAGES, 558 ConversationColumns.NUM_DRAFTS, 559 ConversationColumns.SENDING_STATE, 560 ConversationColumns.PRIORITY, 561 ConversationColumns.READ, 562 ConversationColumns.STARRED, 563 ConversationColumns.FOLDER_LIST, 564 ConversationColumns.RAW_FOLDERS, 565 ConversationColumns.FLAGS, 566 ConversationColumns.PERSONAL_LEVEL 567 }; 568 569 // These column indexes only work when the caller uses the 570 // default CONVERSATION_PROJECTION defined above. 571 public static final int CONVERSATION_ID_COLUMN = 0; 572 public static final int CONVERSATION_URI_COLUMN = 1; 573 public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2; 574 public static final int CONVERSATION_SUBJECT_COLUMN = 3; 575 public static final int CONVERSATION_SNIPPET_COLUMN = 4; 576 public static final int CONVERSATION_SENDER_INFO_COLUMN = 5; 577 public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6; 578 public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7; 579 public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8; 580 public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9; 581 public static final int CONVERSATION_SENDING_STATE_COLUMN = 10; 582 public static final int CONVERSATION_PRIORITY_COLUMN = 11; 583 public static final int CONVERSATION_READ_COLUMN = 12; 584 public static final int CONVERSATION_STARRED_COLUMN = 13; 585 public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14; 586 public static final int CONVERSATION_RAW_FOLDERS_COLUMN = 15; 587 public static final int CONVERSATION_FLAGS_COLUMN = 16; 588 public static final int CONVERSATION_PERSONAL_LEVEL_COLUMN = 17; 589 590 public static final class ConversationSendingState { 591 public static final int OTHER = 0; 592 public static final int SENDING = 1; 593 public static final int SENT = 2; 594 public static final int SEND_ERROR = -1; 595 } 596 597 public static final class ConversationPriority { 598 public static final int DEFAULT = 0; 599 public static final int IMPORTANT = 1; 600 public static final int LOW = 0; 601 public static final int HIGH = 1; 602 } 603 604 public static final class ConversationPersonalLevel { 605 public static final int NOT_TO_ME = 0; 606 public static final int TO_ME_AND_OTHERS = 1; 607 public static final int ONLY_TO_ME = 2; 608 } 609 610 public static final class ConversationFlags { 611 public static final int REPLIED = 1<<2; 612 public static final int FORWARDED = 1<<3; 613 public static final int CALENDAR_INVITE = 1<<4; 614 } 615 616 public static final class ConversationColumns { 617 public static final String URI = "conversationUri"; 618 /** 619 * This string column contains the content provider uri to return the 620 * list of messages for this conversation. 621 * The cursor returned by this query can return a {@link android.os.Bundle} 622 * from a call to {@link android.database.Cursor#getExtras()}. This Bundle may have 623 * values with keys listed in {@link CursorExtraKeys} 624 */ 625 public static final String MESSAGE_LIST_URI = "messageListUri"; 626 /** 627 * This string column contains the subject string for a conversation. 628 */ 629 public static final String SUBJECT = "subject"; 630 /** 631 * This string column contains the snippet string for a conversation. 632 */ 633 public static final String SNIPPET = "snippet"; 634 /** 635 * This string column contains the sender info string for a 636 * conversation. 637 */ 638 public static final String SENDER_INFO = "senderInfo"; 639 /** 640 * This long column contains the time in ms of the latest update to a 641 * conversation. 642 */ 643 public static final String DATE_RECEIVED_MS = "dateReceivedMs"; 644 645 /** 646 * This boolean column contains whether any messages in this conversation 647 * have attachments. 648 */ 649 public static final String HAS_ATTACHMENTS = "hasAttachments"; 650 651 /** 652 * This int column contains the number of messages in this conversation. 653 * For unthreaded, this will always be 1. 654 */ 655 public static String NUM_MESSAGES = "numMessages"; 656 657 /** 658 * This int column contains the number of drafts associated with this 659 * conversation. 660 */ 661 public static String NUM_DRAFTS = "numDrafts"; 662 663 /** 664 * This int column contains the state of drafts and replies associated 665 * with this conversation. Use ConversationSendingState to interpret 666 * this field. 667 */ 668 public static String SENDING_STATE = "sendingState"; 669 670 /** 671 * This int column contains the priority of this conversation. Use 672 * ConversationPriority to interpret this field. 673 */ 674 public static String PRIORITY = "priority"; 675 676 /** 677 * This boolean column indicates whether the conversation has been read 678 */ 679 public static String READ = "read"; 680 681 /** 682 * This boolean column indicates whether the conversation has been starred 683 */ 684 public static String STARRED = "starred"; 685 686 /** 687 * This string column contains a csv of all folder uris associated with this 688 * conversation 689 */ 690 public static final String FOLDER_LIST = "folderList"; 691 692 /** 693 * This string column contains a serialized list of all folders 694 * separated by a Folder.FOLDER_SEPARATOR that are associated with this 695 * conversation. The folders should be only those that the provider 696 * wants to have displayed. 697 */ 698 public static final String RAW_FOLDERS = "rawFolders"; 699 public static final String FLAGS = "conversationFlags"; 700 public static final String PERSONAL_LEVEL = "personalLevel"; 701 private ConversationColumns() { 702 } 703 } 704 705 /** 706 * List of operations that can can be performed on a conversation. These operations are applied 707 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])} 708 * where the conversation uri is specified, and the ContentValues specifies the operation to 709 * be performed. 710 * <p/> 711 * The operation to be performed is specified in the ContentValues by 712 * the {@link ConversationOperations#OPERATION_KEY} 713 * <p/> 714 * Note not all UI providers will support these operations. {@link AccountCapabilities} can 715 * be used to determine which operations are supported. 716 */ 717 public static final class ConversationOperations { 718 /** 719 * ContentValues key used to specify the operation to be performed 720 */ 721 public static final String OPERATION_KEY = "operation"; 722 723 /** 724 * Archive operation 725 */ 726 public static final String ARCHIVE = "archive"; 727 728 /** 729 * Mute operation 730 */ 731 public static final String MUTE = "mute"; 732 733 /** 734 * Report spam operation 735 */ 736 public static final String REPORT_SPAM = "report_spam"; 737 738 private ConversationOperations() { 739 } 740 } 741 742 public static final class DraftType { 743 public static final int NOT_A_DRAFT = 0; 744 public static final int COMPOSE = 1; 745 public static final int REPLY = 2; 746 public static final int REPLY_ALL = 3; 747 public static final int FORWARD = 4; 748 749 private DraftType() {} 750 } 751 752 public static final String[] MESSAGE_PROJECTION = { 753 BaseColumns._ID, 754 MessageColumns.SERVER_ID, 755 MessageColumns.URI, 756 MessageColumns.CONVERSATION_ID, 757 MessageColumns.SUBJECT, 758 MessageColumns.SNIPPET, 759 MessageColumns.FROM, 760 MessageColumns.TO, 761 MessageColumns.CC, 762 MessageColumns.BCC, 763 MessageColumns.REPLY_TO, 764 MessageColumns.DATE_RECEIVED_MS, 765 MessageColumns.BODY_HTML, 766 MessageColumns.BODY_TEXT, 767 MessageColumns.EMBEDS_EXTERNAL_RESOURCES, 768 MessageColumns.REF_MESSAGE_ID, 769 MessageColumns.DRAFT_TYPE, 770 MessageColumns.APPEND_REF_MESSAGE_CONTENT, 771 MessageColumns.HAS_ATTACHMENTS, 772 MessageColumns.ATTACHMENT_LIST_URI, 773 MessageColumns.MESSAGE_FLAGS, 774 MessageColumns.JOINED_ATTACHMENT_INFOS, 775 MessageColumns.SAVE_MESSAGE_URI, 776 MessageColumns.SEND_MESSAGE_URI, 777 MessageColumns.ALWAYS_SHOW_IMAGES, 778 MessageColumns.READ, 779 MessageColumns.STARRED, 780 MessageColumns.QUOTE_START_POS 781 }; 782 783 /** Separates attachment info parts in strings in a message. */ 784 public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n"; 785 public static final String MESSAGE_LIST_TYPE = 786 "vnd.android.cursor.dir/vnd.com.android.mail.message"; 787 public static final String MESSAGE_TYPE = 788 "vnd.android.cursor.item/vnd.com.android.mail.message"; 789 790 public static final int MESSAGE_ID_COLUMN = 0; 791 public static final int MESSAGE_SERVER_ID_COLUMN = 1; 792 public static final int MESSAGE_URI_COLUMN = 2; 793 public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3; 794 public static final int MESSAGE_SUBJECT_COLUMN = 4; 795 public static final int MESSAGE_SNIPPET_COLUMN = 5; 796 public static final int MESSAGE_FROM_COLUMN = 6; 797 public static final int MESSAGE_TO_COLUMN = 7; 798 public static final int MESSAGE_CC_COLUMN = 8; 799 public static final int MESSAGE_BCC_COLUMN = 9; 800 public static final int MESSAGE_REPLY_TO_COLUMN = 10; 801 public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11; 802 public static final int MESSAGE_BODY_HTML_COLUMN = 12; 803 public static final int MESSAGE_BODY_TEXT_COLUMN = 13; 804 public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14; 805 public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15; 806 public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16; 807 public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17; 808 public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18; 809 public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19; 810 public static final int MESSAGE_FLAGS_COLUMN = 20; 811 public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21; 812 public static final int MESSAGE_SAVE_URI_COLUMN = 22; 813 public static final int MESSAGE_SEND_URI_COLUMN = 23; 814 public static final int MESSAGE_ALWAYS_SHOW_IMAGES_COLUMN = 24; 815 public static final int MESSAGE_READ_COLUMN = 25; 816 public static final int MESSAGE_STARRED_COLUMN = 26; 817 public static final int QUOTED_TEXT_OFFSET_COLUMN = 27; 818 819 820 public static final class CursorStatus { 821 // The cursor is actively loading more data 822 public static final int LOADING = 1 << 0; 823 824 // The cursor is currently not loading more data, but more data may be available 825 public static final int LOADED = 1 << 1; 826 827 // An error occured while loading data 828 public static final int ERROR = 1 << 2; 829 830 // The cursor is loaded, and there will be no more data 831 public static final int COMPLETE = 1 << 3; 832 } 833 834 835 public static final class CursorExtraKeys { 836 /** 837 * This integer column contains the staus of the message cursor. The value will be 838 * one defined in {@link CursorStatus}. 839 */ 840 public static final String EXTRA_STATUS = "status"; 841 842 /** 843 * Used for finding the cause of an error. 844 * TODO: define these values 845 */ 846 public static final String EXTRA_ERROR = "error"; 847 848 } 849 850 851 public static final class MessageFlags { 852 public static final int REPLIED = 1 << 2; 853 public static final int FORWARDED = 1 << 3; 854 } 855 856 public static final class MessageColumns { 857 /** 858 * This string column contains a content provider URI that points to this single message. 859 */ 860 public static final String URI = "messageUri"; 861 /** 862 * This string column contains a server-assigned ID for this message. 863 */ 864 public static final String SERVER_ID = "serverMessageId"; 865 public static final String CONVERSATION_ID = "conversationId"; 866 /** 867 * This string column contains the subject of a message. 868 */ 869 public static final String SUBJECT = "subject"; 870 /** 871 * This string column contains a snippet of the message body. 872 */ 873 public static final String SNIPPET = "snippet"; 874 /** 875 * This string column contains the single email address (and optionally name) of the sender. 876 */ 877 public static final String FROM = "fromAddress"; 878 /** 879 * This string column contains a comma-delimited list of "To:" recipient email addresses. 880 */ 881 public static final String TO = "toAddresses"; 882 /** 883 * This string column contains a comma-delimited list of "CC:" recipient email addresses. 884 */ 885 public static final String CC = "ccAddresses"; 886 /** 887 * This string column contains a comma-delimited list of "BCC:" recipient email addresses. 888 * This value will be null for incoming messages. 889 */ 890 public static final String BCC = "bccAddresses"; 891 /** 892 * This string column contains the single email address (and optionally name) of the 893 * sender's reply-to address. 894 */ 895 public static final String REPLY_TO = "replyToAddress"; 896 /** 897 * This long column contains the timestamp (in millis) of receipt of the message. 898 */ 899 public static final String DATE_RECEIVED_MS = "dateReceivedMs"; 900 /** 901 * This string column contains the HTML form of the message body, if available. If not, 902 * a provider must populate BODY_TEXT. 903 */ 904 public static final String BODY_HTML = "bodyHtml"; 905 /** 906 * This string column contains the plaintext form of the message body, if HTML is not 907 * otherwise available. If HTML is available, this value should be left empty (null). 908 */ 909 public static final String BODY_TEXT = "bodyText"; 910 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources"; 911 /** 912 * This string column contains an opaque string used by the sendMessage api. 913 */ 914 public static final String REF_MESSAGE_ID = "refMessageId"; 915 /** 916 * This integer column contains the type of this draft, or zero (0) if this message is not a 917 * draft. See {@link DraftType} for possible values. 918 */ 919 public static final String DRAFT_TYPE = "draftType"; 920 /** 921 * This boolean column indicates whether an outgoing message should trigger special quoted 922 * text processing upon send. The value should default to zero (0) for protocols that do 923 * not support or require this flag, and for all incoming messages. 924 */ 925 public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent"; 926 /** 927 * This boolean column indicates whether a message has attachments. The list of attachments 928 * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}. 929 */ 930 public static final String HAS_ATTACHMENTS = "hasAttachments"; 931 /** 932 * This string column contains the content provider URI for the list of 933 * attachments associated with this message. 934 */ 935 public static final String ATTACHMENT_LIST_URI = "attachmentListUri"; 936 /** 937 * This long column is a bit field of flags defined in {@link MessageFlags}. 938 */ 939 public static final String MESSAGE_FLAGS = "messageFlags"; 940 /** 941 * This string column contains a specially formatted string representing all 942 * attachments that we added to a message that is being sent or saved. 943 */ 944 public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos"; 945 /** 946 * This string column contains the content provider URI for saving this 947 * message. 948 */ 949 public static final String SAVE_MESSAGE_URI = "saveMessageUri"; 950 /** 951 * This string column contains content provider URI for sending this 952 * message. 953 */ 954 public static final String SEND_MESSAGE_URI = "sendMessageUri"; 955 956 /** 957 * This integer column represents whether the user has specified that images should always 958 * be shown. The value of "1" indicates that the user has specified that images should be 959 * shown, while the value of "0" indicates that the user should be prompted before loading 960 * any external images. 961 */ 962 public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages"; 963 964 /** 965 * This boolean column indicates whether the message has been read 966 */ 967 public static String READ = "read"; 968 969 /** 970 * This boolean column indicates whether the message has been starred 971 */ 972 public static String STARRED = "starred"; 973 974 /** 975 * This integer column represents the offset in the message of quoted 976 * text. If include_quoted_text is zero, the value contained in this 977 * column is invalid. 978 */ 979 public static final String QUOTE_START_POS = "quotedTextStartPos"; 980 981 private MessageColumns() {} 982 } 983 984 public static final String ATTACHMENT_LIST_TYPE = 985 "vnd.android.cursor.dir/vnd.com.android.mail.attachment"; 986 public static final String ATTACHMENT_TYPE = 987 "vnd.android.cursor.item/vnd.com.android.mail.attachment"; 988 989 public static final String[] ATTACHMENT_PROJECTION = { 990 AttachmentColumns.NAME, 991 AttachmentColumns.SIZE, 992 AttachmentColumns.URI, 993 AttachmentColumns.CONTENT_TYPE, 994 AttachmentColumns.STATE, 995 AttachmentColumns.DESTINATION, 996 AttachmentColumns.DOWNLOADED_SIZE, 997 AttachmentColumns.CONTENT_URI, 998 AttachmentColumns.THUMBNAIL_URI, 999 AttachmentColumns.PREVIEW_INTENT 1000 }; 1001 private static final String EMAIL_SEPARATOR_PATTERN = "\n"; 1002 public static final int ATTACHMENT_NAME_COLUMN = 0; 1003 public static final int ATTACHMENT_SIZE_COLUMN = 1; 1004 public static final int ATTACHMENT_URI_COLUMN = 2; 1005 public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 3; 1006 public static final int ATTACHMENT_STATE_COLUMN = 4; 1007 public static final int ATTACHMENT_DESTINATION_COLUMN = 5; 1008 public static final int ATTACHMENT_DOWNLOADED_SIZE_COLUMN = 6; 1009 public static final int ATTACHMENT_CONTENT_URI_COLUMN = 7; 1010 public static final int ATTACHMENT_THUMBNAIL_URI_COLUMN = 8; 1011 public static final int ATTACHMENT_PREVIEW_INTENT_COLUMN = 9; 1012 1013 /** 1014 * Valid states for the {@link AttachmentColumns#STATE} column. 1015 * 1016 */ 1017 public static final class AttachmentState { 1018 /** 1019 * The full attachment is not present on device. When used as a command, 1020 * setting this state will tell the provider to cancel a download in 1021 * progress. 1022 * <p> 1023 * Valid next states: {@link #DOWNLOADING} 1024 */ 1025 public static final int NOT_SAVED = 0; 1026 /** 1027 * The most recent attachment download attempt failed. The current UI 1028 * design does not require providers to persist this state, but 1029 * providers must return this state at least once after a download 1030 * failure occurs. This state may not be used as a command. 1031 * <p> 1032 * Valid next states: {@link #DOWNLOADING} 1033 */ 1034 public static final int FAILED = 1; 1035 /** 1036 * The attachment is currently being downloaded by the provider. 1037 * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current 1038 * download progress while in this state. When used as a command, 1039 * setting this state will tell the provider to initiate a download to 1040 * the accompanying destination in {@link AttachmentColumns#DESTINATION} 1041 * . 1042 * <p> 1043 * Valid next states: {@link #NOT_SAVED}, {@link #FAILED}, 1044 * {@link #SAVED} 1045 */ 1046 public static final int DOWNLOADING = 2; 1047 /** 1048 * The attachment was successfully downloaded to the destination in 1049 * {@link AttachmentColumns#DESTINATION}. If a provider later detects 1050 * that a download is missing, it should reset the state to 1051 * {@link #NOT_SAVED}. This state may not be used as a command on its 1052 * own. To move a file from cache to external, update 1053 * {@link AttachmentColumns#DESTINATION}. 1054 * <p> 1055 * Valid next states: {@link #NOT_SAVED} 1056 */ 1057 public static final int SAVED = 3; 1058 1059 private AttachmentState() {} 1060 } 1061 1062 public static final class AttachmentDestination { 1063 1064 /** 1065 * The attachment will be or is already saved to the app-private cache partition. 1066 */ 1067 public static final int CACHE = 0; 1068 /** 1069 * The attachment will be or is already saved to external shared device storage. 1070 */ 1071 public static final int EXTERNAL = 1; 1072 1073 private AttachmentDestination() {} 1074 } 1075 1076 public static final class AttachmentColumns { 1077 /** 1078 * This string column is the attachment's file name, intended for display in UI. It is not 1079 * the full path of the file. 1080 */ 1081 public static final String NAME = "name"; 1082 /** 1083 * This integer column is the file size of the attachment, in bytes. 1084 */ 1085 public static final String SIZE = "size"; 1086 /** 1087 * This column is a {@link Uri} that can be queried to monitor download state and progress 1088 * for this individual attachment (resulting cursor has one single row for this attachment). 1089 */ 1090 public static final String URI = "uri"; 1091 /** 1092 * This string column is the MIME type of the attachment. 1093 */ 1094 public static final String CONTENT_TYPE = "contentType"; 1095 /** 1096 * This integer column is the current downloading state of the 1097 * attachment as defined in {@link AttachmentState}. 1098 * <p> 1099 * Providers must accept updates to {@link #URI} with new values of 1100 * this column to initiate or cancel downloads. 1101 */ 1102 public static final String STATE = "state"; 1103 /** 1104 * This integer column is the file destination for the current download 1105 * in progress (when {@link #STATE} is 1106 * {@link AttachmentState#DOWNLOADING}) or the resulting downloaded file 1107 * ( when {@link #STATE} is {@link AttachmentState#SAVED}), as defined 1108 * in {@link AttachmentDestination}. This value is undefined in any 1109 * other state. 1110 * <p> 1111 * Providers must accept updates to {@link #URI} with new values of 1112 * this column to move an existing downloaded file. 1113 */ 1114 public static final String DESTINATION = "destination"; 1115 /** 1116 * This integer column is the current number of bytes downloaded when 1117 * {@link #STATE} is {@link AttachmentState#DOWNLOADING}. This value is 1118 * undefined in any other state. 1119 */ 1120 public static final String DOWNLOADED_SIZE = "downloadedSize"; 1121 /** 1122 * This column is a {@link Uri} that points to the downloaded local file 1123 * when {@link #STATE} is {@link AttachmentState#SAVED}. This value is 1124 * undefined in any other state. 1125 */ 1126 public static final String CONTENT_URI = "contentUri"; 1127 /** 1128 * This column is a {@link Uri} that points to a local thumbnail file 1129 * for the attachment. Providers that do not support downloading 1130 * attachment thumbnails may leave this null. 1131 */ 1132 public static final String THUMBNAIL_URI = "thumbnailUri"; 1133 /** 1134 * This column is an {@link Intent} to launch a preview activity that 1135 * allows the user to efficiently view an attachment without having to 1136 * first download the entire file. Providers that do not support 1137 * previewing attachments may leave this null. The intent is represented 1138 * as a byte-array blob generated by writing an Intent to a parcel and 1139 * then marshaling that parcel. 1140 */ 1141 public static final String PREVIEW_INTENT = "previewIntent"; 1142 1143 private AttachmentColumns() {} 1144 } 1145 1146 public static int getMailMaxAttachmentSize(String account) { 1147 // TODO: query the account to see what the max attachment size is? 1148 return 5 * 1024 * 1024; 1149 } 1150 1151 public static String getAttachmentTypeSetting() { 1152 // TODO: query the account to see what kinds of attachments it supports? 1153 return "com.google.android.gm.allowAddAnyAttachment"; 1154 } 1155 1156 public static void incrementRecipientsTimesContacted(Context context, String addressString) { 1157 DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context); 1158 ArrayList<String> recipients = new ArrayList<String>(); 1159 String[] addresses = TextUtils.split(addressString, EMAIL_SEPARATOR_PATTERN); 1160 for (String address : addresses) { 1161 recipients.add(address); 1162 } 1163 statsUpdater.updateWithAddress(recipients); 1164 } 1165 1166 public static final String[] UNDO_PROJECTION = { 1167 ConversationColumns.MESSAGE_LIST_URI 1168 }; 1169 public static final int UNDO_MESSAGE_LIST_COLUMN = 0; 1170 1171 // Parameter used to indicate the sequence number for an undoable operation 1172 public static final String SEQUENCE_QUERY_PARAMETER = "seq"; 1173 1174 1175 public static final String[] SETTINGS_PROJECTION = { 1176 SettingsColumns.SIGNATURE, 1177 SettingsColumns.AUTO_ADVANCE, 1178 SettingsColumns.MESSAGE_TEXT_SIZE, 1179 SettingsColumns.SNAP_HEADERS, 1180 SettingsColumns.REPLY_BEHAVIOR, 1181 SettingsColumns.HIDE_CHECKBOXES, 1182 SettingsColumns.CONFIRM_DELETE, 1183 SettingsColumns.CONFIRM_ARCHIVE, 1184 SettingsColumns.CONFIRM_SEND, 1185 SettingsColumns.DEFAULT_INBOX 1186 }; 1187 1188 public static final int SETTINGS_SIGNATURE_COLUMN = 0; 1189 public static final int SETTINGS_AUTO_ADVANCE_COLUMN = 1; 1190 public static final int SETTINGS_MESSAGE_TEXT_SIZE_COLUMN = 2; 1191 public static final int SETTINGS_SNAP_HEADERS_COLUMN = 3; 1192 public static final int SETTINGS_REPLY_BEHAVIOR_COLUMN = 4; 1193 public static final int SETTINGS_HIDE_CHECKBOXES_COLUMN = 5; 1194 public static final int SETTINGS_CONFIRM_DELETE_COLUMN = 6; 1195 public static final int SETTINGS_CONFIRM_ARCHIVE_COLUMN = 7; 1196 public static final int SETTINGS_CONFIRM_SEND_COLUMN = 8; 1197 public static final int SETTINGS_DEFAULT_INBOX_COLUMN = 9; 1198 1199 public static final class AutoAdvance { 1200 public static final int UNSET = 0; 1201 public static final int OLDER = 1; 1202 public static final int NEWER = 2; 1203 public static final int LIST = 3; 1204 } 1205 1206 public static final class SnapHeaderValue { 1207 public static final int ALWAYS = 0; 1208 public static final int PORTRAIT_ONLY = 1; 1209 public static final int NEVER = 2; 1210 } 1211 1212 public static final class MessageTextSize { 1213 public static final int TINY = -2; 1214 public static final int SMALL = -1; 1215 public static final int NORMAL = 0; 1216 public static final int LARGE = 1; 1217 public static final int HUGE = 2; 1218 } 1219 1220 public static final class DefaultReplyBehavior { 1221 public static final int REPLY = 0; 1222 public static final int REPLY_ALL = 1; 1223 } 1224 1225 public static final class SettingsColumns { 1226 /** 1227 * String column containing the contents of the signature for this account. If no 1228 * signature has been specified, the value will be null. 1229 */ 1230 public static final String SIGNATURE = "signature"; 1231 1232 /** 1233 * Integer column containing the user's specified auto-advance policy. This value will be 1234 * one of the values in {@link UIProvider.AutoAdvance} 1235 */ 1236 public static final String AUTO_ADVANCE = "auto_advance"; 1237 1238 /** 1239 * Integer column containing the user's specified message text size preference. This value 1240 * will be one of the values in {@link UIProvider.MessageTextSize} 1241 */ 1242 public static final String MESSAGE_TEXT_SIZE = "message_text_size"; 1243 1244 /** 1245 * Integer column contaning the user's specified snap header preference. This value 1246 * will be one of the values in {@link UIProvider.SnapHeaderValue} 1247 */ 1248 public static final String SNAP_HEADERS = "snap_headers"; 1249 1250 /** 1251 * Integer column containing the user's specified default reply behavior. This value will 1252 * be one of the values in {@link UIProvider.DefaultReplyBehavior} 1253 */ 1254 public static final String REPLY_BEHAVIOR = "reply_behavior"; 1255 1256 /** 1257 * Integer column containing the user's specified checkbox preference. A 1258 * non zero value means to hide checkboxes. 1259 */ 1260 public static final String HIDE_CHECKBOXES = "hide_checkboxes"; 1261 1262 /** 1263 * Integer column containing the user's specified confirm delete preference value. 1264 * A non zero value indicates that the user has indicated that a confirmation should 1265 * be shown when a delete action is performed. 1266 */ 1267 public static final String CONFIRM_DELETE = "confirm_delete"; 1268 1269 /** 1270 * Integer column containing the user's specified confirm archive preference value. 1271 * A non zero value indicates that the user has indicated that a confirmation should 1272 * be shown when an archive action is performed. 1273 */ 1274 public static final String CONFIRM_ARCHIVE = "confirm_archive"; 1275 1276 /** 1277 * Integer column containing the user's specified confirm send preference value. 1278 * A non zero value indicates that the user has indicated that a confirmation should 1279 * be shown when a send action is performed. 1280 */ 1281 public static final String CONFIRM_SEND = "confirm_send"; 1282 /** 1283 * String folder containing the serialized default inbox folder for an account. 1284 */ 1285 public static final String DEFAULT_INBOX = "default_inbox"; 1286 } 1287 1288 /** 1289 * Action for an intent used to update/create new notifications. The mime type of this 1290 * intent should be set to the mimeType of the account that is generating this notification. 1291 * An intent of this action is required to have the following extras: 1292 * {@link UpdateNotificationExtras#EXTRA_FOLDER} {@link UpdateNotificationExtras#EXTRA_ACCOUNT} 1293 */ 1294 public static final String ACTION_UPDATE_NOTIFICATION = 1295 "com.android.mail.action.update_notification"; 1296 1297 public static final class UpdateNotificationExtras { 1298 /** 1299 * Parcelable extra containing a {@link Uri} to a {@link Folder} 1300 */ 1301 public static final String EXTRA_FOLDER = "notification_extra_folder"; 1302 1303 /** 1304 * Parcelable extra containing a {@link Uri} to an {@link Account} 1305 */ 1306 public static final String EXTRA_ACCOUNT = "notification_extra_account"; 1307 1308 /** 1309 * Integer extra containing the update unread count for the account/folder. 1310 * If this value is 0, the UI will not block the intent to allow code to clear notifications 1311 * to run. 1312 */ 1313 public static final String EXTRA_UPDATED_UNREAD_COUNT = "notification_updated_unread_count"; 1314 } 1315} 1316