Skip to content

Commit c2a79a5

Browse files
authored
Merge pull request #17 from cidermole/percentage-hide
add switch apsv_show_progress to disable progress percentage text
2 parents 943921f + 09ed098 commit c2a79a5

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

arcprogressstackview/src/main/java/devlight/io/library/ArcProgressStackView.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public class ArcProgressStackView extends View {
149149
private boolean mIsRounded;
150150
private boolean mIsDragged;
151151
private boolean mIsModelBgEnabled;
152+
private boolean mIsShowProgress;
152153
private boolean mIsLeveled;
153154

154155
// Colors
@@ -271,6 +272,11 @@ public ArcProgressStackView(final Context context, final AttributeSet attrs, fin
271272
R.styleable.ArcProgressStackView_apsv_model_bg_enabled, false
272273
)
273274
);
275+
setShowProgress(
276+
typedArray.getBoolean(
277+
R.styleable.ArcProgressStackView_apsv_show_progress, true
278+
)
279+
);
274280

275281
// Set orientation
276282
final int orientationOrdinal =
@@ -456,6 +462,15 @@ public void setModelBgEnabled(final boolean modelBgEnabled) {
456462
postInvalidate();
457463
}
458464

465+
public boolean isShowProgress() {
466+
return mIsShowProgress;
467+
}
468+
469+
public void setShowProgress(final boolean showProgress) {
470+
mIsShowProgress = showProgress;
471+
postInvalidate();
472+
}
473+
459474
public boolean isRounded() {
460475
return mIsRounded;
461476
}
@@ -977,12 +992,14 @@ protected void onDraw(final Canvas canvas) {
977992
// Draw progress value
978993
canvas.save();
979994
canvas.rotate(indicatorProgressAngle, model.mPos[0], model.mPos[1]);
980-
canvas.drawText(
981-
percentProgress,
982-
model.mPos[0] - model.mTextBounds.exactCenterX(),
983-
model.mPos[1] - model.mTextBounds.exactCenterY(),
984-
mTextPaint
985-
);
995+
if (mIsShowProgress) {
996+
canvas.drawText(
997+
percentProgress,
998+
model.mPos[0] - model.mTextBounds.exactCenterX(),
999+
model.mPos[1] - model.mTextBounds.exactCenterY(),
1000+
mTextPaint
1001+
);
1002+
}
9861003
canvas.restore();
9871004
}
9881005

arcprogressstackview/src/main/res/values/attrs.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ limitations under the License.
3535
<attr name="apsv_draw_width" format="fraction|dimension"/>
3636
<attr name="apsv_model_offset" format="dimension"/>
3737
<attr name="apsv_model_bg_enabled" format="boolean"/>
38+
<attr name="apsv_show_progress" format="boolean"/>
3839

3940
<attr name="apsv_start_angle" format="integer"/>
4041
<attr name="apsv_sweep_angle" format="integer"/>
@@ -46,4 +47,4 @@ limitations under the License.
4647
<attr name="apsv_preview_colors" format="reference"/>
4748
<attr name="apsv_preview_bg" format="color"/>
4849
</declare-styleable>
49-
</resources>
50+
</resources>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy