Merge "Make Drawable hotspot APIs public"

This commit is contained in:
Alan Viverette
2014-04-08 23:38:22 +00:00
committed by Android (Google) Code Review
7 changed files with 17 additions and 69 deletions

View File

@@ -10662,6 +10662,7 @@ package android.graphics.drawable {
method public void applyTheme(android.content.res.Resources.Theme); method public void applyTheme(android.content.res.Resources.Theme);
method public boolean canApplyTheme(); method public boolean canApplyTheme();
method public void clearColorFilter(); method public void clearColorFilter();
method public void clearHotspots();
method public final void copyBounds(android.graphics.Rect); method public final void copyBounds(android.graphics.Rect);
method public final android.graphics.Rect copyBounds(); method public final android.graphics.Rect copyBounds();
method public static android.graphics.drawable.Drawable createFromPath(java.lang.String); method public static android.graphics.drawable.Drawable createFromPath(java.lang.String);
@@ -10704,6 +10705,7 @@ package android.graphics.drawable {
method protected void onBoundsChange(android.graphics.Rect); method protected void onBoundsChange(android.graphics.Rect);
method protected boolean onLevelChange(int); method protected boolean onLevelChange(int);
method protected boolean onStateChange(int[]); method protected boolean onStateChange(int[]);
method public void removeHotspot(int);
method public static int resolveOpacity(int, int); method public static int resolveOpacity(int, int);
method public void scheduleSelf(java.lang.Runnable, long); method public void scheduleSelf(java.lang.Runnable, long);
method public abstract void setAlpha(int); method public abstract void setAlpha(int);
@@ -10716,9 +10718,11 @@ package android.graphics.drawable {
method public void setColorFilter(int, android.graphics.PorterDuff.Mode); method public void setColorFilter(int, android.graphics.PorterDuff.Mode);
method public void setDither(boolean); method public void setDither(boolean);
method public void setFilterBitmap(boolean); method public void setFilterBitmap(boolean);
method public void setHotspot(int, float, float);
method public final boolean setLevel(int); method public final boolean setLevel(int);
method public boolean setState(int[]); method public boolean setState(int[]);
method public boolean setVisible(boolean, boolean); method public boolean setVisible(boolean, boolean);
method public boolean supportsHotspots();
method public void unscheduleSelf(java.lang.Runnable); method public void unscheduleSelf(java.lang.Runnable);
} }

View File

@@ -485,14 +485,13 @@ public abstract class Drawable {
/** /**
* Indicates whether the drawable supports hotspots. Hotspots are uniquely * Indicates whether the drawable supports hotspots. Hotspots are uniquely
* identifiable coordinates the may be added, updated and removed within the * identifiable coordinates the may be added, updated and removed within a
* drawable. * drawable.
* *
* @return true if hotspots are supported * @return true if hotspots are supported
* @see #setHotspot(int, float, float) * @see #setHotspot(int, float, float)
* @see #removeHotspot(int) * @see #removeHotspot(int)
* @see #clearHotspots() * @see #clearHotspots()
* @hide until hotspot APIs are finalized
*/ */
public boolean supportsHotspots() { public boolean supportsHotspots() {
return false; return false;
@@ -500,33 +499,33 @@ public abstract class Drawable {
/** /**
* Specifies a hotspot's location within the drawable. * Specifies a hotspot's location within the drawable.
* <p>
* The specified key should be an id declared in the resources of the
* application to ensure it is unique (see the <a
* href={@docRoot}guide/topics/resources/more-resources.html#Id">ID resource type</a>).
* *
* @param id unique identifier for the hotspot * @param key The key identifying the hotspot
* @param x x-coordinate * @param x The X coordinate of the center of the hotspot
* @param y y-coordinate * @param y The Y coordinate of the center of the hotspot
* @hide until hotspot APIs are finalized
*/ */
public void setHotspot(int id, float x, float y) {} public void setHotspot(int key, float x, float y) {}
/** /**
* Removes the specified hotspot from the drawable. * Removes the hotspot with the specified key from the drawable.
* *
* @param id unique identifier for the hotspot * @param key The key identifying the hotspot
* @hide until hotspot APIs are finalized
*/ */
public void removeHotspot(int id) {} public void removeHotspot(int key) {}
/** /**
* Removes all hotspots from the drawable. * Removes all hotspots from the drawable.
*
* @hide until hotspot APIs are finalized
*/ */
public void clearHotspots() {} public void clearHotspots() {}
/** /**
* Whether this drawable requests projection. * Whether this drawable requests projection.
* *
* @hide * @hide until we finalize these APIs
*/ */
public boolean isProjected() { public boolean isProjected() {
return false; return false;

View File

@@ -118,33 +118,21 @@ public class DrawableWrapper extends Drawable implements Drawable.Callback {
return mWrappedDrawable.getDirtyBounds(); return mWrappedDrawable.getDirtyBounds();
} }
/**
* @hide
*/
@Override @Override
public boolean supportsHotspots() { public boolean supportsHotspots() {
return mWrappedDrawable.supportsHotspots(); return mWrappedDrawable.supportsHotspots();
} }
/**
* @hide
*/
@Override @Override
public void setHotspot(int id, float x, float y) { public void setHotspot(int id, float x, float y) {
mWrappedDrawable.setHotspot(id, x, y); mWrappedDrawable.setHotspot(id, x, y);
} }
/**
* @hide
*/
@Override @Override
public void removeHotspot(int id) { public void removeHotspot(int id) {
mWrappedDrawable.removeHotspot(id); mWrappedDrawable.removeHotspot(id);
} }
/**
* @hide
*/
@Override @Override
public void clearHotspots() { public void clearHotspots() {
mWrappedDrawable.clearHotspots(); mWrappedDrawable.clearHotspots();

View File

@@ -183,33 +183,21 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
} }
} }
/**
* @hide
*/
@Override @Override
public boolean supportsHotspots() { public boolean supportsHotspots() {
return mInsetState.mDrawable.supportsHotspots(); return mInsetState.mDrawable.supportsHotspots();
} }
/**
* @hide
*/
@Override @Override
public void setHotspot(int id, float x, float y) { public void setHotspot(int id, float x, float y) {
mInsetState.mDrawable.setHotspot(id, x, y); mInsetState.mDrawable.setHotspot(id, x, y);
} }
/**
* @hide
*/
@Override @Override
public void removeHotspot(int id) { public void removeHotspot(int id) {
mInsetState.mDrawable.removeHotspot(id); mInsetState.mDrawable.removeHotspot(id);
} }
/**
* @hide
*/
@Override @Override
public void clearHotspots() { public void clearHotspots() {
mInsetState.mDrawable.clearHotspots(); mInsetState.mDrawable.clearHotspots();

View File

@@ -548,9 +548,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
} }
} }
/**
* @hide
*/
@Override @Override
public boolean supportsHotspots() { public boolean supportsHotspots() {
final ChildDrawable[] array = mLayerState.mChildren; final ChildDrawable[] array = mLayerState.mChildren;
@@ -564,9 +561,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
return false; return false;
} }
/**
* @hide
*/
@Override @Override
public void setHotspot(int id, float x, float y) { public void setHotspot(int id, float x, float y) {
final ChildDrawable[] array = mLayerState.mChildren; final ChildDrawable[] array = mLayerState.mChildren;
@@ -576,9 +570,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
} }
} }
/**
* @hide
*/
@Override @Override
public void removeHotspot(int id) { public void removeHotspot(int id) {
final ChildDrawable[] array = mLayerState.mChildren; final ChildDrawable[] array = mLayerState.mChildren;
@@ -588,9 +579,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
} }
} }
/**
* @hide
*/
@Override @Override
public void clearHotspots() { public void clearHotspots() {
final ChildDrawable[] array = mLayerState.mChildren; final ChildDrawable[] array = mLayerState.mChildren;

View File

@@ -217,20 +217,11 @@ public class TouchFeedbackDrawable extends LayerDrawable {
return super.canApplyTheme() || mState != null && mState.mTouchThemeAttrs != null; return super.canApplyTheme() || mState != null && mState.mTouchThemeAttrs != null;
} }
/**
* @hide until hotspot APIs are finalized
*/
@Override @Override
public boolean supportsHotspots() { public boolean supportsHotspots() {
return true; return true;
} }
/**
* TODO: Maybe we should set hotspots for state/id combinations? So touch
* would be state_pressed and the pointer ID.
*
* @hide until hotspot APIs are finalized
*/
@Override @Override
public void setHotspot(int id, float x, float y) { public void setHotspot(int id, float x, float y) {
if (mTouchedRipples == null) { if (mTouchedRipples == null) {
@@ -261,9 +252,6 @@ public class TouchFeedbackDrawable extends LayerDrawable {
scheduleAnimation(); scheduleAnimation();
} }
/**
* @hide until hotspot APIs are finalized
*/
@Override @Override
public void removeHotspot(int id) { public void removeHotspot(int id) {
if (mTouchedRipples == null) { if (mTouchedRipples == null) {
@@ -279,9 +267,6 @@ public class TouchFeedbackDrawable extends LayerDrawable {
} }
} }
/**
* @hide until hotspot APIs are finalized
*/
@Override @Override
public void clearHotspots() { public void clearHotspots() {
if (mTouchedRipples == null) { if (mTouchedRipples == null) {

View File

@@ -322,10 +322,6 @@ public class VectorDrawable extends Drawable {
} }
} }
/**
* Not implemented yet
* @hide
*/
@Override @Override
public void setColorFilter(ColorFilter colorFilter) { public void setColorFilter(ColorFilter colorFilter) {
// TODO: support color filter // TODO: support color filter