|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.provider.Gmail
public final class Gmail
A thin wrapper over the content resolver for accessing the gmail provider.
| Nested Class Summary | |
|---|---|
static class |
Gmail.Attachment
|
static class |
Gmail.AttachmentColumns
The columns that can be requested when querying an attachment's download URI. |
static class |
Gmail.AttachmentOrigin
We track where an attachment came from so that we know how to download it and include it in new messages. |
static class |
Gmail.AttachmentRendition
Indicates a version of an attachment. |
static class |
Gmail.ConversationColumns
|
static class |
Gmail.ConversationCursor
A cursor over conversations. |
static class |
Gmail.CursorStatus
|
static class |
Gmail.LabelColumns
|
class |
Gmail.LabelCursor
A cursor over labels. |
static class |
Gmail.LabelMap
This is a map of labels. |
static class |
Gmail.MailCursor
This is a cursor that only defines methods to move throught the results and register to hear about changes. |
static interface |
Gmail.MailCursorObserver
A MailCursor observer is notified of changes to the result set of a cursor. |
static class |
Gmail.MessageColumns
|
static class |
Gmail.MessageCursor
A cursor over messages. |
static class |
Gmail.MessageModification
A helper class for creating or updating messags. |
static class |
Gmail.NonexistentLabelException
Thrown when an operation is requested with a label that does not exist. |
static class |
Gmail.PersonalLevel
|
static class |
Gmail.Settings
Settings for which conversations should be synced to the phone. |
static class |
Gmail.SettingsColumns
|
| Constructor Summary | |
|---|---|
Gmail(ContentResolver contentResolver)
|
|
| Method Summary | |
|---|---|
void |
addOrRemoveLabelOnConversation(String account,
long conversationId,
long maxMessageId,
String label,
boolean add)
Adds or removes the label on the conversation. |
static void |
addOrRemoveLabelOnMessage(ContentResolver contentResolver,
String account,
long conversationId,
long messageId,
String label,
boolean add)
Adds or removes the label on the message. |
void |
expungeMessage(String account,
long messageId)
Expunge the indicated message. |
static Uri |
getAttachmentDownloadUri(Uri attachmentUri)
Return the URI to query in order to find out whether an attachment is downloaded. |
static Uri |
getAttachmentUri(String account,
long messageId,
Gmail.Attachment attachment,
Gmail.AttachmentRendition rendition,
boolean saveToSd)
Any given attachment can come in two different renditions (see Gmail.AttachmentRendition) and can be saved to the sd card or to a
cache. |
static Set<String> |
getCanonicalNamesFromLabelIdsString(Gmail.LabelMap labelMap,
TextUtils.StringSplitter splitter)
Deprecated. remove when the activities stop using canonical names to identify labels |
Gmail.ConversationCursor |
getConversationCursorForCursor(String account,
Cursor cursor)
Wraps a Cursor in a ConversationCursor |
Gmail.ConversationCursor |
getConversationCursorForQuery(String account,
String query)
Synchronously gets a cursor over all conversations matching a query. |
static String |
getEmailFromAddressString(String addressString)
Returns the email address in an address string |
static Set<Long> |
getLabelIdsFromLabelIdsString(TextUtils.StringSplitter splitter)
Returns the set of labels using the raw labels from a previous getRawLabels() as input. |
static String |
getLabelIdsStringFromLabelIds(Set<Long> labelIds)
Creates a single string of the form that getLabelIdsFromLabelIdsString can split. |
Gmail.LabelMap |
getLabelMap(String account)
|
Gmail.MessageCursor |
getLocalMessageCursorForQuery(String account,
String query)
Gets a message cursor over the messages that match the query. |
Gmail.MessageCursor |
getMessageCursorForConversationId(String account,
long conversationId)
Gets a cursor over all of the messages in a conversation. |
Gmail.MessageCursor |
getMessageCursorForMessageId(String account,
long messageId)
Gets a message cursor over the single message with the given id. |
static String |
getNameFromAddressString(String addressString)
Returns the name in an address string |
static void |
getSenderSnippet(String instructions,
SpannableStringBuilder sb,
int maxChars,
CharacterStyle unreadStyle,
CharacterStyle draftsStyle,
CharSequence meString,
CharSequence draftString,
CharSequence draftPluralString,
CharSequence sendingString,
CharSequence sendFailedString,
boolean forceAllUnread,
boolean forceAllRead)
Uses sender instructions to build a formatted string. |
Gmail.Settings |
getSettings(String account)
Returns the settings. |
static boolean |
isLabelUserDefined(String label)
Returns whether the label is user-defined (versus system-defined labels such as inbox, whose names start with "^"). |
static boolean |
isLabelUserSettable(String label)
Returns whether the label is user-settable. |
static TextUtils.StringSplitter |
newConversationLabelIdsSplitter()
|
static TextUtils.StringSplitter |
newMessageLabelIdsSplitter()
|
void |
runQueryForConversations(String account,
AsyncQueryHandler handler,
int token,
String query)
Asynchronously gets a cursor over all conversations matching a query. |
void |
setSettings(String account,
Gmail.Settings settings)
Sets the settings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String GMAIL_AUTH_SERVICE
public static final String LABEL_SENT
public static final String LABEL_INBOX
public static final String LABEL_DRAFT
public static final String LABEL_UNREAD
public static final String LABEL_TRASH
public static final String LABEL_SPAM
public static final String LABEL_STARRED
public static final String LABEL_CHAT
public static final String LABEL_VOICEMAIL
public static final String LABEL_ALL
public static final String LABEL_VOICEMAIL_INBOX
public static final String LABEL_CACHED
public static final String LABEL_OUTBOX
public static final String AUTHORITY
public static final Uri BASE_URI
public static final String EMAIL_SEPARATOR
public static final Pattern EMAIL_SEPARATOR_PATTERN
public static final Pattern SPACE_SEPARATOR_PATTERN
public static final Pattern COMMA_SEPARATOR_PATTERN
public static final String ATTACHMENT_INFO_SEPARATOR
public static final Pattern ATTACHMENT_INFO_SEPARATOR_PATTERN
public static final Character SENDER_LIST_SEPARATOR
public static final String SENDER_LIST_TOKEN_ELIDED
public static final String SENDER_LIST_TOKEN_NUM_MESSAGES
public static final String SENDER_LIST_TOKEN_NUM_DRAFTS
public static final String SENDER_LIST_TOKEN_LITERAL
public static final String SENDER_LIST_TOKEN_SENDING
public static final String SENDER_LIST_TOKEN_SEND_FAILED
public static final String EXTRA_STATUS
public static final String RESPOND_INPUT_COMMAND
public static final String COMMAND_RETRY
public static final String COMMAND_ACTIVATE
public static final String RESPOND_OUTPUT_COMMAND_RESPONSE
public static final String COMMAND_RESPONSE_OK
public static final String COMMAND_RESPONSE_UNKNOWN
public static final String INSERT_PARAM_ATTACHMENT_ORIGIN
public static final String INSERT_PARAM_ATTACHMENT_ORIGIN_EXTRAS
public static final TextUtils.SimpleStringSplitter sSenderListSplitter
public static String[] sSenderFragments
public static final String PROVIDER_CHANGED_EXTRA_ACCOUNT
public static final String PROVIDER_CHANGED_EXTRA_COUNT
public static final String PROVIDER_CHANGED_EXTRA_GET_ATTENTION
public static final String PROVIDER_CHANGED_EXTRA_TAG_LABEL
| Constructor Detail |
|---|
public Gmail(ContentResolver contentResolver)
| Method Detail |
|---|
public static String getNameFromAddressString(String addressString)
addressString - such as "bobby" <bob@example.com>
public static String getEmailFromAddressString(String addressString)
addressString - such as "bobby" <bob@example.com>
public static boolean isLabelUserDefined(String label)
public static boolean isLabelUserSettable(String label)
public static Set<Long> getLabelIdsFromLabelIdsString(TextUtils.StringSplitter splitter)
public static Set<String> getCanonicalNamesFromLabelIdsString(Gmail.LabelMap labelMap,
TextUtils.StringSplitter splitter)
public static TextUtils.StringSplitter newMessageLabelIdsSplitter()
public static TextUtils.StringSplitter newConversationLabelIdsSplitter()
public static String getLabelIdsStringFromLabelIds(Set<Long> labelIds)
public Gmail.ConversationCursor getConversationCursorForCursor(String account,
Cursor cursor)
account - the account the cursor is associated withcursor - The Cursor to wrap
public void runQueryForConversations(String account,
AsyncQueryHandler handler,
int token,
String query)
account - run the query on this accounthandler - An AsyncQueryHanlder that will be used to run the querytoken - The token to pass to startQuery, which will be passed back to onQueryCompletequery - a query in Gmail's query syntax
public Gmail.ConversationCursor getConversationCursorForQuery(String account,
String query)
account - run the query on this accountquery - a query in Gmail's query syntax
public Gmail.MessageCursor getMessageCursorForMessageId(String account,
long messageId)
account - get the cursor for messages in this accountmessageId - the id of the message
public Gmail.MessageCursor getLocalMessageCursorForQuery(String account,
String query)
account - get the cursor for messages in this accountquery - a query in GMail's query syntax. Currently only queries of
the form [label:
public Gmail.MessageCursor getMessageCursorForConversationId(String account,
long conversationId)
account - get the cursor for messages in this accountconversationId - the id of the converstion to fetch messages for
public void expungeMessage(String account,
long messageId)
account - the account of the message idmessageId - the id of the message to expunge
public void addOrRemoveLabelOnConversation(String account,
long conversationId,
long maxMessageId,
String label,
boolean add)
throws Gmail.NonexistentLabelException
account - the account of the conversationconversationId - the conversationmaxMessageId - the highest message id to whose labels should be changedlabel - the label to add or removeadd - true to add the label, false to remove it
Gmail.NonexistentLabelException - thrown if the label does not exist
public static void addOrRemoveLabelOnMessage(ContentResolver contentResolver,
String account,
long conversationId,
long messageId,
String label,
boolean add)
contentResolver - the content resolver.account - the account of the messageconversationId - the conversation containing the messagemessageId - the id of the message to whose labels should be changedlabel - the label to add or removeadd - true to add the label, false to remove it
Gmail.NonexistentLabelException - thrown if the label does not existpublic Gmail.Settings getSettings(String account)
account - the account whose setting should be retrieved
public void setSettings(String account,
Gmail.Settings settings)
public static void getSenderSnippet(String instructions,
SpannableStringBuilder sb,
int maxChars,
CharacterStyle unreadStyle,
CharacterStyle draftsStyle,
CharSequence meString,
CharSequence draftString,
CharSequence draftPluralString,
CharSequence sendingString,
CharSequence sendFailedString,
boolean forceAllUnread,
boolean forceAllRead)
Sender list instructions contain compact information about the sender list. Most work that can be done without knowing how much room will be availble for the sender list is done when creating the instructions.
The instructions string consists of tokens separated by SENDER_LIST_SEPARATOR. Here are the tokens, one per line:
The instructions indicate how many messages and drafts are in the conversation and then describe the most important messages in order, indicating the priority of each message and whether the message is unread.
instructions - instructions as described abovesb - the SpannableStringBuilder to append tomaxChars - the number of characters available to display the textunreadStyle - the CharacterStyle for unread messages, or nulldraftsStyle - the CharacterStyle for draft messages, or nullsendingString - the string to use when there are messages scheduled to be sentsendFailedString - the string to use when there are messages that mailed to sendmeString - the string to use for messages sent by this userdraftString - the string to use for "Draft"draftPluralString - the string to use for "Drafts"public Gmail.LabelMap getLabelMap(String account)
public static Uri getAttachmentUri(String account,
long messageId,
Gmail.Attachment attachment,
Gmail.AttachmentRendition rendition,
boolean saveToSd)
Gmail.AttachmentRendition) and can be saved to the sd card or to a
cache. The gmail provider automatically syncs some attachments to the cache. Other
attachments can be downloaded on demand. Attachments in the cache will be purged as needed to
save space. Attachments on the SD card must be managed by the user or other software.
account - which account to usemessageId - the id of the mesage with the attachmentattachment - the attachmentrendition - the desired renditionsaveToSd - whether the attachment should be saved to (or loaded from) the sd card or
public static Uri getAttachmentDownloadUri(Uri attachmentUri)
Querying this will also start a download if necessary. The cursor returned by querying
this URI can contain the columns in Gmail.AttachmentColumns.
Deleting this URI will cancel the download if it was not started automatically by the provider. It will also remove bookkeeping for saveToSd downloads.
attachmentUri - the attachment URI as returned by getAttachmentUri. The URI's authority
Gmail.AUTHORITY. If it is not then you should open the file directly.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||