summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-02-05 14:05:17 -0800
committerAlan Viverette <alanv@google.com>2014-02-05 14:05:17 -0800
commite6875f1575a71402cd86f75e4d031c95ccd43cc4 (patch)
treeef7602eebe5db74582faf223bf5827b8734b7a58 /core/java/android/widget/TextView.java
parent143b46d50c0c01970c7d280228bd1e58c2afb32b (diff)
downloadframeworks_base-e6875f1575a71402cd86f75e4d031c95ccd43cc4.zip
frameworks_base-e6875f1575a71402cd86f75e4d031c95ccd43cc4.tar.gz
frameworks_base-e6875f1575a71402cd86f75e4d031c95ccd43cc4.tar.bz2
Temporary fix for background invalidation
Not a complete solution, since we could be more efficient, but enough to have both background display lists and proper invalidation. Change-Id: I0216a104948c0930760275bb2b98318b0a4487e7
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 3be23b7..65b79fc 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4814,6 +4814,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@Override
public void invalidateDrawable(Drawable drawable) {
+ boolean handled = false;
+
if (verifyDrawable(drawable)) {
final Rect dirty = drawable.getBounds();
int scrollX = mScrollX;
@@ -4831,6 +4833,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
scrollX += mPaddingLeft;
scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightLeft) / 2;
+ handled = true;
} else if (drawable == drawables.mDrawableRight) {
final int compoundPaddingTop = getCompoundPaddingTop();
final int compoundPaddingBottom = getCompoundPaddingBottom();
@@ -4838,6 +4841,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
scrollX += (mRight - mLeft - mPaddingRight - drawables.mDrawableSizeRight);
scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightRight) / 2;
+ handled = true;
} else if (drawable == drawables.mDrawableTop) {
final int compoundPaddingLeft = getCompoundPaddingLeft();
final int compoundPaddingRight = getCompoundPaddingRight();
@@ -4845,6 +4849,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthTop) / 2;
scrollY += mPaddingTop;
+ handled = true;
} else if (drawable == drawables.mDrawableBottom) {
final int compoundPaddingLeft = getCompoundPaddingLeft();
final int compoundPaddingRight = getCompoundPaddingRight();
@@ -4852,11 +4857,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;
scrollY += (mBottom - mTop - mPaddingBottom - drawables.mDrawableSizeBottom);
+ handled = true;
}
}
- invalidate(dirty.left + scrollX, dirty.top + scrollY,
- dirty.right + scrollX, dirty.bottom + scrollY);
+ if (handled) {
+ invalidate(dirty.left + scrollX, dirty.top + scrollY,
+ dirty.right + scrollX, dirty.bottom + scrollY);
+ }
+ }
+
+ if (!handled) {
+ super.invalidateDrawable(drawable);
}
}