Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-budiyev committed May 1, 2018
1 parent cb95cdd commit 6ed5a78
Showing 1 changed file with 96 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/**
* Circular progress bar
*/
public class CircularProgressBar extends View {
public final class CircularProgressBar extends View {
private static final float DEFAULT_SIZE_DP = 48f;
private static final float DEFAULT_MAXIMUM = 100f;
private static final float DEFAULT_PROGRESS = 0f;
Expand Down Expand Up @@ -168,6 +168,14 @@ public void setMaximum(final float maximum) {
invalidate();
}

/**
* Start angle for non-indeterminate mode, between -360 and 360 degrees
*/
@FloatRange(from = -360f, to = 360f)
public float getStartAngle() {
return mStartAngle;
}

/**
* Start angle for non-indeterminate mode, between -360 and 360 degrees
*/
Expand All @@ -177,13 +185,28 @@ public void setStartAngle(@FloatRange(from = -360f, to = 360f) final float angle
invalidate();
}

/**
* Whether to animate progress for non-indeterminate mode
*/
public boolean isAnimateProgress() {
return mAnimateProgress;
}

/**
* Whether to animate progress for non-indeterminate mode
*/
public void setAnimateProgress(final boolean animate) {
mAnimateProgress = animate;
}

/**
* Progress animation duration for non-indeterminate mode (in milliseconds)
*/
@IntRange(from = 0)
public long getProgressAnimationDuration() {
return mProgressAnimator.getDuration();
}

/**
* Progress animation duration for non-indeterminate mode (in milliseconds)
*/
Expand All @@ -197,6 +220,14 @@ public void setProgressAnimationDuration(@IntRange(from = 0) final long duration
mProgressAnimator.setDuration(duration);
}

/**
* Minimum angle for indeterminate mode, between 0 and 180 degrees
*/
@FloatRange(from = 0f, to = 180f)
public float getIndeterminateMinimumAngle() {
return mIndeterminateMinimumAngle;
}

/**
* Minimum angle for indeterminate mode, between 0 and 180 degrees
*/
Expand All @@ -211,6 +242,14 @@ public void setIndeterminateMinimumAngle(@FloatRange(from = 0f, to = 180f) final
}
}

/**
* Rotation animation duration for indeterminate mode (in milliseconds)
*/
@IntRange(from = 0)
public long getIndeterminateRotationAnimationDuration() {
return mIndeterminateStartAnimator.getDuration();
}

/**
* Rotation animation duration for indeterminate mode (in milliseconds)
*/
Expand All @@ -224,6 +263,14 @@ public void setIndeterminateRotationAnimationDuration(@IntRange(from = 0) final
}
}

/**
* Sweep animation duration for indeterminate mode (in milliseconds)
*/
@IntRange(from = 0)
public long getIndeterminateSweepAnimationDuration() {
return mIndeterminateSweepAnimator.getDuration();
}

/**
* Sweep animation duration for indeterminate mode (in milliseconds)
*/
Expand All @@ -237,6 +284,14 @@ public void setIndeterminateSweepAnimationDuration(@IntRange(from = 0) final lon
}
}

/**
* Foreground stroke cap
*/
@NonNull
public Paint.Cap getForegroundStrokeCap() {
return mBackgroundStrokePaint.getStrokeCap();
}

/**
* Foreground stroke cap
*/
Expand All @@ -246,6 +301,14 @@ public void setForegroundStrokeCap(@NonNull final Paint.Cap cap) {
invalidate();
}

/**
* Foreground stroke color
*/
@ColorInt
public int getForegroundStrokeColor() {
return mForegroundStrokePaint.getColor();
}

/**
* Foreground stroke color
*/
Expand All @@ -254,6 +317,14 @@ public void setForegroundStrokeColor(@ColorInt final int color) {
invalidate();
}

/**
* Foreground stroke width (in pixels)
*/
@FloatRange(from = 0f, to = Float.MAX_VALUE)
public float getForegroundStrokeWidth() {
return mForegroundStrokePaint.getStrokeWidth();
}

/**
* Foreground stroke width (in pixels)
*/
Expand All @@ -264,14 +335,30 @@ public void setForegroundStrokeWidth(@FloatRange(from = 0f, to = Float.MAX_VALUE
invalidate();
}

/**
* Background stroke color
*/
@ColorInt
public int getBackgroundStrokeColor() {
return mBackgroundStrokePaint.getColor();
}

/**
* Background stroke color
*/
public void setBackgroundStrokeColor(@ColorInt final int color) {
mForegroundStrokePaint.setColor(color);
mBackgroundStrokePaint.setColor(color);
invalidate();
}

/**
* Background stroke width (in pixels)
*/
@FloatRange(from = 0f, to = Float.MAX_VALUE)
public float getBackgroundStrokeWidth() {
return mBackgroundStrokePaint.getStrokeWidth();
}

/**
* Background stroke width (in pixels)
*/
Expand All @@ -282,6 +369,13 @@ public void setBackgroundStrokeWidth(@FloatRange(from = 0f, to = Float.MAX_VALUE
invalidate();
}

/**
* Whether to draw background stroke
*/
public boolean isDrawBackgroundStroke() {
return mDrawBackgroundStroke;
}

/**
* Whether to draw background stroke
*/
Expand Down

0 comments on commit 6ed5a78

Please sign in to comment.