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: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
android:id="@+id/batch_flag_button"
android:layout_width="0dip"

View File

@ -312,9 +312,14 @@ public class MessageList
private boolean mCheckboxes = true;
private int mSelectedCount = 0;
/**
* Area with buttons visible when multiple
* mails are marked.
*/
private View mBatchButtonArea;
private ImageButton mBatchReadButton;
private ImageButton mBatchDeleteButton;
private ImageButton mBatchSpamButton;
private ImageButton mBatchFlagButton;
private ImageButton mBatchDoneButton;
@ -900,10 +905,13 @@ public class MessageList
mBatchReadButton.setOnClickListener(this);
mBatchDeleteButton = (ImageButton) findViewById(R.id.batch_delete_button);
mBatchDeleteButton.setOnClickListener(this);
mBatchSpamButton = (ImageButton) findViewById(R.id.batch_spam_button);
mBatchSpamButton.setOnClickListener(this);
mBatchFlagButton = (ImageButton) findViewById(R.id.batch_flag_button);
mBatchFlagButton.setOnClickListener(this);
mBatchDoneButton = (ImageButton) findViewById(R.id.batch_done_button);
mBatchDoneButton.setOnClickListener(this);
// Gesture detection
@ -2960,6 +2968,16 @@ public class MessageList
Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear);
animation.setAnimationListener(this);
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;
List<Message> messageList = new ArrayList<Message>();
// messages to be removed from the view
List<MessageInfoHolder> removeHolderList = new ArrayList<MessageInfoHolder>();
if (v == mBatchDoneButton)
@ -3092,6 +3111,10 @@ public class MessageList
{
removeHolderList.add(holder);
}
else if (v == mBatchSpamButton)
{
removeHolderList.add(holder);
}
else if (v == mBatchFlagButton)
{
holder.flagged = newState;
@ -3114,6 +3137,17 @@ public class MessageList
mSelectedCount = 0;
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
{
mController.setFlag(messageList.toArray(EMPTY_MESSAGE_ARRAY), (v == mBatchReadButton ? Flag.SEEN : Flag.FLAGGED), newState);