1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-16 06:25:06 -05:00

Exiting context mode after batch actions.

This commit is contained in:
Sander Bogaert 2012-07-20 09:20:32 -04:00 committed by Andrew Chen
parent e01232a500
commit 876bd52e8d

View File

@ -1322,10 +1322,6 @@ public class MessageList extends K9ListActivity implements OnClickListener,
} }
mAdapter.removeMessages(holders); mAdapter.removeMessages(holders);
mController.deleteMessages(messagesToRemove.toArray(EMPTY_MESSAGE_ARRAY), null); mController.deleteMessages(messagesToRemove.toArray(EMPTY_MESSAGE_ARRAY), null);
if (mSelectedCount == 0) {
mActionMode.finish();
}
} }
@Override @Override
@ -1342,9 +1338,9 @@ public class MessageList extends K9ListActivity implements OnClickListener,
} }
final String destFolderName = data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER); final String destFolderName = data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER);
final List<MessageInfoHolder> holders = mActiveMessages;
if (destFolderName != null) { if (destFolderName != null) {
final List<MessageInfoHolder> holders = mActiveMessages;
mActiveMessages = null; // don't need it any more mActiveMessages = null; // don't need it any more
@ -3145,10 +3141,18 @@ public class MessageList extends K9ListActivity implements OnClickListener,
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
final List<MessageInfoHolder> selection = getSelectionFromCheckboxes(); final List<MessageInfoHolder> selection = getSelectionFromCheckboxes();
/*
* In the following we assume that we can't move or copy
* mails to the same folder. Also that spam isn't available if we are
* in the spam folder,same for archive.
*
* This is the case currently so safe assumption.
*/
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.delete: { case R.id.delete: {
onDelete(selection); onDelete(selection);
return true; mSelectedCount = 0;
break;
} }
/*case R.id.mark_as_read: { /*case R.id.mark_as_read: {
onToggleRead(holder); onToggleRead(holder);
@ -3160,26 +3164,35 @@ public class MessageList extends K9ListActivity implements OnClickListener,
}*/ }*/
case R.id.archive: { case R.id.archive: {
onArchive(selection); onArchive(selection);
return true; mSelectedCount = 0;
break;
} }
case R.id.spam: { case R.id.spam: {
onSpam(selection); onSpam(selection);
return true; mSelectedCount = 0;
break;
} }
case R.id.move: { case R.id.move: {
onMove(selection); onMove(selection);
return true; mSelectedCount = 0;
break;
} }
case R.id.copy: { case R.id.copy: {
onCopy(selection); onCopy(selection);
return true; mSelectedCount = 0;
break;
} }
/*case R.id.send_alternate: { /*case R.id.send_alternate: {
onSendAlternate(mAccount, holder); onSendAlternate(mAccount, holder);
break; break;
}*/ }*/
default: return false;
} }
if (mSelectedCount == 0) {
mActionMode.finish();
}
return true;
} }
}; };
} }