diff options
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; |