Make sure we relayout the TextView when the text changes and marquee is enabled.

Bug #2192881.

Change-Id: Iffc2d15947a11974d9dc175740e3a5489cd43d21
This commit is contained in:
Romain Guy
2009-11-03 17:21:04 -08:00
parent decc139b23
commit e1e0dc8e6e

View File

@@ -3964,8 +3964,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mHighlightPath = new Path(); mHighlightPath = new Path();
if (selStart == selEnd) { if (selStart == selEnd) {
if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) < BLINK) {
< BLINK) {
if (mHighlightPathBogus) { if (mHighlightPathBogus) {
mHighlightPath.reset(); mHighlightPath.reset();
mLayout.getCursorPath(selStart, mHighlightPath, mText); mLayout.getCursorPath(selStart, mHighlightPath, mText);
@@ -5344,21 +5343,24 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* will happen at measure). * will happen at measure).
*/ */
makeNewLayout(want, hintWant, UNKNOWN_BORING, UNKNOWN_BORING, 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 (mEllipsize != TextUtils.TruncateAt.MARQUEE) {
if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && // In a fixed-height view, so use our new text layout.
mLayoutParams.height != LayoutParams.FILL_PARENT) { if (mLayoutParams.height != LayoutParams.WRAP_CONTENT &&
invalidate(); mLayoutParams.height != LayoutParams.FILL_PARENT) {
return; invalidate();
} return;
}
// Dynamic height, but height has stayed the same, // Dynamic height, but height has stayed the same,
// so use our new text layout. // so use our new text layout.
if (mLayout.getHeight() == oldht && if (mLayout.getHeight() == oldht &&
(mHintLayout == null || mHintLayout.getHeight() == oldht)) { (mHintLayout == null || mHintLayout.getHeight() == oldht)) {
invalidate(); invalidate();
return; return;
}
} }
// We lose: the height has changed and we have a dynamic height. // We lose: the height has changed and we have a dynamic height.