lzyzsd / circleprogress Goto Github PK
View Code? Open in Web Editor NEWCircleProgress, DonutProgress, ArcProgress
CircleProgress, DonutProgress, ArcProgress
This library needs a feature to change te TypeFace from the progress text (countdown text) or any other text.
Hello,
First of all thanks for this very nice and easy use library :-)
I'd like to know if it's possible to change the finished_color programatically. I'm having trouble doing it :
Using donutProgress.setFinishedStrokeColor(R.color.orange);
or whatever color won't do anything, instead it puts a blue/purple color as you can see below :
Am I using setFinishedStrokeColor the right way ?
Thanks in advance, Max
if (finishedStrokeWidth > unfinishedStrokeWidth) {
finishedOuterRect.set(finishedStrokeWidth / 2,
finishedStrokeWidth / 2,
getWidth() - finishedStrokeWidth / 2,
getHeight() - finishedStrokeWidth / 2);
float delta = (finishedStrokeWidth - unfinishedStrokeWidth) / 2f;
unfinishedOuterRect.set(unfinishedStrokeWidth / 2,
unfinishedStrokeWidth / 2,
getWidth() - unfinishedStrokeWidth / 2 - delta,
getHeight() - unfinishedStrokeWidth / 2 - delta);
} else {
float delta = (unfinishedStrokeWidth - finishedStrokeWidth) / 2f;
finishedOuterRect.set(finishedStrokeWidth / 2,
finishedStrokeWidth / 2,
getWidth() - finishedStrokeWidth / 2 - delta,
getHeight() - finishedStrokeWidth / 2 - delta);
unfinishedOuterRect.set(unfinishedStrokeWidth / 2,
unfinishedStrokeWidth / 2,
getWidth() - unfinishedStrokeWidth / 2,
getHeight() - unfinishedStrokeWidth / 2);
}
I modified so it would like this:
float delta = Math.max(finishedStrokeWidth, unfinishedStrokeWidth);
finishedOuterRect.set(delta,
delta,
getWidth() - delta,
getHeight() - delta);
unfinishedOuterRect.set(delta,
delta,
getWidth() - delta,
getHeight() - delta);
the problem resolved, and I commited a PR.
Hi,
I can see the version 1.2.0 on your release branch details.
But it seems the new version is not pushed to the maven central repository, due to that I can't use the latest version. Please update it.
When I add the arc_angle
property in my ArcProgress:
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="@+id/arc"
android:layout_width="100dp"
android:layout_height="100dp"
app:arc_angle="360"/>
I get a warning: Dimension "360" in attribute "arc_angle" is missing unit!
And if I ignore the warning and run I get an exception:
android.view.InflateException: Binary XML file line #20: Error inflating class com.github.lzyzsd.circleprogress.ArcProgress
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
...
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
...
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x4
at android.content.res.TypedArray.getDimension(TypedArray.java:508)
at com.github.lzyzsd.circleprogress.ArcProgress.initByAttributes(ArcProgress.java:101)
at com.github.lzyzsd.circleprogress.ArcProgress.<init>(ArcProgress.java:90)
at com.github.lzyzsd.circleprogress.ArcProgress.<init>(ArcProgress.java:74)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
Observation: I'm using this view in a fragment
Hi,
I tried your lib, but I'm facing some troubles.
When i put donutProgress.setProgress(92)
(programmatically), doesn't work.
In XML no troubles, but i can't do it in code.
Then, I tried to getProgress with donutProgress.getProgress()
& it returns my previous setProgress (92).
Any idea?
BR,
Bastien.
[EDIT]
My bad, just selected header layout instead of inflated layout.
Hi,
Can anyone explain how to use this fantastic library in a home widget?
I am having problem in adding this view to the remoteView in my AppWidgetProvider.
Thanks in advance
Hi, I would like to set donutprogress with no text inside it. Only circle. I try using
custom:donut_prefix_text=""
custom:donut_suffix_text=""
custom:donut_text=""
But the number progress inside it still showing.
In Nexus 5 it is working completely fine of rendering archview but in nexus 5x it is not working properly.
nexus 5
When i try to see Debug GPU overdraw with Show areas for Deuteranomaly. It clearly shows arch is generating but GPU is drawing oval on it.
Can you look in to this issue and revert me back. Thanks.
I am using Donut Progress in a recycler view under a view pager. The inner bottom text mysteriously appears and disappears of its own accord, after the view is recreated. Even though the same code is used to bind the view to the recycler view. Some Donut progress have the inner text, some don't.
Top of the list
After scrolling downwards
This line just print actual progress value which works well for default max value (100) but it is incorrect for custom value (e.g. 5). Angle is calculated correctly.
String text = this.text != null ? this.text : prefixText + progress + suffixText;
I'm trying to show countdown type timer like : 01:30 or 03:50 it's mm:ss but now sure what property to use for it.
I only have option to set prefix and suffix but not the actual text. I have total time for countdown timer in seconds and I can also calculate it to minutes and second, but how do i display it in center ?
If i don't set prefix and suffix it takes 0 by default which I don't want to show.
such as,current progress is 55%,when user open app,see the progress will start with 0% to 55% with a smoothy animation
How can i use this library in ecllipse?
it seems a problem for me to show negative progress. values show correctly but the finished color and unfinished color get reversed. I wanted to show the same finished color for positive as well as negative color. please help..
thanks.
By default the progress starts from right (3 o clock). How to make progress to start from top? (12 o clock). For now my solution is rotation whole view, but this isn't a good solution.
Hi,
First of all thanks for the great library! I was digging into the code and I wonder how can I make it show a drawable resource inside the circle (the donut for example) instead of showing the percentage? I tried to modify the class but I have no much experience adding custom attributes and so on.
Thanks!
Error:(106) No resource identifier found for attribute 'donut_circle_starting_degree' in package 'com.ks.kaishustory'
I would like to compile CircleProgress into jar and having this error:
A problem occured evaluating project ':library'.
C:\CircleProgress-master\local.properties (The system cannot find the file specified.
Could you please upload local.properties so that i can compile using:
gradlew jarRelease
I im missing this local.properties so library would not compile.
Error:(100, 13) Failed to resolve: com.github.lzyzsd:circleprogress:1.2.0
Can you add a license file to indicate the license this code falls under?
Can you remove unused ic_launcher.png?
because of it can cause build error “ic_launcher.png: Original is here.”
maybe you will say i can rename my ic_launcher.png to something else,but other thirdparty library will als forget to remove ic_launcher.png,so, can you remove it?
<com.github.lzyzsd.circleprogress.ArcProgress
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/arc_progress"
android:layout_width="40dp"
android:layout_height="40dp"
custom:arc_stroke_width="6dp"
custom:arc_text_size="12dp"
custom:arc_progress="20"/>
When I debugged it I realized that x and y of drawText are out of box. When I change dimensions to 140dp it looks great.
This library is excellent !
pls support for float values for progress!
however cast can be used! but i need to show values in float!
thanks in advance!
I have implemented a view pager which has 3 page in it. My first fragment has arc progress (does not matter which one). When i go to last fragment and turned back to first one which has my arc progress, i cannot see the arc. If i try with it ciricular i cannot see the cirricular then.
I tried to invalidate view to force it re-draw. It didnt fixed.
I think problem may be about restoring state.
Good luck there
As per title, I found this issue happens only when using Fragment. I simulate the same thing on Activity, it works perfect.
** There are 3 posts regarding this issue. So I don't know which should I post into.
Please help me, how can i Animate ArcProgress?? i'll appreciate if you can explain with detailed discription
Angle 222 works fine
Suggestion: Draw finished arc from angle 90 but not angle 0 in the DonutProgress .
Or the angle can be configured in style.
Is it possible to show a color gradient like the left one here?:
http://i.stack.imgur.com/GxlTx.png
Hi. Is it possible to reduce the increment of progress by make it slow ?
It causes build errors with Gradle.
Is there any indeterminate option for this progress bar ? Like the progress can continuously spin and if our work is done we can just dismiss it. It would be cool it we can do that.
Is there any way to set the progress donut to start at 12 o'clock(90°) instead of 3 o'clock(0°)?
Hi,
I'm using https://github.com/gabrielemariotti/cardslib.
I have CardListView and in the cards i have CircleProgress.
When the user first enter the CardListView , it shows the CircleProgress with the background colors.
But When i move between activities and than returning to the CardListView i can only see the percentage without any background color...
Thanks,
Amit
Hi,
I'm getting a cut text in my list view using ArcProgress.
Thanks,
Ilan
Is it possible to modify the CircleProgress to start from the top instead of from a 90 degree angle
Would it be possible to have attribute wich will let us set starting angle of progress ? Like for values 0 or 360 the progress would start from top of the circle ?
hello i cant download the source with gradle
Could not resolve com.github.lzyzsd:circleprogress:1.2.0.
Could not GET 'https://jcenter.bintray.com/com/github/lzyzsd/circleprogress/1.2.0/circleprogress-1.2.0.pom'.
Hi,
I am showing a few simple arcs in different colors and in different rows via a recylced view adapter. However changing the arc color does not cause initPainters to be called again, meaning the setting is never applied. Basically all properties used by initPainters can not be changed via the public setX API.
I'm currently fixing this by inheritance
public class ArcProgress extends com.github.lzyzsd.circleprogress.ArcProgress {
public ArcProgress(Context context) { super(context); }
public ArcProgress(Context context, AttributeSet attrs) { super(context, attrs); }
public ArcProgress(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
protected void onDraw(Canvas canvas) {
initPainters();
super.onDraw(canvas);
}
}
which is ugly and slow but works.
It would be nice if the initPainters logic would be changed to make programatic changes possible.
This might be related to issue #1 - the symptoms are at least the same but I can't identify if it's the same root cause.
(PS: I am getting the arc color via an API, which means I am unable to determine it ahead of time. D'oh)
I would like to know if there is a way to start progress at 0 degree.
Before Android 4.1, method int android.support.v7.internal.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
Hey.
I've seen you have changed a lot of things since the v1.1.0 including a commit where unnecessary resources got removed.
I would love to update my com.android.tools.build:gradle:1.1.3
to com.android.tools.build:gradle:1.2.3` but this is not possible because your v1.1.0 of your library still includes the ic_launcher drawable, which was already removed in a commit.
Thanks in advance.
When ever I set the arc angle property in xml file and run the app it fails with
android.view.InflateException: Binary XML file line #128: Error inflating class com.github.lzyzsd.circleprogress.ArcProgress
i m getting error in this line
custom:circle_progress="25"
custom:circle_finished_color="#ff0000"
custom:circle_unfinished_color="#00ff00"
custom:circle_text_color="#000000"
custom:circle_suffix_text="$"
custom:circle_text_size="16sp"
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'circle_text_size' in package 'com.example.batterylevel'
- error: No resource identifier found for attribute 'circle_suffix_text' in package
'com.example.batterylevel'
- error: No resource identifier found for attribute 'circle_finished_color' in package
'com.example.batterylevel'
- error: No resource identifier found for attribute 'circle_progress' in package 'com.example.batterylevel'
- error: No resource identifier found for attribute 'circle_unfinished_color' in package
'com.example.batterylevel'
- error: No resource identifier found for attribute 'circle_text_color' in package 'com.example.batterylevel'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.