Merge "Don't layout with 0 width if we've got a real width"

This commit is contained in:
Marc Blank 2010-11-22 18:05:34 -08:00 committed by Android (Google) Code Review
commit c0604d9648

View File

@ -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);
}