Merge "Fix issue where subject stays bolded when read."

This commit is contained in:
Ben Komalo 2011-08-10 16:40:39 -07:00 committed by Android (Google) Code Review
commit 6f50b7c3f0
2 changed files with 11 additions and 4 deletions

View File

@ -181,7 +181,7 @@ public class MessageListItem extends View {
/**
* Sets message subject and snippet safely, ensuring the cache is invalidated.
*/
public void setText(String subject, String snippet) {
public void setText(String subject, String snippet, boolean forceUpdate) {
boolean changed = false;
if (!Objects.equal(mSubject, subject)) {
mSubject = subject;
@ -195,7 +195,7 @@ public class MessageListItem extends View {
changed = true;
}
if (changed || (mSubject == null && mSnippet == null) /* first time */) {
if (forceUpdate || changed || (mSubject == null && mSnippet == null) /* first time */) {
SpannableStringBuilder ssb = new SpannableStringBuilder();
boolean hasSubject = false;
if (!TextUtils.isEmpty(mSubject)) {

View File

@ -184,12 +184,18 @@ import java.util.Set;
MessageListItem itemView = (MessageListItem) view;
itemView.bindViewInit(this);
// TODO: just move thise all to a MessageListItem.bindTo(cursor) so that the fields can
// be private, and their inter-dependence when they change can be abstracted away.
// Load the public fields in the view (for later use)
itemView.mMessageId = cursor.getLong(COLUMN_ID);
itemView.mMailboxId = cursor.getLong(COLUMN_MAILBOX_KEY);
final long accountId = cursor.getLong(COLUMN_ACCOUNT_KEY);
itemView.mAccountId = accountId;
itemView.mRead = cursor.getInt(COLUMN_READ) != 0;
boolean isRead = cursor.getInt(COLUMN_READ) != 0;
boolean readChanged = isRead != itemView.mRead;
itemView.mRead = isRead;
itemView.mIsFavorite = cursor.getInt(COLUMN_FAVORITE) != 0;
final int flags = cursor.getInt(COLUMN_FLAGS);
itemView.mHasInvite = (flags & Message.FLAG_INCOMING_MEETING_INVITE) != 0;
@ -198,7 +204,8 @@ import java.util.Set;
itemView.mHasAttachment = cursor.getInt(COLUMN_ATTACHMENTS) != 0;
itemView.setTimestamp(cursor.getLong(COLUMN_DATE));
itemView.mSender = cursor.getString(COLUMN_DISPLAY_NAME);
itemView.setText(cursor.getString(COLUMN_SUBJECT), cursor.getString(COLUMN_SNIPPET));
itemView.setText(
cursor.getString(COLUMN_SUBJECT), cursor.getString(COLUMN_SNIPPET), readChanged);
itemView.mColorChipPaint =
mShowColorChips ? mResourceHelper.getAccountColorPaint(accountId) : null;