Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Features:
* `app:progress="50"` - Current progress value
* `app:backgroundRingSize="20dp"` - Set the size of the background ring (not set, means use the same as the <i>progressRingSize</i>)
* `app:progressRingSize="20dp"` - Set the size of the progress ring
* `app:startAngel="90"` - Set the start angle of the progress ring (by default it starts at top, -90 degrees)
* `app:backgroundRingColor="@color/my_color"` - Set the color of the background ring (it can be an hex color as well)
* `app:progressRingColor="@color/my_color"` - Set the color of the progress ring (it can be an hex color as well)
* `app:progressRingCap="BUTT"` - Set the cap style of the progress ring (Possible values: BUTT, ROUND, SQUARE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ public class ProgressProfileView extends ImageView {
private Bitmap mOriginalBitmap;
private Canvas mCacheCanvas;

private int startAngel;

public ProgressProfileView(Context context) {
super(context);
}
Expand Down Expand Up @@ -184,6 +186,9 @@ private void init(@Nullable AttributeSet attrs, int defStyleAttr, int defStyleRe
setProgressRingSize(a.getDimension(
R.styleable.ProgressProfileView_progressRingSize, mProgressRingSize));
}

setStartAngel(a.getInteger(R.styleable.ProgressProfileView_startAngel, -90));

setProgressRingOutline(
a.getBoolean(R.styleable.ProgressProfileView_progressRingOutline, false));
setBackgroundRingColor(a.getColor(
Expand Down Expand Up @@ -391,7 +396,7 @@ protected void onDraw(@NonNull Canvas canvas) {
}
// Draw the progress ring
if(mProgressRingSize > 0) {
canvas.drawArc(mRingBounds, -90, getSweepAngle(), false, mProgressRingPaint);
canvas.drawArc(mRingBounds, startAngel, getSweepAngle(), false, mProgressRingPaint);
}
}

Expand Down Expand Up @@ -491,6 +496,14 @@ public void setProgressRingCap(int progressRingCap) {
mProgressRingCap = getCap(progressRingCap);
}

public void setStartAngel(int angel){
startAngel = angel ;
}

public int getStartAngel() {
return startAngel;
}

private Paint.Cap getCap(int id) {
for (Paint.Cap value : Paint.Cap.values()) {
if (id == value.ordinal()) {
Expand All @@ -499,4 +512,7 @@ private Paint.Cap getCap(int id) {
}
return Paint.Cap.BUTT;
}



}
1 change: 1 addition & 0 deletions progressprofile/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<attr name="progress" format="float"/>
<attr name="backgroundRingSize" format="dimension"/>
<attr name="progressRingSize" format="dimension"/>
<attr name="startAngel" format="integer"/>
<attr name="backgroundRingColor" format="color|reference"/>
<attr name="progressRingColor" format="color|reference"/>
<attr name="progressRingOutline" format="boolean"/>
Expand Down