BaseProgressIndicatorSpec

public abstract class BaseProgressIndicatorSpec

Known direct subclasses
CircularProgressIndicatorSpec

This class contains the parameters for drawing a circular type progress indicator.

LinearProgressIndicatorSpec

This class contains the parameters for drawing a linear type progress indicator.


This class contains the parameters shared between linear type and circular type. The parameters reflect the attributes defined in R.styleable.BaseProgressIndicator.

Summary

Public fields

int

The animation behavior to hide the indicator and track.

float

The scale of the animation duration in indeterminate mode.

int[]

The color array used in the indicator.

int

The size of the gap between the indicator and the rest of the track.

int

The animation behavior to show the indicator and track.

int

The color used in the track.

int

When this is greater than 0, the corners of both the track and the indicator will be rounded with this radius.

float

The fraction of the track thickness to be used as the corner radius.

int

The thickness of the track and indicator.

boolean

When this is true, the {#link trackCornerRadiusFraction} takes effect.

int

The size of the amplitude, if a wave effect is configured.

int

The speed of the waveform, if a wave effect is configured.

int

The size of the wavelength in determinate mode, if a wave effect is configured.

int

The size of the wavelength in indeterminate mode, if a wave effect is configured.

Protected constructors

BaseProgressIndicatorSpec(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)

Instantiates BaseProgressIndicatorSpec.

Public methods

int

Returns the track corner radius in pixels.

boolean
hasWavyEffect(boolean isDeterminate)
boolean
boolean
boolean

Returns true if the stroke ROUND cap should be used to prevent artifacts like (b/319309456), when fully rounded corners are specified.

Public fields

hideAnimationBehavior

public int hideAnimationBehavior

The animation behavior to hide the indicator and track.

indeterminateAnimatorDurationScale

public float indeterminateAnimatorDurationScale

The scale of the animation duration in indeterminate mode.

indicatorColors

public int[] indicatorColors

The color array used in the indicator. In determinate mode, only the first item will be used.

indicatorTrackGapSize

public int indicatorTrackGapSize

The size of the gap between the indicator and the rest of the track.

showAnimationBehavior

public int showAnimationBehavior

The animation behavior to show the indicator and track.

trackColor

public int trackColor

The color used in the track. If not defined, it will be set to the indicatorColors and apply the first disable alpha value from the theme.

trackCornerRadius

public int trackCornerRadius

When this is greater than 0, the corners of both the track and the indicator will be rounded with this radius. If the radius is greater than half of the track width, an IllegalArgumentException will be thrown during initialization.

trackCornerRadiusFraction

public float trackCornerRadiusFraction

The fraction of the track thickness to be used as the corner radius. And the stroke ROUND cap is used to prevent artifacts like (b/319309456), when 0.5f is specified.

trackThickness

public int trackThickness

The thickness of the track and indicator.

useRelativeTrackCornerRadius

public boolean useRelativeTrackCornerRadius

When this is true, the {#link trackCornerRadiusFraction} takes effect. Otherwise, the takes effect.

waveAmplitude

public int waveAmplitude

The size of the amplitude, if a wave effect is configured.

waveSpeed

public int waveSpeed

The speed of the waveform, if a wave effect is configured.

wavelengthDeterminate

public int wavelengthDeterminate

The size of the wavelength in determinate mode, if a wave effect is configured.

wavelengthIndeterminate

public int wavelengthIndeterminate

The size of the wavelength in indeterminate mode, if a wave effect is configured.

Protected constructors

BaseProgressIndicatorSpec

protected BaseProgressIndicatorSpec(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)

Instantiates BaseProgressIndicatorSpec.

If attributes are missing, the values defined in the default style Widget_MaterialComponents_ProgressIndicator will be loaded.

Parameters
Context context

Current themed context.

AttributeSet attrs

Component's attributes set.

Public methods

getTrackCornerRadiusInPx

public int getTrackCornerRadiusInPx()

Returns the track corner radius in pixels.

If useRelativeTrackCornerRadius is true, the track corner radius is calculated using the track thickness and the track corner radius fraction. Otherwise, the track corner radius is returned directly.

hasWavyEffect

public boolean hasWavyEffect(boolean isDeterminate)

isHideAnimationEnabled

public boolean isHideAnimationEnabled()

isShowAnimationEnabled

public boolean isShowAnimationEnabled()

useStrokeCap

public boolean useStrokeCap()

Returns true if the stroke ROUND cap should be used to prevent artifacts like (b/319309456), when fully rounded corners are specified.