summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-02-29 15:22:32 -0800
committerGilles Debunne <debunne@google.com>2012-02-29 15:22:34 -0800
commit6382ade0c7e26c88c4a17f7ee7124ed92b0b8bcc (patch)
tree89f2cb084dd8ec3906a3fcb6724766d79995081e /core/java/android/widget/TextView.java
parentf17981b33b0359136c0b88a92311a3140be2ba71 (diff)
downloadframeworks_base-6382ade0c7e26c88c4a17f7ee7124ed92b0b8bcc.zip
frameworks_base-6382ade0c7e26c88c4a17f7ee7124ed92b0b8bcc.tar.gz
frameworks_base-6382ade0c7e26c88c4a17f7ee7124ed92b0b8bcc.tar.bz2
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
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java16
1 files changed, 11 insertions, 5 deletions
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);