IndeterminateDrawable
public
final
class
IndeterminateDrawable
extends Drawable
implements
Animatable2Compat
java.lang.Object | ||
↳ | android.graphics.drawable.Drawable | |
↳ | com.google.android.material.progressindicator.IndeterminateDrawable<S extends com.google.android.material.progressindicator.BaseProgressIndicatorSpec> |
This class draws the graphics for indeterminate mode.
Summary
Public methods | |
---|---|
void
|
clearAnimationCallbacks()
Unregisters all |
static
IndeterminateDrawable<CircularProgressIndicatorSpec>
|
createCircularDrawable(Context context, CircularProgressIndicatorSpec spec)
Creates an instance of |
static
IndeterminateDrawable<LinearProgressIndicatorSpec>
|
createLinearDrawable(Context context, LinearProgressIndicatorSpec spec)
Creates an instance of |
void
|
draw(Canvas canvas)
Draws the graphics based on the progress indicator's properties and the animation states. |
int
|
getAlpha()
|
int
|
getIntrinsicHeight()
|
int
|
getIntrinsicWidth()
|
int
|
getOpacity()
|
boolean
|
hideNow()
Hides the drawable immediately without triggering animation callbacks. |
boolean
|
isHiding()
|
boolean
|
isRunning()
|
boolean
|
isShowing()
|
void
|
registerAnimationCallback(Animatable2Compat.AnimationCallback callback)
Registers a new |
void
|
setAlpha(int alpha)
|
void
|
setColorFilter(ColorFilter colorFilter)
|
boolean
|
setVisible(boolean visible, boolean restart)
|
boolean
|
setVisible(boolean visible, boolean restart, boolean animate)
Changes the visibility with/without triggering the animation callbacks. |
void
|
start()
The drawable will start the main animation without show animator. |
void
|
stop()
The drawable will stop the main animation without hide animator. |
boolean
|
unregisterAnimationCallback(Animatable2Compat.AnimationCallback callback)
Unregisters an |
Inherited methods | |
---|---|
Public methods
clearAnimationCallbacks
public void clearAnimationCallbacks ()
Unregisters all AnimationCallback
from this drawable.
createCircularDrawable
public static IndeterminateDrawable<CircularProgressIndicatorSpec> createCircularDrawable (Context context, CircularProgressIndicatorSpec spec)
Creates an instance of IndeterminateDrawable
for CircularProgressIndicator
with
CircularProgressIndicatorSpec
.
Parameters | |
---|---|
context |
Context : The current context. |
spec |
CircularProgressIndicatorSpec : The spec for the circular indicator.
|
Returns | |
---|---|
IndeterminateDrawable<CircularProgressIndicatorSpec> |
createLinearDrawable
public static IndeterminateDrawable<LinearProgressIndicatorSpec> createLinearDrawable (Context context, LinearProgressIndicatorSpec spec)
Creates an instance of IndeterminateDrawable
for LinearProgressIndicator
with
LinearProgressIndicatorSpec
.
Parameters | |
---|---|
context |
Context : The current context. |
spec |
LinearProgressIndicatorSpec : The spec for the linear indicator.
|
Returns | |
---|---|
IndeterminateDrawable<LinearProgressIndicatorSpec> |
draw
public void draw (Canvas canvas)
Draws the graphics based on the progress indicator's properties and the animation states.
Parameters | |
---|---|
canvas |
Canvas |
getAlpha
public int getAlpha ()
Returns | |
---|---|
int |
getIntrinsicHeight
public int getIntrinsicHeight ()
Returns | |
---|---|
int |
getIntrinsicWidth
public int getIntrinsicWidth ()
Returns | |
---|---|
int |
getOpacity
public int getOpacity ()
Returns | |
---|---|
int |
hideNow
public boolean hideNow ()
Hides the drawable immediately without triggering animation callbacks.
Returns | |
---|---|
boolean |
isHiding
public boolean isHiding ()
Returns | |
---|---|
boolean |
isRunning
public boolean isRunning ()
Returns | |
---|---|
boolean |
isShowing
public boolean isShowing ()
Returns | |
---|---|
boolean |
registerAnimationCallback
public void registerAnimationCallback (Animatable2Compat.AnimationCallback callback)
Registers a new AnimationCallback
to this drawable. The onAnimationStart()
will
be called at the start of show animation, or at the moment this drawable is shown, if there's
no show animation is used. The onAnimationEnd()
will be called at the end of the hide
animation, or at the moment this drawable is hidden, if there's no hide animation is used.
Parameters | |
---|---|
callback |
Animatable2Compat.AnimationCallback : A new AnimationCallback to register. |
setAlpha
public void setAlpha (int alpha)
Parameters | |
---|---|
alpha |
int |
setColorFilter
public void setColorFilter (ColorFilter colorFilter)
Parameters | |
---|---|
colorFilter |
ColorFilter |
setVisible
public boolean setVisible (boolean visible, boolean restart)
Parameters | |
---|---|
visible |
boolean |
restart |
boolean |
Returns | |
---|---|
boolean |
setVisible
public boolean setVisible (boolean visible, boolean restart, boolean animate)
Changes the visibility with/without triggering the animation callbacks.
Parameters | |
---|---|
visible |
boolean : Whether to make the drawable visible. |
restart |
boolean : Whether to force starting the animation from the beginning. |
animate |
boolean : Whether to change the visibility with animation. |
Returns | |
---|---|
boolean |
true , if the visibility changes or will change after the animation; false , otherwise. |
See also:
start
public void start ()
The drawable will start the main animation without show animator.
stop
public void stop ()
The drawable will stop the main animation without hide animator.
unregisterAnimationCallback
public boolean unregisterAnimationCallback (Animatable2Compat.AnimationCallback callback)
Unregisters an AnimationCallback
from this drawable.
Parameters | |
---|---|
callback |
Animatable2Compat.AnimationCallback : AnimationCallback to unregister. |
Returns | |
---|---|
boolean |
true , if callback is successfully registered; false , otherwise.
|