# IndeterminateDrawable

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/progressindicator/IndeterminateDrawable.java)

*** ** * ** ***


```
public final class IndeterminateDrawable<S extends BaseProgressIndicatorSpec>
```

<br />

*** ** * ** ***

This class draws the graphics for indeterminate mode.

## Summary

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#clearAnimationCallbacks()()` Unregisters all `AnimationCallback` from this drawable. |
| `static https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable<https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicatorSpec>` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#createCircularDrawable(Context,com.google.android.material.progressindicator.CircularProgressIndicatorSpec)( Context context, https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicatorSpec spec )` Creates an instance of `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable` for `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator` with `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicatorSpec`. |
| `static https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable<https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicatorSpec>` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#createLinearDrawable(Context,com.google.android.material.progressindicator.LinearProgressIndicatorSpec)(Context context, https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicatorSpec spec)` Creates an instance of `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable` for `https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicator` with `https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicatorSpec`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#draw(Canvas)(Canvas canvas)` Draws the graphics based on the progress indicator's properties and the animation states. |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#getAlpha()()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#getIntrinsicHeight()()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#getIntrinsicWidth()()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#getOpacity()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#hideNow()()` Hides the drawable immediately without triggering animation callbacks. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#isHiding()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#isRunning()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#isShowing()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#registerAnimationCallback(AnimationCallback)(AnimationCallback callback)` Registers a new `AnimationCallback` to this drawable. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#setAlpha(int)(int alpha)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#setColorFilter(ColorFilter)(ColorFilter colorFilter)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#setVisible(boolean,boolean)(boolean visible, boolean restart)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#setVisible(boolean,boolean,boolean)(boolean visible, boolean restart, boolean animate)` Changes the visibility with/without triggering the animation callbacks. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#start()()` The drawable will start the main animation without show animator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#stop()()` The drawable will stop the main animation without hide animator. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable#unregisterAnimationCallback(AnimationCallback)(AnimationCallback callback)` Unregisters an `AnimationCallback` from this drawable. |

## 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 `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable` for `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator` with `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicatorSpec`.

| Parameters |
|---|---|
| `Context context` | The current context. |
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicatorSpec spec` | The spec for the circular indicator. |

### createLinearDrawable

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

Creates an instance of `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable` for `https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicator` with `https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicatorSpec`.

| Parameters |
|---|---|
| `Context context` | The current context. |
| `https://developer.android.com/reference/com/google/android/material/progressindicator/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. |

| See also |
|---|---|
| `https://developer.android.com/reference/AnimationCallback#onAnimationStart(Drawable)` |   |
| `https://developer.android.com/reference/AnimationCallback#onAnimationEnd(Drawable)` |   |

### 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. |