/** M: Create a message for test purposes */ public static Message setupMessage( String name, long accountId, long mailboxId, String msgInfo, boolean addBody, boolean saveIt, Context context, boolean starred, boolean read) { Message message = new Message(); message.mDisplayName = name; message.mMailboxKey = mailboxId; message.mAccountKey = accountId; message.mFlagRead = read; message.mFlagLoaded = Message.FLAG_LOADED_UNLOADED; message.mFlagFavorite = starred; message.mServerId = "serverid " + name; message.mMeetingInfo = msgInfo; message.mFlags |= Message.FLAG_TYPE_REPLY; if (addBody) { message.mText = "body text " + name; message.mHtml = "body html " + name; } if (saveIt) { message.save(context); } return message; }
/** Set message read/unread. */ public void onMarkMessageAsRead(boolean isRead) { if (!isMessageOpen()) return; Message message = getMessage(); if (message.mFlagRead != isRead) { message.mFlagRead = isRead; getController().setMessageRead(message.mId, isRead); if (!isRead) { // Became unread. We need to close the message. mCallback.onMessageSetUnread(); } } }