diff --git a/res/menu/message_list_context.xml b/res/menu/message_list_context.xml index 2ad012df4..7b21517b6 100644 --- a/res/menu/message_list_context.xml +++ b/res/menu/message_list_context.xml @@ -14,7 +14,13 @@ limitations under the License. --> + + + + + + diff --git a/res/menu/message_list_context_extra.xml b/res/menu/message_list_context_drafts.xml similarity index 67% rename from res/menu/message_list_context_extra.xml rename to res/menu/message_list_context_drafts.xml index 01e50de14..5f6b5f9b4 100644 --- a/res/menu/message_list_context_extra.xml +++ b/res/menu/message_list_context_drafts.xml @@ -14,10 +14,9 @@ limitations under the License. --> - + + - - - - + + diff --git a/res/menu/message_list_context_outbox.xml b/res/menu/message_list_context_outbox.xml new file mode 100644 index 000000000..e8707329f --- /dev/null +++ b/res/menu/message_list_context_outbox.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/res/menu/message_list_context_trash.xml b/res/menu/message_list_context_trash.xml new file mode 100644 index 000000000..9ed5419d9 --- /dev/null +++ b/res/menu/message_list_context_trash.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/res/menu/message_list_option.xml b/res/menu/message_list_option.xml index 35f46ecdd..2b64aedd5 100644 --- a/res/menu/message_list_option.xml +++ b/res/menu/message_list_option.xml @@ -14,6 +14,8 @@ limitations under the License. --> + + + + + + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index b0f5d4c04..7443fb2bb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -73,6 +73,8 @@ Remove account + Folders + Accounts Mark as read diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index 916c9919c..8f10c203a 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -349,7 +349,11 @@ public class MessageList extends ListActivity implements OnItemClickListener, On @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); - getMenuInflater().inflate(R.menu.message_list_option, menu); + if (mMailboxId < 0) { + getMenuInflater().inflate(R.menu.message_list_option_smart_folder, menu); + } else { + getMenuInflater().inflate(R.menu.message_list_option, menu); + } return true; } @@ -359,6 +363,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On case R.id.refresh: onRefresh(); return true; + case R.id.folders: + onFolders(); + return true; case R.id.accounts: onAccounts(); return true; @@ -389,21 +396,21 @@ public class MessageList extends ListActivity implements OnItemClickListener, On menu.setHeaderTitle(messageName); - // TODO: There is no context menu for the outbox // TODO: There is probably a special context menu for the trash - // TODO: Should not be reading from DB in UI thread - EmailContent.Mailbox mailbox = EmailContent.Mailbox.restoreMailboxWithId(this, - itemView.mMailboxId); + Mailbox mailbox = Mailbox.restoreMailboxWithId(this, itemView.mMailboxId); switch (mailbox.mType) { case EmailContent.Mailbox.TYPE_DRAFTS: - getMenuInflater().inflate(R.menu.message_list_context, menu); + getMenuInflater().inflate(R.menu.message_list_context_drafts, menu); break; case EmailContent.Mailbox.TYPE_OUTBOX: + getMenuInflater().inflate(R.menu.message_list_context_outbox, menu); + break; + case EmailContent.Mailbox.TYPE_TRASH: + getMenuInflater().inflate(R.menu.message_list_context_trash, menu); break; default: getMenuInflater().inflate(R.menu.message_list_context, menu); - getMenuInflater().inflate(R.menu.message_list_context_extra, menu); // The default menu contains "mark as read". If the message is read, change // the menu text to "mark as unread." if (itemView.mRead) { @@ -427,13 +434,13 @@ public class MessageList extends ListActivity implements OnItemClickListener, On onDelete(info.id, itemView.mAccountId); break; case R.id.reply: - //onReply(holder); + onReply(itemView.mMessageId); break; case R.id.reply_all: - //onReplyAll(holder); + onReplyAll(itemView.mMessageId); break; case R.id.forward: - //onForward(holder); + onForward(itemView.mMessageId); break; case R.id.mark_as_read: onSetMessageRead(info.id, !itemView.mRead); @@ -451,6 +458,15 @@ public class MessageList extends ListActivity implements OnItemClickListener, On } } + private void onFolders() { + if (mMailboxId >= 0) { + // TODO smaller projection + Mailbox mailbox = Mailbox.restoreMailboxWithId(this, mMailboxId); + MailboxList.actionHandleAccount(this, mailbox.mAccountKey); + finish(); + } + } + private void onAccounts() { AccountFolderList.actionShowAccounts(this); finish(); @@ -486,6 +502,18 @@ public class MessageList extends ListActivity implements OnItemClickListener, On } } + private void onReply(long messageId) { + MessageCompose.actionReply(this, messageId, false); + } + + private void onReplyAll(long messageId) { + MessageCompose.actionReply(this, messageId, true); + } + + private void onForward(long messageId) { + MessageCompose.actionForward(this, messageId); + } + private void onLoadMoreMessages() { if (mMailboxId >= 0) { mController.loadMoreMessages(mMailboxId, mControllerCallback);