mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -05:00
Added "move to spam folder" confirmation dialog to MessageList
This commit is contained in:
parent
53a316234c
commit
aa4c970baa
@ -61,6 +61,12 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
private MessageViewHandler mHandler = new MessageViewHandler();
|
private MessageViewHandler mHandler = new MessageViewHandler();
|
||||||
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to temporarily store the destination folder for refile operations if a confirmation
|
||||||
|
* dialog is shown.
|
||||||
|
*/
|
||||||
|
private String mDstFolder;
|
||||||
|
|
||||||
private final class StorageListenerImplementation implements StorageManager.StorageListener {
|
private final class StorageListenerImplementation implements StorageManager.StorageListener {
|
||||||
@Override
|
@Override
|
||||||
public void onUnmount(String providerId) {
|
public void onUnmount(String providerId) {
|
||||||
@ -581,17 +587,26 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
toast.show();
|
toast.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String srcFolder = mMessageReference.folderName;
|
|
||||||
Message messageToMove = mMessage;
|
|
||||||
if (K9.FOLDER_NONE.equalsIgnoreCase(dstFolder)) {
|
if (K9.FOLDER_NONE.equalsIgnoreCase(dstFolder)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mAccount.getSpamFolderName().equals(dstFolder) && K9.confirmSpam()) {
|
||||||
|
mDstFolder = dstFolder;
|
||||||
|
showDialog(R.id.dialog_confirm_spam);
|
||||||
|
} else {
|
||||||
|
refileMessage(dstFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refileMessage(String dstFolder) {
|
||||||
|
String srcFolder = mMessageReference.folderName;
|
||||||
|
Message messageToMove = mMessage;
|
||||||
showNextMessageOrReturn();
|
showNextMessageOrReturn();
|
||||||
mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
|
mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void showNextMessageOrReturn() {
|
private void showNextMessageOrReturn() {
|
||||||
if (K9.messageViewReturnToList()) {
|
if (K9.messageViewReturnToList()) {
|
||||||
finish();
|
finish();
|
||||||
@ -927,6 +942,19 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
delete();
|
delete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
case R.id.dialog_confirm_spam:
|
||||||
|
return ConfirmationDialog.create(this, id,
|
||||||
|
R.string.dialog_confirm_spam_title,
|
||||||
|
R.string.dialog_confirm_spam_message,
|
||||||
|
R.string.dialog_confirm_spam_confirm_button,
|
||||||
|
R.string.dialog_confirm_spam_cancel_button,
|
||||||
|
new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
refileMessage(mDstFolder);
|
||||||
|
mDstFolder = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
case R.id.dialog_attachment_progress:
|
case R.id.dialog_attachment_progress:
|
||||||
ProgressDialog d = new ProgressDialog(this);
|
ProgressDialog d = new ProgressDialog(this);
|
||||||
d.setIndeterminate(true);
|
d.setIndeterminate(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user