diff options
author | Alan Viverette <alanv@google.com> | 2014-05-21 15:42:54 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-05-21 15:42:54 -0700 |
commit | 53a3ed7c46c12c2e578d1b1df8b039c6db690eaa (patch) | |
tree | 2a4c214b029729a1c920a19360e462fc07d1004c /graphics | |
parent | 17dafdc8d8cb92a03294657d3a6e36c9c546d130 (diff) | |
download | frameworks_base-53a3ed7c46c12c2e578d1b1df8b039c6db690eaa.zip frameworks_base-53a3ed7c46c12c2e578d1b1df8b039c6db690eaa.tar.gz frameworks_base-53a3ed7c46c12c2e578d1b1df8b039c6db690eaa.tar.bz2 |
Clean up hotspot bounds API
Change-Id: I7daf7e2d360d761f673aa69a0f925b8076ab19c6
Diffstat (limited to 'graphics')
5 files changed, 22 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 3ef1d68..d6fb9e0 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -495,7 +495,7 @@ public abstract class Drawable { /** * Sets the bounds to which the hotspot is constrained, if they should be * different from the drawable bounds. - * + * * @param left * @param top * @param right diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index ec5c6c6..04373d4 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -245,6 +245,13 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { } @Override + public void setHotspotBounds(int left, int top, int right, int bottom) { + if (mCurrDrawable != null) { + mCurrDrawable.setHotspotBounds(left, top, right, bottom); + } + } + + @Override protected boolean onStateChange(int[] state) { if (mLastDrawable != null) { return mLastDrawable.setState(state); diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java index 3749339..2fa5929 100644 --- a/graphics/java/android/graphics/drawable/InsetDrawable.java +++ b/graphics/java/android/graphics/drawable/InsetDrawable.java @@ -192,6 +192,11 @@ public class InsetDrawable extends Drawable implements Drawable.Callback } @Override + public void setHotspotBounds(int left, int top, int right, int bottom) { + mInsetState.mDrawable.setHotspotBounds(left, top, right, bottom); + } + + @Override public boolean setVisible(boolean visible, boolean restart) { mInsetState.mDrawable.setVisible(visible, restart); return super.setVisible(visible, restart); diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index f446000..2e47d3a 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -571,6 +571,15 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } @Override + public void setHotspotBounds(int left, int top, int right, int bottom) { + final ChildDrawable[] array = mLayerState.mChildren; + final int N = mLayerState.mNum; + for (int i = 0; i < N; i++) { + array[i].mDrawable.setHotspotBounds(left, top, right, bottom); + } + } + + @Override public boolean setVisible(boolean visible, boolean restart) { final boolean changed = super.setVisible(visible, restart); final ChildDrawable[] array = mLayerState.mChildren; diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index 6776e66..add3d84 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -460,9 +460,6 @@ public class RippleDrawable extends LayerDrawable { invalidateSelf(); } - /** - * @hide - */ @Override public void setHotspotBounds(int left, int top, int right, int bottom) { mOverrideBounds = true; |