public class AnimatedRotateDrawable extends Drawable implements Drawable.Callback, Runnable, Animatable
Drawable.Callback, Drawable.ConstantState
Constructor and Description |
---|
AnimatedRotateDrawable() |
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such
as alpha (set via setAlpha) and color filter (set via setColorFilter).
|
int |
getChangingConfigurations()
Return a mask of the configuration parameters for which this drawable
may change, requiring that it be re-created.
|
Drawable.ConstantState |
getConstantState()
Return a
Drawable.ConstantState instance that holds the shared state of this Drawable. |
Drawable |
getDrawable()
Returns the drawable rotated by this RotateDrawable.
|
int |
getIntrinsicHeight()
Return the intrinsic height of the underlying drawable object.
|
int |
getIntrinsicWidth()
Return the intrinsic width of the underlying drawable object.
|
int |
getOpacity()
Return the opacity/transparency of this Drawable.
|
boolean |
getPadding(Rect padding)
Return in padding the insets suggested by this Drawable for placing
content inside the drawable's bounds.
|
void |
inflate(Resources r,
XmlPullParser parser,
AttributeSet attrs)
Inflate this Drawable from an XML resource.
|
void |
invalidateDrawable(Drawable who)
Called when the drawable needs to be redrawn.
|
boolean |
isRunning()
Indicates whether the animation is running.
|
boolean |
isStateful()
Indicates whether this view will change its appearance based on state.
|
Drawable |
mutate()
Make this drawable mutable.
|
protected void |
onBoundsChange(Rect bounds)
Override this in your subclass to change appearance if you recognize the
specified state.
|
void |
run()
Starts executing the active part of the class' code.
|
void |
scheduleDrawable(Drawable who,
Runnable what,
long when)
A Drawable can call this to schedule the next frame of its
animation.
|
void |
setAlpha(int alpha)
Specify an alpha value for the drawable.
|
void |
setColorFilter(ColorFilter cf)
Specify an optional colorFilter for the drawable.
|
void |
setFramesCount(int framesCount) |
void |
setFramesDuration(int framesDuration) |
boolean |
setVisible(boolean visible,
boolean restart)
Set whether this Drawable is visible.
|
void |
start()
Starts the drawable's animation.
|
void |
stop()
Stops the drawable's animation.
|
void |
unscheduleDrawable(Drawable who,
Runnable what)
A Drawable can call this to unschedule an action previously
scheduled with
Drawable.Callback.scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long) . |
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getBounds, getCallback, getCurrent, getLayoutDirection, getLayoutInsets, getLevel, getMinimumHeight, getMinimumWidth, getState, getTransparentRegion, invalidateSelf, isVisible, jumpToCurrentState, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setLayoutDirection, setLevel, setState, unscheduleSelf
public void draw(Canvas canvas)
Drawable
public void start()
Animatable
start
in interface Animatable
public void stop()
Animatable
stop
in interface Animatable
public boolean isRunning()
Animatable
isRunning
in interface Animatable
public void run()
Runnable
Runnable
.public boolean setVisible(boolean visible, boolean restart)
Drawable
setVisible
in class Drawable
visible
- Set to true if visible, false if not.restart
- You can supply true here to force the drawable to behave
as if it has just become visible, even if it had last
been set visible. Used for example to force animations
to restart.public Drawable getDrawable()
public int getChangingConfigurations()
Drawable
Drawable.setChangingConfigurations(int)
or 0 by default. Subclasses
may extend this to or in the changing configurations of any other
drawables they hold.getChangingConfigurations
in class Drawable
Configuration
.Configuration
public void setAlpha(int alpha)
Drawable
public void setColorFilter(ColorFilter cf)
Drawable
setColorFilter
in class Drawable
public int getOpacity()
Drawable
PixelFormat
:
PixelFormat.UNKNOWN
,
PixelFormat.TRANSLUCENT
,
PixelFormat.TRANSPARENT
, or
PixelFormat.OPAQUE
.
Generally a Drawable should be as conservative as possible with the
value it returns. For example, if it contains multiple child drawables
and only shows one of them at a time, if only one of the children is
TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be
returned. You can use the method Drawable.resolveOpacity(int, int)
to perform a
standard reduction of two opacities to the appropriate single output.
Note that the returned value does not take into account a
custom alpha or color filter that has been applied by the client through
the Drawable.setAlpha(int)
or Drawable.setColorFilter(android.graphics.ColorFilter)
methods.
getOpacity
in class Drawable
PixelFormat
public void invalidateDrawable(Drawable who)
Drawable.Callback
invalidateDrawable
in interface Drawable.Callback
who
- The drawable that is requesting the update.public void scheduleDrawable(Drawable who, Runnable what, long when)
Drawable.Callback
Handler.postAtTime(Runnable, Object, long)
with
the parameters (what, who, when) to perform the
scheduling.scheduleDrawable
in interface Drawable.Callback
who
- The drawable being scheduled.what
- The action to execute.when
- The time (in milliseconds) to run. The timebase is
SystemClock.uptimeMillis()
public void unscheduleDrawable(Drawable who, Runnable what)
Drawable.Callback
Drawable.Callback.scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long)
. An implementation can
generally simply call
Handler.removeCallbacks(Runnable, Object)
with
the parameters (what, who) to unschedule the drawable.unscheduleDrawable
in interface Drawable.Callback
who
- The drawable being unscheduled.what
- The action being unscheduled.public boolean getPadding(Rect padding)
Drawable
getPadding
in class Drawable
public boolean isStateful()
Drawable
isStateful
in class Drawable
Drawable.setState(int[])
protected void onBoundsChange(Rect bounds)
Drawable
onBoundsChange
in class Drawable
public int getIntrinsicWidth()
Drawable
getIntrinsicWidth
in class Drawable
public int getIntrinsicHeight()
Drawable
getIntrinsicHeight
in class Drawable
public Drawable.ConstantState getConstantState()
Drawable
Drawable.ConstantState
instance that holds the shared state of this Drawable.
qgetConstantState
in class Drawable
Drawable.ConstantState
,
Drawable.mutate()
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException
Drawable
inflate
in class Drawable
XmlPullParserException
IOException
public void setFramesCount(int framesCount)
public void setFramesDuration(int framesDuration)
public Drawable mutate()
Drawable
mutate
in class Drawable
Drawable.ConstantState
,
Drawable.getConstantState()