summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-10-18 00:20:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-18 00:20:27 +0000
commit15e7b2ac60b0e6355e6ed5c1be676744c23f5a0e (patch)
tree540aa34e74be0b21c8d3172ffc12cd43aa854ff4 /core/java
parent5d6041813283086c5a290ad6ca07e05b1a6ffc14 (diff)
parentb95c336d7863e6b63e2aa8682a90dd8ae213889c (diff)
downloadframeworks_base-15e7b2ac60b0e6355e6ed5c1be676744c23f5a0e.zip
frameworks_base-15e7b2ac60b0e6355e6ed5c1be676744c23f5a0e.tar.gz
frameworks_base-15e7b2ac60b0e6355e6ed5c1be676744c23f5a0e.tar.bz2
Merge "Translate compound button drawable by scroll position" into lmp-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/CompoundButton.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 2ccd18d..7d9d305 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -398,7 +398,15 @@ public abstract class CompoundButton extends Button implements Checkable {
super.onDraw(canvas);
if (buttonDrawable != null) {
- buttonDrawable.draw(canvas);
+ final int scrollX = mScrollX;
+ final int scrollY = mScrollY;
+ if (scrollX == 0 && scrollY == 0) {
+ buttonDrawable.draw(canvas);
+ } else {
+ canvas.translate(scrollX, scrollY);
+ buttonDrawable.draw(canvas);
+ canvas.translate(-scrollX, -scrollY);
+ }
}
}