am 22e4f6b6: Merge "Fix bug 5594054 Crash seen while syncing Exchange" into ics-mr1

* commit '22e4f6b671ab5cfa56fe0aa40df029effcc5a060':
  Fix bug 5594054 Crash seen while syncing Exchange
This commit is contained in:
Makoto Onuki 2011-11-11 15:13:50 +00:00 committed by Android Git Automerger
commit 070277d9fc

View File

@ -313,17 +313,19 @@ public class MessageListItem extends View {
return; return;
} }
boolean hasSubject = false; boolean hasSubject = false;
int snippetStart = 0;
if (!TextUtils.isEmpty(mSubject)) { if (!TextUtils.isEmpty(mSubject)) {
int subjectColor = getFontColor(mRead ? SUBJECT_TEXT_COLOR_READ int subjectColor = getFontColor(mRead ? SUBJECT_TEXT_COLOR_READ
: SUBJECT_TEXT_COLOR_UNREAD); : SUBJECT_TEXT_COLOR_UNREAD);
mText.setSpan(new ForegroundColorSpan(subjectColor), 0, mSubject.length(), mText.setSpan(new ForegroundColorSpan(subjectColor), 0, mSubject.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
snippetStart = mSubject.length() + 1;
} }
if (!TextUtils.isEmpty(mSnippet)) { if (!TextUtils.isEmpty(mSnippet)) {
int snippetColor = getFontColor(mRead ? SNIPPET_TEXT_COLOR_READ int snippetColor = getFontColor(mRead ? SNIPPET_TEXT_COLOR_READ
: SNIPPET_TEXT_COLOR_UNREAD); : SNIPPET_TEXT_COLOR_UNREAD);
mText.setSpan(new ForegroundColorSpan(snippetColor), mSubject.length() + 1, mText mText.setSpan(new ForegroundColorSpan(snippetColor), snippetStart, mText.length(),
.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
} }