Merge commit '7d6d99e7b0bf2c446512249a70210b99c013113d' * commit '7d6d99e7b0bf2c446512249a70210b99c013113d': Add "deselect all"
This commit is contained in:
commit
a8f3346285
BIN
res/drawable-hdpi/ic_menu_email_deselect_mail.png
Executable file
BIN
res/drawable-hdpi/ic_menu_email_deselect_mail.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
res/drawable-mdpi/ic_menu_email_deselect_mail.png
Executable file
BIN
res/drawable-mdpi/ic_menu_email_deselect_mail.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
@ -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"
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user