Skip to content

LevelLoadingRenderer

dinus_developer edited this page Aug 4, 2016 · 8 revisions

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

LoadingRenderer loadingRenderer = new LevelLoadingRenderer.Builder(this)
        .setWidth((int) DensityUtil.dip2px(this, 50))
        .setHeight((int) DensityUtil.dip2px(this, 50))
        .setCenterRadius((int) DensityUtil.dip2px(this, 10))
        .setStrokeWidth((int) DensityUtil.dip2px(this, 4))
        .setLevelColors(new int[]{Color.GRAY, Color.RED, Color.GREEN})
        .setLevelColor(Color.GREEN)
        .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.

setStrokeWidth

public Builder setStrokeWidth(int strokeWidth)

Sets the stroke width of the progress spinner in pixels.

setCenterRadius

public Builder setCenterRadius(int centerRadius)

Sets the inner radius in px of the circle the progress spinner arc traces.

setDuration

public Builder setDuration(int duration)

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

setLevelColors

public Builder setLevelColors(int[] colors)

Sets the colors the progress spinner levels between, @param colors must be an array of three integers.

setLevelColor

public Builder setLevelColor(int color)

Sets the colors the progress spinner levels between. @param color will be spilt into an array of three integers by its transparency were changed to the original 1/3, 2/3 and 3/3, and then call the method setLevelColors(int[] colors).