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

Issue 2296 Spam message

This commit is contained in:
Archibald Sheran 2011-04-01 05:34:09 +08:00 committed by cketti
parent e698c78190
commit 80f055a0a7
5 changed files with 57 additions and 8 deletions

View File

@ -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>

View File

@ -1025,6 +1025,11 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<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>
<string name="debug_logging_enabled">Debug logging to Android logging system enabled</string>

View File

@ -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);
@ -934,6 +938,14 @@ public class K9 extends Application {
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
*/

View File

@ -1131,13 +1131,18 @@ public class MessageList
}
private void onSpam(MessageInfoHolder holder) {
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());
}
@ -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);
@ -1309,6 +1316,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);
holder.read = !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);
}

View File

@ -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());