Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show donut progress without float value #97

Closed
arpitjoshi08 opened this issue Jul 6, 2017 · 10 comments
Closed

Show donut progress without float value #97

arpitjoshi08 opened this issue Jul 6, 2017 · 10 comments

Comments

@arpitjoshi08
Copy link

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
Copy link
Author

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
Copy link

@arpitjoshi08
please checkout my PR #103

@coanag
Copy link

coanag commented Nov 7, 2017

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
Copy link

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

@coanag
Copy link

coanag commented Nov 8, 2017

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
Copy link

KhaledLela commented Nov 8, 2017

@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
Copy link

@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
Copy link

KhaledLela commented Nov 16, 2017

@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
Copy link

@KhaledLela Thank you! It worked.

@coanag
Copy link

coanag commented Nov 20, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants