-
Notifications
You must be signed in to change notification settings - Fork 634
CollisionLoadingRenderer
Builder class for CollisionLoadingRenderer objects. Provides a convenient way to set the various fields of a CollisionLoadingRenderer.
Example:
LoadingRenderer loadingRenderer = new CollisionLoadingRenderer.Builder(this)
.setWidth((int) DensityUtil.dip2px(this, 150))
.setHeight((int) DensityUtil.dip2px(this, 40))
.setColors(new int[] {Color.GRAY, Color.CYAN})
.setBallRadius((int) DensityUtil.dip2px(this, 10))
.setBallMoveXOffsets((int) DensityUtil.dip2px(this, 20))
.setBallQuadCoefficient(0.04f)
.setBallCount(5)
.setDuration(4000)
.build();public Builder setWidth(int width)
Sets the width in px of the LoadingDrawable which apply this LoadingRenderer.
public Builder setHeight(int height)
Sets the height in px of the LoadingDrawable which apply this LoadingRenderer.
public Builder setDuration(int duration)
The length of the animation, in milliseconds. If this value is negative or zero will be ignored.
public Builder setOvalVerticalRadius(int ballRadius)
Sets the radius of the bottom oval in the vertical direction. Besides, in the horizontal direction, the radius of the bottom oval always equals the radius of the ball. If this value is negative or zero will be ignored.
public Builder setBallMoveXOffsets(int ballMoveXOffsets)
The animation parabola of the both side ball is y = ax^2, this value represents the maximum value of the x-axis direction. If this value is negative or zero will be ignored.
public Builder setBallQuadCoefficient(int ballQuadCoefficient)
The animation parabola of the both side ball is y = ax^2, this value represents the quadratic coefficient a. If this value is negative or zero will be ignored.
public Builder setBallCount(int ballCount)
Sets the count of these balls. if this value is negative or zero will be ignored.
public Builder setColors(int[] colors)
Sets the colors these balls gradient between, @param colors must be an array of two integers. if this value is null will be ignored.