CircleProgress icon indicating copy to clipboard operation
CircleProgress copied to clipboard

Show donut progress without float value

Open arpitjoshi08 opened this issue 9 years ago • 10 comments

I am using donut progress and setting progress update. its working properly now getting issue is that i want to show progress in int value despite of float value how is it possible? currently its showing 67.0% like this and i want 67% only.

arpitjoshi08 avatar Jul 06 '17 07:07 arpitjoshi08

resolved using one change in custom class- first change variable data type float to int -private int progress = 0; and then change the code of method: public void setProgress(float progress) { // this line will convert float to int value int prog=Math.round(progress); this.progress = prog; if (this.progress > getMax()) { this.progress %= getMax(); } invalidate(); }

arpitjoshi08 avatar Jul 06 '17 09:07 arpitjoshi08

@arpitjoshi08 please checkout my PR #103

KhaledLela avatar Sep 27 '17 17:09 KhaledLela

I’m having problems showing progress with out decimal places. Is there any easy solution in the donut progress only to show integers. I’m passing integers in progress, but showing floats like 100.0%. Thanks in advance

coanag avatar Nov 07 '17 21:11 coanag

@coanag Progress defined as float in donut progress, please checkout my PR #103 fixed this issue using DecimalFormat

KhaledLela avatar Nov 07 '17 23:11 KhaledLela

You mean with the setProgressFloating? I’ve searched at issues and found similar issues and answers pointing at PR #103. But did figure it out. I’m using version 'com.github.lzyzsd:circleprogress:1.2.1'. How to set digits?

coanag avatar Nov 08 '17 05:11 coanag

@coanag Unfortunately library owner didn't accept PR yet, You have to do it yourself, Clone my fork of this library, and add as module to your project,

How to set digits? you can achieve that on my fork through, xml : donut_progress_digits Java : setProgressFloating

KhaledLela avatar Nov 08 '17 08:11 KhaledLela

@KhaledLela The float value issue is still not solved. I tried using your fork but no change. Please tell me if there is something else which needs to be changed.

ChiroBan avatar Nov 16 '17 07:11 ChiroBan

@ChiroBan By default My fork show progress without float point, Like 99 % But you still able to change this using

xml : donut_progress_digits
Java : setProgressFloating Ex: 1. 99.8% 2. 99.75% etc,

Please checkout just update fork to

show DonutProgress without float point,

KhaledLela avatar Nov 16 '17 07:11 KhaledLela

@KhaledLela Thank you! It worked.

ChiroBan avatar Nov 16 '17 14:11 ChiroBan

Another solution is to directly setText like donutProgress.setText("99") and dont care about floats or integers

coanag avatar Nov 20 '17 08:11 coanag