diff --git a/src/com/android/email/activity/MessageListItem.java b/src/com/android/email/activity/MessageListItem.java index afbbe4f39..edac776ac 100644 --- a/src/com/android/email/activity/MessageListItem.java +++ b/src/com/android/email/activity/MessageListItem.java @@ -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)) { diff --git a/src/com/android/email/activity/MessagesAdapter.java b/src/com/android/email/activity/MessagesAdapter.java index 5586f9e26..9d568d97d 100644 --- a/src/com/android/email/activity/MessagesAdapter.java +++ b/src/com/android/email/activity/MessagesAdapter.java @@ -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;