public class

MessageUtils

extends Object
java.lang.Object
   ↳ com.android.mms.ui.MessageUtils

Class Overview

An utility class for managing messages.

Summary

Constants
int IMAGE_COMPRESSION_QUALITY The quality parameter which is used to compress JPEG images.
int MESSAGE_OVERHEAD Message overhead that reduces the maximum image byte size.
int MINIMUM_IMAGE_COMPRESSION_QUALITY The minimum quality parameter which is used to compress JPEG images.
Public Methods
static String extractEncStrFromCursor(Cursor cursor, int columnRawBytes, int columnCharset)
static ArrayList<String> extractUris(URLSpan[] spans)
static String formatTimeStampString(Context context, long when, boolean fullFormat)
static String formatTimeStampString(Context context, long when)
static int getAttachmentType(SlideshowModel model)
static String getLocalNumber()
static String getMessageDetails(Context context, Cursor cursor, int size)
static String getRecipientsByIds(Context context, String recipientIds, boolean allowQuery)
static void handleReadReport(Context context, long threadId, int status, Runnable callback)
static boolean isAlias(String string)
static boolean isAlphaNumeric(String s)
static boolean isLocalNumber(String number)
static boolean isValidMmsAddress(String address)
Returns true if the address passed in is a valid MMS address.
static String parseMmsAddress(String address)
parse the input address to be a valid MMS address.
static void recordSound(Context context, int requestCode)
static void resizeImageAsync(Context context, Uri imageUri, Handler handler, MessageUtils.ResizeImageResultCallback cb, boolean append)
static Uri saveBitmapAsPart(Context context, Uri messageUri, Bitmap bitmap)
static void selectAudio(Context context, int requestCode)
static void selectImage(Context context, int requestCode)
static void selectVideo(Context context, int requestCode)
static void showDiscardDraftConfirmDialog(Context context, DialogInterface.OnClickListener listener)
static void showErrorDialog(Context context, String title, String message)
static void viewMmsMessageAttachment(Context context, WorkingMessage msg)
static void viewMmsMessageAttachment(Context context, Uri msgUri, SlideshowModel slideshow)
Play/view the message attachments.
static void viewSimpleSlideshow(Context context, SlideshowModel slideshow)
static void writeHprofDataToFile()
Debugging
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int IMAGE_COMPRESSION_QUALITY

The quality parameter which is used to compress JPEG images.

Constant Value: 80 (0x00000050)

public static final int MESSAGE_OVERHEAD

Message overhead that reduces the maximum image byte size. 5000 is a realistic overhead number that allows for user to also include a small MIDI file or a couple pages of text along with the picture.

Constant Value: 5000 (0x00001388)

public static final int MINIMUM_IMAGE_COMPRESSION_QUALITY

The minimum quality parameter which is used to compress JPEG images.

Constant Value: 50 (0x00000032)

Public Methods

public static String extractEncStrFromCursor (Cursor cursor, int columnRawBytes, int columnCharset)

public static ArrayList<String> extractUris (URLSpan[] spans)

public static String formatTimeStampString (Context context, long when, boolean fullFormat)

public static String formatTimeStampString (Context context, long when)

public static int getAttachmentType (SlideshowModel model)

public static String getLocalNumber ()

public static String getMessageDetails (Context context, Cursor cursor, int size)

public static String getRecipientsByIds (Context context, String recipientIds, boolean allowQuery)

public static void handleReadReport (Context context, long threadId, int status, Runnable callback)

public static boolean isAlias (String string)

public static boolean isAlphaNumeric (String s)

public static boolean isLocalNumber (String number)

public static boolean isValidMmsAddress (String address)

Returns true if the address passed in is a valid MMS address.

public static String parseMmsAddress (String address)

parse the input address to be a valid MMS address. - if the address is an email address, leave it as is. - if the address can be parsed into a valid MMS phone number, return the parsed number. - if the address is a compliant alias address, leave it as is.

public static void recordSound (Context context, int requestCode)

public static void resizeImageAsync (Context context, Uri imageUri, Handler handler, MessageUtils.ResizeImageResultCallback cb, boolean append)

public static Uri saveBitmapAsPart (Context context, Uri messageUri, Bitmap bitmap)

Throws
MmsException

public static void selectAudio (Context context, int requestCode)

public static void selectImage (Context context, int requestCode)

public static void selectVideo (Context context, int requestCode)

public static void showDiscardDraftConfirmDialog (Context context, DialogInterface.OnClickListener listener)

public static void showErrorDialog (Context context, String title, String message)

public static void viewMmsMessageAttachment (Context context, WorkingMessage msg)

public static void viewMmsMessageAttachment (Context context, Uri msgUri, SlideshowModel slideshow)

Play/view the message attachments. TOOD: We need to save the draft before launching another activity to view the attachments. This is hacky though since we will do saveDraft twice and slow down the UI. We should pass the slideshow in intent extra to the view activity instead of asking it to read attachments from database.

Parameters
msgUri the MMS message URI in database
slideshow the slideshow to save

public static void viewSimpleSlideshow (Context context, SlideshowModel slideshow)

public static void writeHprofDataToFile ()

Debugging