diff --git a/res/drawable-hdpi/ic_menu_email_deselect_mail.png b/res/drawable-hdpi/ic_menu_email_deselect_mail.png new file mode 100755 index 000000000..0858538a8 Binary files /dev/null and b/res/drawable-hdpi/ic_menu_email_deselect_mail.png differ diff --git a/res/drawable-mdpi/ic_menu_email_deselect_mail.png b/res/drawable-mdpi/ic_menu_email_deselect_mail.png new file mode 100755 index 000000000..78bac88bc Binary files /dev/null and b/res/drawable-mdpi/ic_menu_email_deselect_mail.png differ diff --git a/res/menu/message_list_option.xml b/res/menu/message_list_option.xml index aec8f2d8c..dd9de911f 100644 --- a/res/menu/message_list_option.xml +++ b/res/menu/message_list_option.xml @@ -27,6 +27,12 @@ android:title="@string/compose_action" android:icon="@*android:drawable/ic_menu_compose" /> + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 43bf198af..bf09f7c0c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -99,6 +99,8 @@ Add account + Deselect all + Compose Search diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index 9337b1457..25d9c8b1d 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -412,6 +412,13 @@ public class MessageList extends ListActivity implements OnItemClickListener, On return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + boolean showDeselect = mListAdapter.getSelectedSet().size() > 0; + menu.setGroupVisible(R.id.deselect_all_group, showDeselect); + return true; + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { @@ -430,6 +437,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On case R.id.account_settings: onEditAccount(); return true; + case R.id.deselect_all: + onDeselectAll(); + return true; default: return super.onOptionsItemSelected(item); } @@ -545,6 +555,12 @@ public class MessageList extends ListActivity implements OnItemClickListener, On AccountSettings.actionSettings(this, lookupAccountIdFromMailboxId(mMailboxId)); } + private void onDeselectAll() { + mListAdapter.getSelectedSet().clear(); + mListView.invalidateViews(); + showMultiPanel(false); + } + private void onOpenMessage(long messageId, long mailboxId) { // TODO: Should not be reading from DB in UI thread EmailContent.Mailbox mailbox = EmailContent.Mailbox.restoreMailboxWithId(this, mailboxId);