mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Issue 2296 Spam message
This commit is contained in:
parent
e698c78190
commit
80f055a0a7
@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
|
||||
<item type="id" name="dialog_confirm_delete"/>
|
||||
<item type="id" name="dialog_confirm_spam"/>
|
||||
<item type="id" name="dialog_attachment_progress"/>
|
||||
|
||||
</resources>
|
||||
|
@ -1024,6 +1024,11 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="dialog_confirm_delete_message">Do you want to delete this message?</string>
|
||||
<string name="dialog_confirm_delete_confirm_button">Delete</string>
|
||||
<string name="dialog_confirm_delete_cancel_button">Do not delete</string>
|
||||
|
||||
<string name="dialog_confirm_spam_title">Confirm Spam</string>
|
||||
<string name="dialog_confirm_spam_message">Do you really want to mark this conversation as Spam?</string>
|
||||
<string name="dialog_confirm_spam_confirm_button">Report Spam</string>
|
||||
<string name="dialog_confirm_spam_cancel_button">No</string>
|
||||
|
||||
<string name="dialog_attachment_progress_title">Downloading attachment</string>
|
||||
|
||||
|
@ -147,6 +147,7 @@ public class K9 extends Application {
|
||||
private static boolean mAnimations = true;
|
||||
|
||||
private static boolean mConfirmDelete = false;
|
||||
private static boolean mConfirmSpam = false;
|
||||
private static boolean mKeyguardPrivacy = false;
|
||||
|
||||
private static boolean mMessageListStars = true;
|
||||
@ -444,6 +445,7 @@ public class K9 extends Application {
|
||||
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
|
||||
|
||||
editor.putBoolean("confirmDelete", mConfirmDelete);
|
||||
editor.putBoolean("confirmSpam", mConfirmSpam);
|
||||
|
||||
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
|
||||
|
||||
@ -496,6 +498,8 @@ public class K9 extends Application {
|
||||
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
|
||||
|
||||
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
|
||||
mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
|
||||
|
||||
|
||||
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
|
||||
|
||||
@ -933,6 +937,14 @@ public class K9 extends Application {
|
||||
public static void setConfirmDelete(final boolean confirm) {
|
||||
mConfirmDelete = confirm;
|
||||
}
|
||||
|
||||
public static boolean confirmSpam(){
|
||||
return mConfirmSpam;
|
||||
}
|
||||
|
||||
public static void setConfirmSpam(final boolean confirm){
|
||||
mConfirmSpam = confirm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether privacy rules should be applied when system is locked
|
||||
|
@ -1131,15 +1131,20 @@ public class MessageList
|
||||
}
|
||||
|
||||
private void onSpam(MessageInfoHolder holder) {
|
||||
|
||||
if (!mController.isMoveCapable(holder.message)) {
|
||||
if (K9.confirmSpam()) {
|
||||
showDialog(R.id.dialog_confirm_spam);
|
||||
} else
|
||||
spam(holder);
|
||||
}
|
||||
|
||||
private void spam(MessageInfoHolder holder){
|
||||
if (!mController.isMoveCapable(holder.message)) {
|
||||
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
return;
|
||||
}
|
||||
|
||||
onMoveChosen(holder, holder.message.getFolder().getAccount().getSpamFolderName());
|
||||
}
|
||||
onMoveChosen(holder, holder.message.getFolder().getAccount().getSpamFolderName());
|
||||
}
|
||||
|
||||
private void onCopy(MessageInfoHolder holder) {
|
||||
if (!mController.isCopyCapable(holder.message.getFolder().getAccount())) {
|
||||
@ -1257,6 +1262,8 @@ public class MessageList
|
||||
switch (id) {
|
||||
case DIALOG_MARK_ALL_AS_READ:
|
||||
return createMarkAllAsReadDialog();
|
||||
case R.id.dialog_confirm_spam:
|
||||
return createConfirmSpamDialog(id);
|
||||
}
|
||||
|
||||
return super.onCreateDialog(id);
|
||||
@ -1308,6 +1315,28 @@ public class MessageList
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
private Dialog createConfirmSpamDialog(final int id) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.dialog_confirm_spam_title);
|
||||
builder.setMessage(R.string.dialog_confirm_spam_message);
|
||||
builder.setPositiveButton(R.string.dialog_confirm_spam_confirm_button,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dismissDialog(id);
|
||||
spam(mSelectedMessage);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.dialog_confirm_spam_cancel_button,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dismissDialog(id);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private void onToggleRead(MessageInfoHolder holder) {
|
||||
mController.setFlag(holder.message.getFolder().getAccount(), holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.SEEN, !holder.read);
|
||||
@ -1541,7 +1570,7 @@ public class MessageList
|
||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
|
||||
MessageInfoHolder holder = mSelectedMessage;
|
||||
// don't need this anymore
|
||||
mSelectedMessage = null;
|
||||
//mSelectedMessage = null;
|
||||
if (holder == null) {
|
||||
holder = (MessageInfoHolder) mAdapter.getItem(info.position);
|
||||
}
|
||||
|
@ -181,8 +181,9 @@ public class Prefs extends K9PreferenceActivity {
|
||||
mStartIntegratedInbox.setChecked(K9.startIntegratedInbox());
|
||||
|
||||
mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
|
||||
mConfirmActions.setItems(new CharSequence[] {getString(R.string.global_settings_confirm_action_delete)});
|
||||
mConfirmActions.setCheckedItems(new boolean[] {K9.confirmDelete()});
|
||||
mConfirmActions.setItems(new CharSequence[] {getString(R.string.global_settings_confirm_action_delete),
|
||||
getString(R.string.global_settings_confirm_action_spam)});
|
||||
mConfirmActions.setCheckedItems(new boolean[] {K9.confirmDelete(), K9.confirmSpam()});
|
||||
|
||||
mPrivacyMode = (CheckBoxPreference) findPreference(PREFERENCE_PRIVACY_MODE);
|
||||
mPrivacyMode.setChecked(K9.keyguardPrivacy());
|
||||
@ -305,6 +306,7 @@ public class Prefs extends K9PreferenceActivity {
|
||||
K9.setManageBack(mManageBack.isChecked());
|
||||
K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked());
|
||||
K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]);
|
||||
K9.setConfirmSpam(mConfirmActions.getCheckedItems()[1]);
|
||||
K9.setKeyguardPrivacy(mPrivacyMode.isChecked());
|
||||
K9.setMeasureAccounts(mMeasureAccounts.isChecked());
|
||||
K9.setCountSearchMessages(mCountSearch.isChecked());
|
||||
|
Loading…
Reference in New Issue
Block a user