1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00
mark multiple mails as SPAM
This commit is contained in:
Marcus Wolschon 2010-11-22 08:12:48 +00:00
parent 0206ebf809
commit 4f08820683
3 changed files with 41 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -30,6 +30,13 @@
android:layout_weight="1" android:layout_weight="1"
android:src="@drawable/ic_button_delete" android:src="@drawable/ic_button_delete"
/> />
<ImageButton
android:id="@+id/batch_spam_button"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/ic_button_spam"
/>
<ImageButton <ImageButton
android:id="@+id/batch_flag_button" android:id="@+id/batch_flag_button"
android:layout_width="0dip" android:layout_width="0dip"

View File

@ -312,9 +312,14 @@ public class MessageList
private boolean mCheckboxes = true; private boolean mCheckboxes = true;
private int mSelectedCount = 0; private int mSelectedCount = 0;
/**
* Area with buttons visible when multiple
* mails are marked.
*/
private View mBatchButtonArea; private View mBatchButtonArea;
private ImageButton mBatchReadButton; private ImageButton mBatchReadButton;
private ImageButton mBatchDeleteButton; private ImageButton mBatchDeleteButton;
private ImageButton mBatchSpamButton;
private ImageButton mBatchFlagButton; private ImageButton mBatchFlagButton;
private ImageButton mBatchDoneButton; private ImageButton mBatchDoneButton;
@ -900,10 +905,13 @@ public class MessageList
mBatchReadButton.setOnClickListener(this); mBatchReadButton.setOnClickListener(this);
mBatchDeleteButton = (ImageButton) findViewById(R.id.batch_delete_button); mBatchDeleteButton = (ImageButton) findViewById(R.id.batch_delete_button);
mBatchDeleteButton.setOnClickListener(this); mBatchDeleteButton.setOnClickListener(this);
mBatchSpamButton = (ImageButton) findViewById(R.id.batch_spam_button);
mBatchSpamButton.setOnClickListener(this);
mBatchFlagButton = (ImageButton) findViewById(R.id.batch_flag_button); mBatchFlagButton = (ImageButton) findViewById(R.id.batch_flag_button);
mBatchFlagButton.setOnClickListener(this); mBatchFlagButton.setOnClickListener(this);
mBatchDoneButton = (ImageButton) findViewById(R.id.batch_done_button); mBatchDoneButton = (ImageButton) findViewById(R.id.batch_done_button);
mBatchDoneButton.setOnClickListener(this); mBatchDoneButton.setOnClickListener(this);
// Gesture detection // Gesture detection
@ -2960,6 +2968,16 @@ public class MessageList
Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear); Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear);
animation.setAnimationListener(this); animation.setAnimationListener(this);
mBatchButtonArea.startAnimation(animation); mBatchButtonArea.startAnimation(animation);
// hide spam button if there is no spam folder
if (mAccount != null) {
String folderName = mAccount.getSpamFolderName();
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|| !mController.isMoveCapable(mAccount)) {
mBatchSpamButton.setVisibility(View.GONE);
}
}
} }
} }
@ -3065,6 +3083,7 @@ public class MessageList
{ {
boolean newState = false; boolean newState = false;
List<Message> messageList = new ArrayList<Message>(); List<Message> messageList = new ArrayList<Message>();
// messages to be removed from the view
List<MessageInfoHolder> removeHolderList = new ArrayList<MessageInfoHolder>(); List<MessageInfoHolder> removeHolderList = new ArrayList<MessageInfoHolder>();
if (v == mBatchDoneButton) if (v == mBatchDoneButton)
@ -3092,6 +3111,10 @@ public class MessageList
{ {
removeHolderList.add(holder); removeHolderList.add(holder);
} }
else if (v == mBatchSpamButton)
{
removeHolderList.add(holder);
}
else if (v == mBatchFlagButton) else if (v == mBatchFlagButton)
{ {
holder.flagged = newState; holder.flagged = newState;
@ -3114,6 +3137,17 @@ public class MessageList
mSelectedCount = 0; mSelectedCount = 0;
toggleBatchButtons(); toggleBatchButtons();
} }
else if (v == mBatchSpamButton)
{
String folderName = mAccount.getSpamFolderName();
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName))
{
return;
}
mController.moveMessages(mAccount, mCurrentFolder.name, messageList.toArray(EMPTY_MESSAGE_ARRAY), folderName, null);
mSelectedCount = 0;
toggleBatchButtons();
}
else else
{ {
mController.setFlag(messageList.toArray(EMPTY_MESSAGE_ARRAY), (v == mBatchReadButton ? Flag.SEEN : Flag.FLAGGED), newState); mController.setFlag(messageList.toArray(EMPTY_MESSAGE_ARRAY), (v == mBatchReadButton ? Flag.SEEN : Flag.FLAGGED), newState);