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 AnimationCallback from this drawable.

static IndeterminateDrawable<CircularProgressIndicatorSpec> createCircularDrawable(Context context, CircularProgressIndicatorSpec spec)

Creates an instance of IndeterminateDrawable for CircularProgressIndicator with CircularProgressIndicatorSpec.

static IndeterminateDrawable<LinearProgressIndicatorSpec> createLinearDrawable(Context context, LinearProgressIndicatorSpec spec)

Creates an instance of IndeterminateDrawable for LinearProgressIndicator with LinearProgressIndicatorSpec.

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 AnimationCallback to this drawable.

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 AnimationCallback from this drawable.

Inherited methods

void applyTheme(Resources.Theme arg0)
boolean canApplyTheme()
void clearColorFilter()
final Rect copyBounds()
final void copyBounds(Rect arg0)
static Drawable createFromPath(String arg0)
static Drawable createFromResourceStream(Resources arg0, TypedValue arg1, InputStream arg2, String arg3, BitmapFactory.Options arg4)
static Drawable createFromResourceStream(Resources arg0, TypedValue arg1, InputStream arg2, String arg3)
static Drawable createFromStream(InputStream arg0, String arg1)
static Drawable createFromXml(Resources arg0, XmlPullParser arg1)
static Drawable createFromXml(Resources arg0, XmlPullParser arg1, Resources.Theme arg2)
static Drawable createFromXmlInner(Resources arg0, XmlPullParser arg1, AttributeSet arg2, Resources.Theme arg3)
static Drawable createFromXmlInner(Resources arg0, XmlPullParser arg1, AttributeSet arg2)
abstract void draw(Canvas arg0)
int getAlpha()
final Rect getBounds()
Drawable.Callback getCallback()
int getChangingConfigurations()
ColorFilter getColorFilter()
Drawable.ConstantState getConstantState()
Drawable getCurrent()
Rect getDirtyBounds()
void getHotspotBounds(Rect arg0)
int getIntrinsicHeight()
int getIntrinsicWidth()
int getLayoutDirection()
final int getLevel()
int getMinimumHeight()
int getMinimumWidth()
abstract int getOpacity()
Insets getOpticalInsets()
void getOutline(Outline arg0)
boolean getPadding(Rect arg0)
int[] getState()
Region getTransparentRegion()
boolean hasFocusStateSpecified()
void inflate(Resources arg0, XmlPullParser arg1, AttributeSet arg2, Resources.Theme arg3)
void inflate(Resources arg0, XmlPullParser arg1, AttributeSet arg2)
void invalidateSelf()
boolean isAutoMirrored()
boolean isFilterBitmap()
boolean isProjected()
boolean isStateful()
final boolean isVisible()
void jumpToCurrentState()
Drawable mutate()
void onBoundsChange(Rect arg0)
boolean onLayoutDirectionChanged(int arg0)
boolean onLevelChange(int arg0)
boolean onStateChange(int[] arg0)
static int resolveOpacity(int arg0, int arg1)
void scheduleSelf(Runnable arg0, long arg1)
abstract void setAlpha(int arg0)
void setAutoMirrored(boolean arg0)
void setBounds(int arg0, int arg1, int arg2, int arg3)
void setBounds(Rect arg0)
final void setCallback(Drawable.Callback arg0)
void setChangingConfigurations(int arg0)
void setColorFilter(int arg0, PorterDuff.Mode arg1)
abstract void setColorFilter(ColorFilter arg0)
void setDither(boolean arg0)
void setFilterBitmap(boolean arg0)
void setHotspot(float arg0, float arg1)
void setHotspotBounds(int arg0, int arg1, int arg2, int arg3)
final boolean setLayoutDirection(int arg0)
final boolean setLevel(int arg0)
boolean setState(int[] arg0)
void setTint(int arg0)
void setTintBlendMode(BlendMode arg0)
void setTintList(ColorStateList arg0)
void setTintMode(PorterDuff.Mode arg0)
boolean setVisible(boolean arg0, boolean arg1)
void unscheduleSelf(Runnable arg0)
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait(long arg0, int arg1)
final void wait(long arg0)
final void wait()
abstract void clearAnimationCallbacks()
abstract void registerAnimationCallback(Animatable2Compat.AnimationCallback arg0)
abstract boolean unregisterAnimationCallback(Animatable2Compat.AnimationCallback arg0)
abstract boolean isRunning()
abstract void start()
abstract void stop()

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.

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.

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.

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.