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

Only keep reference to selected message if necessary

Only keep mSelectedMessage pointing to the currently selected message
if we use the spam action and ask for confirmation before moving.
This commit is contained in:
cketti 2011-04-01 03:45:50 +02:00
parent ea9213cd4d
commit e3e31062ad

View File

@ -1131,6 +1131,8 @@ public class MessageList
private void onSpam(MessageInfoHolder holder) { private void onSpam(MessageInfoHolder holder) {
if (K9.confirmSpam()) { if (K9.confirmSpam()) {
// The action handler needs this to move the message later
mSelectedMessage = holder;
showDialog(R.id.dialog_confirm_spam); showDialog(R.id.dialog_confirm_spam);
} else { } else {
moveToSpamFolder(holder); moveToSpamFolder(holder);
@ -1294,6 +1296,8 @@ public class MessageList
@Override @Override
public void run() { public void run() {
moveToSpamFolder(mSelectedMessage); moveToSpamFolder(mSelectedMessage);
// No further need for this reference
mSelectedMessage = null;
} }
}); });
} }
@ -1549,7 +1553,7 @@ public class MessageList
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
MessageInfoHolder holder = mSelectedMessage; MessageInfoHolder holder = mSelectedMessage;
// don't need this anymore // don't need this anymore
//mSelectedMessage = null; mSelectedMessage = null;
if (holder == null) { if (holder == null) {
holder = (MessageInfoHolder) mAdapter.getItem(info.position); holder = (MessageInfoHolder) mAdapter.getItem(info.position);
} }