From e1e0dc8e6eaec052ebb6b88f5b1223075ce5a356 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 3 Nov 2009 17:21:04 -0800 Subject: [PATCH] Make sure we relayout the TextView when the text changes and marquee is enabled. Bug #2192881. Change-Id: Iffc2d15947a11974d9dc175740e3a5489cd43d21 --- core/java/android/widget/TextView.java | 34 ++++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index bf3d26e075edb..596fd98e1338f 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -3964,8 +3964,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mHighlightPath = new Path(); if (selStart == selEnd) { - if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) - < BLINK) { + if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) < BLINK) { if (mHighlightPathBogus) { mHighlightPath.reset(); mLayout.getCursorPath(selStart, mHighlightPath, mText); @@ -5344,21 +5343,24 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * will happen at measure). */ makeNewLayout(want, hintWant, UNKNOWN_BORING, UNKNOWN_BORING, - mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(), false); + mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(), + false); - // In a fixed-height view, so use our new text layout. - if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && - mLayoutParams.height != LayoutParams.FILL_PARENT) { - invalidate(); - return; - } - - // Dynamic height, but height has stayed the same, - // so use our new text layout. - if (mLayout.getHeight() == oldht && - (mHintLayout == null || mHintLayout.getHeight() == oldht)) { - invalidate(); - return; + if (mEllipsize != TextUtils.TruncateAt.MARQUEE) { + // In a fixed-height view, so use our new text layout. + if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && + mLayoutParams.height != LayoutParams.FILL_PARENT) { + invalidate(); + return; + } + + // Dynamic height, but height has stayed the same, + // so use our new text layout. + if (mLayout.getHeight() == oldht && + (mHintLayout == null || mHintLayout.getHeight() == oldht)) { + invalidate(); + return; + } } // We lose: the height has changed and we have a dynamic height.