From 452b34772942f767e2ba1a14fa03bdd58b29d180 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Mon, 22 Nov 2010 17:43:11 -0800 Subject: [PATCH] Don't layout with 0 width if we've got a real width Bug: 3221168 Change-Id: I85562cad4afe7ce494cdb4cd348cad23c6103936 --- .../android/email/activity/MessageListItem.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/com/android/email/activity/MessageListItem.java b/src/com/android/email/activity/MessageListItem.java index a7a4cec95..79e05f767 100644 --- a/src/com/android/email/activity/MessageListItem.java +++ b/src/com/android/email/activity/MessageListItem.java @@ -243,14 +243,16 @@ public class MessageListItem extends View { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - mViewWidth = MeasureSpec.getSize(widthMeasureSpec); - int mode = getViewMode(mViewWidth); - if (mode != mMode) { - // If the mode has changed, set the snippet line count to indicate layout required - mMode = mode; - mSnippetLineCount = NEEDS_LAYOUT; + if (widthMeasureSpec != 0 || mViewWidth == 0) { + mViewWidth = MeasureSpec.getSize(widthMeasureSpec); + int mode = getViewMode(mViewWidth); + if (mode != mMode) { + // If the mode has changed, set the snippet line count to indicate layout required + mMode = mode; + mSnippetLineCount = NEEDS_LAYOUT; + } + mViewHeight = measureHeight(heightMeasureSpec, mMode); } - mViewHeight = measureHeight(heightMeasureSpec, mMode); setMeasuredDimension(mViewWidth, mViewHeight); }