1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

lift hasAttachments to LocalMessage

This commit is contained in:
Jesse Vincent 2010-11-27 04:02:56 +00:00
parent ae7ce4de7b
commit f9981dcf7c
6 changed files with 16 additions and 9 deletions

View File

@ -3,6 +3,7 @@ import com.fsck.k9.helper.MessageHelper;
import java.util.Date; import java.util.Date;
import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
public class MessageInfoHolder public class MessageInfoHolder
{ {
@ -15,7 +16,6 @@ public class MessageInfoHolder
public String compareCounterparty; public String compareCounterparty;
public String preview; public String preview;
public String[] recipients; public String[] recipients;
public boolean hasAttachments;
public String uid; public String uid;
public boolean read; public boolean read;
public boolean answered; public boolean answered;
@ -25,7 +25,7 @@ public class MessageInfoHolder
public boolean dirty; public boolean dirty;
public boolean toMe; public boolean toMe;
public boolean ccMe; public boolean ccMe;
public Message message; public LocalMessage message;
public FolderInfoHolder folder; public FolderInfoHolder folder;
public boolean selected; public boolean selected;
public String account; public String account;

View File

@ -152,7 +152,7 @@ public class MessageList
@Override @Override
public int compare(MessageInfoHolder object1, MessageInfoHolder object2) public int compare(MessageInfoHolder object1, MessageInfoHolder object2)
{ {
return (object1.hasAttachments ? 0 : 1) - (object2.hasAttachments ? 0 : 1); return (object1.message.hasAttachments() ? 0 : 1) - (object2.message.hasAttachments() ? 0 : 1);
} }
} }
@ -2805,7 +2805,7 @@ public class MessageList
holder.subject.setCompoundDrawablesWithIntrinsicBounds( holder.subject.setCompoundDrawablesWithIntrinsicBounds(
message.answered ? mAnsweredIcon : null, // left message.answered ? mAnsweredIcon : null, // left
null, // top null, // top
message.hasAttachments ? mAttachmentIcon : null, // right message.message.hasAttachments() ? mAttachmentIcon : null, // right
null); // bottom null); // bottom
holder.position = position; holder.position = position;
} }

View File

@ -2243,7 +2243,7 @@ public class MessageView extends K9Activity implements OnClickListener
CharSequence ccText = Address.toFriendly(message.getRecipients(RecipientType.CC), contacts); CharSequence ccText = Address.toFriendly(message.getRecipients(RecipientType.CC), contacts);
int color = mAccount.getChipColor(); int color = mAccount.getChipColor();
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0; boolean hasAttachments = ((LocalMessage) message).hasAttachments();
boolean unread = !message.isSet(Flag.SEEN); boolean unread = !message.isSet(Flag.SEEN);
mHandler.setHeaders(subjectText, mHandler.setHeaders(subjectText,

View File

@ -57,6 +57,7 @@ public class MessageHelper
try try
{ {
LocalMessage message = (LocalMessage) m; LocalMessage message = (LocalMessage) m;
target.message = message;
Date date = message.getSentDate(); Date date = message.getSentDate();
target.compareDate = message.getSentDate(); target.compareDate = message.getSentDate();
if (target.compareDate == null) if (target.compareDate == null)
@ -66,8 +67,6 @@ public class MessageHelper
target.folder = folder; target.folder = folder;
target.hasAttachments = message.getAttachmentCount() > 0;
target.read = message.isSet(Flag.SEEN); target.read = message.isSet(Flag.SEEN);
target.answered = message.isSet(Flag.ANSWERED); target.answered = message.isSet(Flag.ANSWERED);
target.flagged = message.isSet(Flag.FLAGGED); target.flagged = message.isSet(Flag.FLAGGED);
@ -122,7 +121,6 @@ public class MessageHelper
target.subject = message.getSubject(); target.subject = message.getSubject();
target.uid = message.getUid(); target.uid = message.getUid();
target.message = m;
target.preview = message.getPreview(); target.preview = message.getPreview();
target.account = account.getDescription(); target.account = account.getDescription();

View File

@ -224,4 +224,5 @@ public abstract class Message implements Part, Body
MessageReference tmpReference = makeMessageReference(); MessageReference tmpReference = makeMessageReference();
return tmpReference.equals(ref); return tmpReference.equals(ref);
} }
} }

View File

@ -6048,7 +6048,15 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
mMessageDirty = true; mMessageDirty = true;
} }
public boolean hasAttachments()
{
if (mAttachmentCount > 0) {
return true;
} else{
return false;
}
}
public int getAttachmentCount() public int getAttachmentCount()
{ {