Skip to content

SwapLoadingRenderer

dinus_developer edited this page Aug 14, 2016 · 7 revisions

Builder class for SwapLoadingRenderer objects. Provides a convenient way to set the various fields of a SwapLoadingRenderer.
Example:

LoadingRenderer loadingRenderer = new SwapLoadingRenderer.Builder(this)
        .setWidth((int) DensityUtil.dip2px(this, 150))
        .setHeight((int) DensityUtil.dip2px(this, 40))
        .setBallRadius((int) DensityUtil.dip2px(this, 10))
        .setBallInterval((int) DensityUtil.dip2px(this, 3))
        .setStrokeWidth((int) DensityUtil.dip2px(this, 1))
        .setColor(Color.CYAN)
        .setDuration(4000)
        .setBallCount(3)
        .build();

setWidth

public Builder setWidth(int width)

Sets the width in px of the LoadingDrawable which apply this LoadingRenderer.

setHeight

public Builder setHeight(int height)

Sets the height in px of the LoadingDrawable which apply this LoadingRenderer.

setDuration

public Builder setDuration(int duration)

The length of the animation, in milliseconds. If this value is negative or zero will be ignored.

setStrokeWidth

public Builder setStrokeWidth(int strokeWidth)

Sets the stroke width in px of these hollow rings. If this value is negative or zero will be ignored.

setBallRadius

public Builder setBallRadius(int ballRadius)

Sets the radius in px of these balls. If this value is negative or zero will be ignored.

setBallInterval

public Builder setBallInterval(int ballInterval)

Sets the distance in px of between these balls. If this value is negative or zero will be ignored.

setBallCount

public Builder setBallCount(int ballCount)

Sets the count of these balls. If this value is negative or zero will be ignored.

setColor

public Builder setColor(int color)

Sets the color of these balls. If this value is zero will be ignored.