uknownothingsnow / CircleProgress

CircleProgress, DonutProgress, ArcProgress
3.81k stars 921 forks source link

Show donut progress without float value #97

Closed arpitjoshi08 closed 7 years ago

arpitjoshi08 commented 7 years ago

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 commented 7 years ago

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(); }

KhaledLela commented 6 years ago

@arpitjoshi08 please checkout my PR #103

coanag commented 6 years ago

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

KhaledLela commented 6 years ago

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

coanag commented 6 years ago

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?

KhaledLela commented 6 years ago

@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

ChiroBan commented 6 years ago

@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.

KhaledLela commented 6 years ago

@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,

ChiroBan commented 6 years ago

@KhaledLela Thank you! It worked.

coanag commented 6 years ago

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