am 7d6d99e7: am 0b50eea4: Merge change Ib8ee27f0 into eclair

Merge commit '7d6d99e7b0bf2c446512249a70210b99c013113d'

* commit '7d6d99e7b0bf2c446512249a70210b99c013113d':
  Add "deselect all"
This commit is contained in:
Andrew Stadler 2009-10-01 12:11:04 -07:00 committed by Android Git Automerger
commit a8f3346285
6 changed files with 30 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -27,6 +27,12 @@
android:title="@string/compose_action"
android:icon="@*android:drawable/ic_menu_compose"
/>
<group android:id="@+id/deselect_all_group">
<item android:id="@+id/deselect_all"
android:title="@string/deselect_all_action"
android:icon="@drawable/ic_menu_email_deselect_mail"
/>
</group>
<item android:id="@+id/folders"
android:title="@string/folders_action"
android:icon="@drawable/ic_menu_folder"

View File

@ -31,4 +31,10 @@
android:title="@string/accounts_action"
android:icon="@*android:drawable/ic_menu_account_list"
/>
<group android:id="@+id/deselect_all_group">
<item android:id="@+id/deselect_all"
android:title="@string/deselect_all_action"
android:icon="@drawable/ic_menu_email_deselect_mail"
/>
</group>
</menu>

View File

@ -99,6 +99,8 @@
<!-- Menu item -->
<string name="add_account_action">Add account</string>
<!-- Menu item -->
<string name="deselect_all_action">Deselect all</string>
<!-- Menu item -->
<string name="compose_action">Compose</string>
<!-- Menu item/button name -->
<string name="search_action">Search</string>

View File

@ -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);