diff options
| author | 2010-09-17 18:57:25 -0700 | |
|---|---|---|
| committer | 2010-09-17 18:57:25 -0700 | |
| commit | 23bd5f50759c54224a2620cbed4614e434437265 (patch) | |
| tree | acaebb697900f6b297ae0b1e075d15c6fc13407c | |
| parent | 25945ca2e67c0e46ff2ad46590cd71ca5b4b4266 (diff) | |
Fix some drawing artifacts/bugs around overlays/text anchors
Change-Id: I28170d4e120506c09a1cfea721244fbcd3c2576a
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index fd6769ca6400..deba70cdfad7 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3542,10 +3542,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.isOverlayEnabled()) { - canvas.translate(child.mLeft + child.mScrollX, child.mTop + child.mScrollY); + canvas.translate(child.mLeft - child.mScrollX, child.mTop - child.mScrollY); child.onDrawOverlay(canvas); - canvas.translate(-(child.mLeft + child.mScrollX), - -(child.mTop + child.mScrollY)); + canvas.translate(-(child.mLeft - child.mScrollX), + -(child.mTop - child.mScrollY)); } } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a14d004ffa92..a09b0c8702e6 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -7727,8 +7727,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener bounds.bottom = bounds.top + drawableHeight; convertFromViewportToContentCoordinates(bounds); + invalidate(); mDrawable.setBounds(bounds); - postInvalidate(); + invalidate(); } boolean hasFingerOn(float x, float y) { @@ -7745,9 +7746,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return Rect.intersects(mDrawable.getBounds(), fingerRect); } + void invalidate() { + final Rect bounds = mDrawable.getBounds(); + TextView.this.invalidate(bounds.left, bounds.top, + bounds.right, bounds.bottom); + } + void postInvalidate() { final Rect bounds = mDrawable.getBounds(); - TextView.this.postInvalidate(bounds.left, bounds.top, bounds.right, bounds.bottom); + TextView.this.postInvalidate(bounds.left, bounds.top, + bounds.right, bounds.bottom); } void postInvalidateDelayed(long delay) { |