From 6382ade0c7e26c88c4a17f7ee7124ed92b0b8bcc Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Wed, 29 Feb 2012 15:22:32 -0800 Subject: Invalidate text display list on scroll This is a problem only when using TextView's internal scroll. Since there was no bug report about this obvious problem, it looks like most EditText are single ine or located inside of a ScrollView. Change-Id: I699ad0078c9df64c70d10c64f0293b404485e05f --- core/java/android/widget/TextView.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'core/java/android/widget/TextView.java') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 29e9e91..97d90b4 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8276,8 +8276,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override protected void onScrollChanged(int horiz, int vert, int oldHoriz, int oldVert) { super.onScrollChanged(horiz, vert, oldHoriz, oldVert); - if (mEditor != null && getEditor().mPositionListener != null) { - getEditor().mPositionListener.onScrollChanged(); + if (mEditor != null) { + if (getEditor().mPositionListener != null) { + getEditor().mPositionListener.onScrollChanged(); + } + getEditor().mTextDisplayListIsValid = false; } } @@ -10684,9 +10687,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return; } - if (offset != mPreviousOffset || parentScrolled) { - updateSelection(offset); - addPositionToTouchUpFilter(offset); + boolean offsetChanged = offset != mPreviousOffset; + if (offsetChanged || parentScrolled) { + if (offsetChanged) { + updateSelection(offset); + addPositionToTouchUpFilter(offset); + } final int line = mLayout.getLineForOffset(offset); mPositionX = (int) (mLayout.getPrimaryHorizontal(offset) - 0.5f - mHotspotX); -- cgit v1.1