Add forward, reply, reply all, same sender back in the MessageList context actionbar.

This commit is contained in:
Sander Bogaert 2012-08-21 10:42:45 -04:00 committed by Andrew Chen
parent 10c733606e
commit 592aeb0b03
7 changed files with 85 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1,5 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/single_message_options"
android:icon="@drawable/ic_action_single_message_options"
android:showAsAction="always"
android:title="@string/single_message_options_action">
<menu>
<item
android:id="@+id/forward"
android:title="@string/forward_action"/>
<item
android:id="@+id/reply_all"
android:title="@string/reply_all_action"/>
<item
android:id="@+id/reply"
android:title="@string/reply_action"/>
<item
android:id="@+id/send_again"
android:title="@string/send_again_action"/>
<item
android:id="@+id/same_sender"
android:title="@string/from_same_sender" />
</menu>
</item>
<item
android:id="@+id/delete"
android:title="@string/delete_action"

View file

@ -118,6 +118,7 @@ http://k9mail.googlecode.com/
<string name="forward_action">Forward</string>
<string name="move_action">Move</string>
<string name="move_or_copy_action">Move or Copy</string>
<string name="single_message_options_action">Message Options</string>
<string name="continue_action">Continue</string>
<string name="back_action">Back</string>
<string name="done_action">Done</string> <!-- Used to complete a multi-step process -->

View file

@ -1156,6 +1156,22 @@ public class MessageList extends K9ListActivity implements
}
}
private void onReply(MessageInfoHolder holder) {
MessageCompose.actionReply(this, holder.message.getFolder().getAccount(), holder.message, false, null);
}
private void onReplyAll(MessageInfoHolder holder) {
MessageCompose.actionReply(this, holder.message.getFolder().getAccount(), holder.message, true, null);
}
private void onForward(MessageInfoHolder holder) {
MessageCompose.actionForward(this, holder.message.getFolder().getAccount(), holder.message, null);
}
private void onResendMessage(MessageInfoHolder message) {
MessageCompose.actionEditDraft(this, message.message.getFolder().getAccount(), message.message);
}
private void onEditPrefs() {
Prefs.actionPrefs(this);
}
@ -2408,11 +2424,9 @@ public class MessageList extends K9ListActivity implements
mAdapter.notifyDataSetChanged();
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
if (mQueryString != null) {
// we might have to disable some options
// make sure the onPrepareActionMode is called
mActionMode.invalidate();
}
}
/**
* @param holders
@ -2757,6 +2771,11 @@ public class MessageList extends K9ListActivity implements
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
// enable or disable forward, reply,....
menu.findItem(R.id.single_message_options)
.setVisible(mSelectedCount > 1 ? false : true);
if (mQueryString != null) {
// show all
menu.findItem(R.id.move).setVisible(true);
@ -2801,6 +2820,14 @@ public class MessageList extends K9ListActivity implements
return true;
}
/**
* Disables menu options based on if the account supports it or not.
* It also checks the controller and for now the 'mode' the messagelist
* is operation in ( query or not ).
*
* @param mAccount Account to check capabilities of.
* @param menu Menu to adapt.
*/
private void setContextCapabilities(Account mAccount, Menu menu) {
/*
* TODO get rid of this when we finally split the messagelist into
@ -2867,6 +2894,8 @@ public class MessageList extends K9ListActivity implements
onToggleFlag(selection);
break;
}
// only if the account supports this
case R.id.archive: {
onArchive(selection);
mSelectedCount = 0;
@ -2887,6 +2916,34 @@ public class MessageList extends K9ListActivity implements
mSelectedCount = 0;
break;
}
// only if a single message is selected
case R.id.reply: {
onReply(selection.get(0));
mSelectedCount = 0;
break;
}
case R.id.reply_all: {
onReplyAll(selection.get(0));
mSelectedCount = 0;
break;
}
case R.id.forward: {
onForward(selection.get(0));
mSelectedCount = 0;
break;
}
case R.id.send_again: {
onResendMessage(selection.get(0));
mSelectedCount = 0;
break;
}
case R.id.same_sender: {
MessageList.actionHandle(MessageList.this, "From " + selection.get(0).sender,
selection.get(0).senderAddress, false, null, null);
mSelectedCount = 0;
break;
}
}
if (mSelectedCount == 0) {