public class

WorkingMessage

extends Object
java.lang.Object
   ↳ com.android.mms.data.WorkingMessage

Class Overview

Contains all state related to a message being edited by the user.

Summary

Nested Classes
interface WorkingMessage.MessageStatusListener Callback interface for communicating important state changes back to ComposeMessageActivity. 
Constants
String ACTION_SENDING_SMS
int AUDIO
String EXTRA_SMS_MESSAGE
String EXTRA_SMS_RECIPIENTS
String EXTRA_SMS_THREAD_ID
int IMAGE
int IMAGE_TOO_LARGE
int MESSAGE_SIZE_EXCEEDED
int OK
int SLIDESHOW
int TEXT
int UNKNOWN_ERROR
int UNSUPPORTED_TYPE
int VIDEO
Public Methods
static WorkingMessage createEmpty(ComposeMessageActivity activity)
Creates a new working message.
synchronized void discard()
void dump()
SlideshowModel getSlideshow()
Returns the slideshow associated with this message.
CharSequence getSubject()
Returns the MMS subject of the message.
CharSequence getText()
Returns the current message text.
String getWorkingRecipients()
boolean hasAttachment()
Returns true if the message has an attachment (including slideshows).
boolean hasSlideshow()
Returns true if the message has a real slideshow, as opposed to just one image attachment, for example.
boolean hasSubject()
Returns true if this message has an MMS subject.
boolean hasText()
Returns true if the message has any text.
boolean isDiscarded()
Returns true if discard() has been called on this message.
boolean isFakeMmsForDraft()
Returns true if FORCE_MMS is set.
boolean isWorthSaving()
Returns true if this message contains anything worth saving.
static WorkingMessage load(ComposeMessageActivity activity, Uri uri)
Create a new WorkingMessage from the specified data URI, which typically contains an MMS message.
static WorkingMessage loadDraft(ComposeMessageActivity activity, Conversation conv)
Load the draft message for the specified conversation, or a new empty message if none exists.
void readStateFromBundle(Bundle bundle)
To be called from our Activity's onCreate() if the activity manager has given it a Bundle to reinflate
void removeFakeMmsForDraft()
boolean requiresMms()
Returns true if this message would require MMS to send.
Uri saveAsMms(boolean notify)
Force the message to be saved as MMS and return the Uri of the message.
void saveDraft()
Save this message as a draft in the conversation previously specified to setConversation.
void send(String recipientsInUI)
Send this message over the network.
int setAttachment(int type, Uri dataUri, boolean append)
Adds an attachment to the message, replacing an old one if it existed.
void setConversation(Conversation conv)
Set the conversation associated with this message.
void setHasEmail(boolean hasEmail, boolean notify)
Hint whether or not this message will be delivered to an an email address.
void setLengthRequiresMms(boolean mmsRequired, boolean notify)
Set whether or not we want to send this message via MMS in order to avoid sending an excessive number of concatenated SMS messages.
void setSubject(CharSequence s, boolean notify)
Sets the MMS subject of the message.
void setText(CharSequence s)
Sets the text of the message to the specified CharSequence.
void setWorkingRecipients(List<String> numbers)
Update the temporary list of recipients, used when setting up a new conversation.
void syncWorkingRecipients()
Resolve the temporary working set of recipients to a ContactList.
void unDiscard()
void writeStateToBundle(Bundle bundle)
To be called from our Activity's onSaveInstanceState() to give us a chance to stow our state away for later retrieval.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_SENDING_SMS

Constant Value: "android.intent.action.SENDING_SMS"

public static final int AUDIO

Constant Value: 3 (0x00000003)

public static final String EXTRA_SMS_MESSAGE

Constant Value: "android.mms.extra.MESSAGE"

public static final String EXTRA_SMS_RECIPIENTS

Constant Value: "android.mms.extra.RECIPIENTS"

public static final String EXTRA_SMS_THREAD_ID

Constant Value: "android.mms.extra.THREAD_ID"

public static final int IMAGE

Constant Value: 1 (0x00000001)

public static final int IMAGE_TOO_LARGE

Constant Value: -4 (0xfffffffc)

public static final int MESSAGE_SIZE_EXCEEDED

Constant Value: -2 (0xfffffffe)

public static final int OK

Constant Value: 0 (0x00000000)

