IndeterminateDrawable

public final class IndeterminateDrawable<S extends BaseProgressIndicatorSpec>


This class draws the graphics for indeterminate mode.

Summary

Public methods

void

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>

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
int
int
int
boolean

Hides the drawable immediately without triggering animation callbacks.

boolean
boolean
boolean
void
registerAnimationCallback(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

The drawable will start the main animation without show animator.

void

The drawable will stop the main animation without hide animator.

boolean
unregisterAnimationCallback(AnimationCallback callback)

Unregisters an AnimationCallback from this drawable.

Public methods

clearAnimationCallbacks

public void clearAnimationCallbacks()

Unregisters all AnimationCallback from this drawable.

createCircularDrawable

public static IndeterminateDrawable<CircularProgressIndicatorSpeccreateCircularDrawable(
    Context context,
    CircularProgressIndicatorSpec spec
)

Creates an instance of IndeterminateDrawable for CircularProgressIndicator with CircularProgressIndicatorSpec.

Parameters
Context context

The current context.

CircularProgressIndicatorSpec spec

The spec for the circular indicator.

createLinearDrawable

public static IndeterminateDrawable<LinearProgressIndicatorSpeccreateLinearDrawable(Context context, LinearProgressIndicatorSpec spec)

Creates an instance of IndeterminateDrawable for LinearProgressIndicator with LinearProgressIndicatorSpec.

Parameters
Context context

The current context.

LinearProgressIndicatorSpec spec

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.

getAlpha

public int getAlpha()

getIntrinsicHeight

public int getIntrinsicHeight()

getIntrinsicWidth

public int getIntrinsicWidth()

getOpacity

public int getOpacity()

hideNow

public boolean hideNow()

Hides the drawable immediately without triggering animation callbacks.

isHiding

public boolean isHiding()

isRunning

public boolean isRunning()

isShowing

public boolean isShowing()

registerAnimationCallback

public void registerAnimationCallback(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
AnimationCallback callback

A new AnimationCallback to register.

setAlpha

public void setAlpha(int alpha)

setColorFilter

public void setColorFilter(ColorFilter colorFilter)

setVisible

public boolean setVisible(boolean visible, boolean restart)

setVisible

public boolean setVisible(boolean visible, boolean restart, boolean animate)

Changes the visibility with/without triggering the animation callbacks.

Parameters
boolean visible

Whether to make the drawable visible.

boolean restart

Whether to force starting the animation from the beginning.

boolean animate

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(AnimationCallback callback)

Unregisters an AnimationCallback from this drawable.

Parameters
AnimationCallback callback

AnimationCallback to unregister.

Returns
boolean

true, if callback is successfully registered; false, otherwise.