From 3d91924c99d108eaeeffe098cddfe71921e1aec3 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Thu, 30 Dec 2010 10:22:47 -0800 Subject: [PATCH] Fix format/draw issues with snippets Bug: 3315171 Change-Id: I8e44c1d64d2f3382fd1e03b35e3e59b048eca31d --- src/com/android/email/activity/MessageListItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/activity/MessageListItem.java b/src/com/android/email/activity/MessageListItem.java index 8d6eaea8d..7c4314fc3 100644 --- a/src/com/android/email/activity/MessageListItem.java +++ b/src/com/android/email/activity/MessageListItem.java @@ -266,7 +266,7 @@ public class MessageListItem extends View { for (int i = 0; i < MAX_SUBJECT_SNIPPET_LINES; i++) { int start = layout.getLineStart(i); if (i == MAX_SUBJECT_SNIPPET_LINES - 1) { - int end = mText.length() - 1; + int end = mText.length(); if (start > end) continue; // For the final line, ellipsize the text to our width mSnippetLines[i] = TextUtils.ellipsize(mText.subSequence(start, end), sDefaultPaint, @@ -381,7 +381,7 @@ public class MessageListItem extends View { int subjectEnd = (mSubject == null) ? 0 : mSubject.length(); int lineStart = 0; TextPaint subjectPaint = mRead ? sDefaultPaint : sBoldPaint; - for (int i = 0; i < MAX_SUBJECT_SNIPPET_LINES; i++) { + for (int i = 0; i < MAX_SUBJECT_SNIPPET_LINES && i < mSnippetLineCount; i++) { CharSequence line = mSnippetLines[i]; int drawX = snippetX; if (line != null) {