From b8ee27f013766d6c89befa36bd265c6104ffb036 Mon Sep 17 00:00:00 2001 From: Andrew Stadler Date: Wed, 30 Sep 2009 10:07:25 -0700 Subject: [PATCH] Add "deselect all" * New menu items in MessageList * Show/hide menu item if anything is checked * Clear the selected items map, redraw listview, hide button panel Bug # 2116257 --- .../ic_menu_email_deselect_mail.png | Bin 0 -> 2976 bytes .../ic_menu_email_deselect_mail.png | Bin 0 -> 5346 bytes res/menu/message_list_option.xml | 6 ++++++ res/menu/message_list_option_smart_folder.xml | 6 ++++++ res/values/strings.xml | 2 ++ src/com/android/email/activity/MessageList.java | 16 ++++++++++++++++ 6 files changed, 30 insertions(+) create mode 100755 res/drawable-hdpi/ic_menu_email_deselect_mail.png create mode 100755 res/drawable-mdpi/ic_menu_email_deselect_mail.png 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 0000000000000000000000000000000000000000..0858538a8b5aadb028cc840f30f8acf6c75cffde GIT binary patch literal 2976 zcmV;R3t#k!P)HSr&ejln5eZm1qdIO%&9jrQM>&*we;nIuL{7560MP%;-#OVo)=ZK_r?n zZUb?{4!D3KxFDcdEc1PpcgVGZ9jYjbVyv6oP~LanyXSoO?Dsw0nwpw4SNnW3xFB!= z0DYm&-G+PI^lngoJ9BH&d!zEZT>ug=y6E@0>%R?743YrTfL^cn z25W$_79h^|P<+US4?#2?=}0jT={@s9Qs80CH<(HcxOo(S6YS zu3o+RFYn*Kj~qB~poYaYgTXm9tg*3C!zOBFWo4R&heu9kX66PAzeInF{$2;lt}14> zIRIr^-@bjd9zA++hs@n6Ei^VCz-UIJQLC=5p7Px^>n0cC)t)GKkFqFh*Zr zU-QD09%lxKQq;9;SJG%GEiLsLK79BaYdo*DUd*gZTu^q#S=CEbGtx+U^^LSDezPS| z)Vg%(qPe@fo4d10PjjjOa41QnS*O)1f^7mwwL2YEvZeHTdU~2WnXjv>)8IJF-I6BK zYOADo+FXnb!{DBr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NC>68lBwSe{| zX;hJEq|^_qHhp%=zuNCmk9pW2ylkE1g`WcTqg;HFl6o|O0rBN6TZzO&66MP;_v8fM zGkqcBv)>37{pJa#Lu}PSt31&a2K!ECI9hMR1(24dQHVP61f>;3yhG}vHvY?|x|qo) zHzJ^s^l+_VzFc-?VD+_QcO11}o$b?ZD~)UVsm8#{D%MKgYwM-lB4>(ulorlQCkHgC zY)ya}mZYny<5#$s*49qyl(xr<3V0oB6CIWN&gUi?TbZKV-<4}7#moMwo-_IS@mZ#6 z=Ay=zHL+7MuPVGwH_`T-yq+<5v?OUy%*J&S6NKb8w8rtQgoFg2*R;?R?3*heO*oB5 z<-HxOYFRz_s{Hyuf2}oY{|4LRk_ziHeaiVY8&n&P2Rfz + + + + + + 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);