public static final int SLIDESHOW

Constant Value: 4 (0x00000004)

public static final int TEXT

Constant Value: 0 (0x00000000)

public static final int UNKNOWN_ERROR

Constant Value: -1 (0xffffffff)

public static final int UNSUPPORTED_TYPE

Constant Value: -3 (0xfffffffd)

public static final int VIDEO

Constant Value: 2 (0x00000002)

Public Methods

public static WorkingMessage createEmpty (ComposeMessageActivity activity)

Creates a new working message.

public synchronized void discard ()

public void dump ()

public SlideshowModel getSlideshow ()

Returns the slideshow associated with this message.

public CharSequence getSubject ()

Returns the MMS subject of the message.

public CharSequence getText ()

Returns the current message text.

public String getWorkingRecipients ()

public boolean hasAttachment ()

Returns true if the message has an attachment (including slideshows).

public boolean hasSlideshow ()

Returns true if the message has a real slideshow, as opposed to just one image attachment, for example.

public boolean hasSubject ()

Returns true if this message has an MMS subject. A subject has to be more than just whitespace.

public boolean hasText ()

Returns true if the message has any text. A message with just whitespace is not considered to have text.

public boolean isDiscarded ()

Returns true if discard() has been called on this message.

public boolean isFakeMmsForDraft ()

Returns true if FORCE_MMS is set. When saveAsMms() has been called, we set FORCE_MMS to represent sort of an "invisible attachment" so that the message isn't thrown away when we are shipping it off to other activities.

public boolean isWorthSaving ()

Returns true if this message contains anything worth saving.

public static WorkingMessage load (ComposeMessageActivity activity, Uri uri)

Create a new WorkingMessage from the specified data URI, which typically contains an MMS message.

public static WorkingMessage loadDraft (ComposeMessageActivity activity, Conversation conv)

Load the draft message for the specified conversation, or a new empty message if none exists.

public void readStateFromBundle (Bundle bundle)

To be called from our Activity's onCreate() if the activity manager has given it a Bundle to reinflate

Parameters
bundle The Bundle passed in to onCreate

public void removeFakeMmsForDraft ()

public boolean requiresMms ()

Returns true if this message would require MMS to send.

public Uri saveAsMms (boolean notify)

Force the message to be saved as MMS and return the Uri of the message. Typically used when handing a message off to another activity.

public void saveDraft ()

Save this message as a draft in the conversation previously specified to setConversation.

public void send (String recipientsInUI)

Send this message over the network. Will call back with onMessageSent() once it has been dispatched to the telephony stack. This WorkingMessage object is no longer useful after this method has been called.

public int setAttachment (int type, Uri dataUri, boolean append)

Adds an attachment to the message, replacing an old one if it existed.

Parameters
type Type of this attachment, such as IMAGE
dataUri Uri containing the attachment data (or null for TEXT)
append true if we should add the attachment to a new slide
Returns
  • An error code such as UNKNOWN_ERROR or OK if successful

public void setConversation (Conversation conv)

Set the conversation associated with this message.

public void setHasEmail (boolean hasEmail, boolean notify)

Hint whether or not this message will be delivered to an an email address.

public void setLengthRequiresMms (boolean mmsRequired, boolean notify)

Set whether or not we want to send this message via MMS in order to avoid sending an excessive number of concatenated SMS messages.

public void setSubject (CharSequence s, boolean notify)

Sets the MMS subject of the message. Passing null indicates that there is no subject. Passing "" will result in an empty subject being added to the message, possibly triggering a conversion to MMS. This extra bit of state is needed to support ComposeMessageActivity converting to MMS when the user adds a subject. An empty subject will be removed before saving to disk or sending, however.

public void setText (CharSequence s)

Sets the text of the message to the specified CharSequence.

public void setWorkingRecipients (List<String> numbers)

Update the temporary list of recipients, used when setting up a new conversation. Will be converted to a ContactList on any save event (send, save draft, etc.)

public void syncWorkingRecipients ()

Resolve the temporary working set of recipients to a ContactList.

public void unDiscard ()

public void writeStateToBundle (Bundle bundle)

To be called from our Activity's onSaveInstanceState() to give us a chance to stow our state away for later retrieval.

Parameters
bundle The Bundle passed in to onSaveInstanceState