CircleProgress, DonutProgress, ArcProgress

Overview

Android Arsenal

inspired from https://github.com/daimajia/NumberProgressBar

and CleanMaster

CleanMaster

###Demo

CircleProgress

###Demo download link

###3 kinds of progress view are provided, DonutProgress, CircleProgress, ArcProgress

##Usage

please use jitpack

    allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}

###Gradle

dependencies {
    implementation 'com.github.lzyzsd:circleprogress:1.2.1'
}

###Notice

please always use same width and height for progress views

DonutProgress

    <com.github.lzyzsd.circleprogress.DonutProgress
        android:layout_marginLeft="50dp"
        android:id="@+id/donut_progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        custom:donut_progress="30"/>

DonutProgress

attrs for DonutProgress

    <declare-styleable name="DonutProgress">
        <attr name="donut_progress" format="integer"/>
        <attr name="donut_max" format="integer"/>
        <attr name="donut_unfinished_color" format="color"/>
        <attr name="donut_finished_color" format="color"/>
        <attr name="donut_finished_stroke_width" format="dimension"/>
        <attr name="donut_unfinished_stroke_width" format="dimension"/>
        <attr name="donut_text_size" format="dimension"/>
        <attr name="donut_text_color" format="color"/>
        <attr name="donut_text" format="string"/>
        <attr name="donut_prefix_text" format="string"/>
        <attr name="donut_suffix_text" format="string"/>
        <attr name="donut_background_color" format="color"/>
    </declare-styleable>

CircleProgress

    <com.github.lzyzsd.circleprogress.CircleProgress
        android:id="@+id/circle_progress"
        android:layout_marginLeft="50dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        custom:circle_progress="20"/>

CircleProgress

attrs for CircleProgress

    <declare-styleable name="CircleProgress">
        <attr name="circle_progress" format="integer"/>
        <attr name="circle_max" format="integer"/>
        <attr name="circle_unfinished_color" format="color"/>
        <attr name="circle_finished_color" format="color"/>
        <attr name="circle_text_size" format="dimension"/>
        <attr name="circle_text_color" format="color"/>
        <attr name="circle_prefix_text" format="string"/>
        <attr name="circle_suffix_text" format="string"/>
    </declare-styleable>

ArcProgress

    <com.github.lzyzsd.circleprogress.ArcProgress
        android:id="@+id/arc_progress"
        android:background="#214193"
        android:layout_marginLeft="50dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        custom:arc_progress="55"
        custom:arc_bottom_text="MEMORY"/>

ArcProgress

attrs for ArchProgress

    <declare-styleable name="ArcProgress">
        <attr name="arc_progress" format="integer"/>
        <attr name="arc_angle" format="float"/>
        <attr name="arc_stroke_width" format="dimension"/>
        <attr name="arc_max" format="integer"/>
        <attr name="arc_unfinished_color" format="color"/>
        <attr name="arc_finished_color" format="color"/>
        <attr name="arc_text_size" format="dimension"/>
        <attr name="arc_text_color" format="color"/>
        <attr name="arc_suffix_text" format="string"/>
        <attr name="arc_suffix_text_size" format="dimension"/>
        <attr name="arc_suffix_text_padding" format="dimension"/>
        <attr name="arc_bottom_text" format="string"/>
        <attr name="arc_bottom_text_size" format="dimension"/>
    </declare-styleable>

donut_inner_drawable

support add a drawable to the center

donut_show_text

show or hide bottom text

###Build

run ./gradlew assembleDebug (Mac/Linux)

or

run gradlew.bat assembleDebug (Windows)

###Changes

version 1.1.0: add bottom text to DonutProgressView

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004

Copyright (C) 2014 Bruce Lee <bruceinpeking#gmail.com>

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.
Comments
  • Show donut progress without float value

    Show donut progress without float value

    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.

    opened by arpitjoshi08 10
  • ArcAngle property is not working

    ArcAngle property is not working

    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

    opened by vivekm26 8
  • Could not find com.github.lzyzsd:circleprogress:1.2.4

    Could not find com.github.lzyzsd:circleprogress:1.2.4

    Execution failed for task ':app:checkDebugAarMetadata'.
    > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
       > Could not find com.github.lzyzsd:circleprogress:1.2.4.
         Searched in the following locations:
           - https://jcenter.bintray.com/com/github/lzyzsd/circleprogress/1.2.4/circleprogress-1.2.4.pom
           - https://dl.google.com/dl/android/maven2/com/github/lzyzsd/circleprogress/1.2.4/circleprogress-1.2.4.pom
           - https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.4/circleprogress-1.2.4.pom
           - https://maven.google.com/com/github/lzyzsd/circleprogress/1.2.4/circleprogress-1.2.4.pom
         Required by:
             project :app
    
    opened by ytheekshana 6
  • Gradle dependencies not found

    Gradle dependencies not found

    In the README.md the gradle dependencies is compile 'com.github.lzyzsd:circleprogress:1.1.1', but it doesn't work, I change it to compile 'com.github.lzyzsd:CircleProgress:v1.2.0', then it works. Please change this in the README.md file. Thanks for your contribution!

    opened by taojunpo 5
  • start progress from top

    start progress from top

    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 ?

    opened by lub0s 3
  • Improved the DonutProgress by adding a drawable.

    Improved the DonutProgress by adding a drawable.

    • Added the possibility to add a drawable resource in the center of the view, i.e. the inner circle. Such drawable can be set by the custom xml tag "donut_inner_drawable".
    • Added the possibility to hide the inner text through a boolean tag "donut_show_text".
    • Changed the progress property to float in order to have better/smoother animations.
    opened by ghost 3
  • Background is deleted

    Background is deleted

    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

    opened by acarmon 3
  • Build gradle should be like this compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

    Build gradle should be like this compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

    compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

    Hi, build gradle with compile 'com.github.lzyzsd:circleprogress:1.1.0' doesn't work( i mean in guidance document) should be like compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

    Thanks

    opened by tuanphambiglab 2
  • Set color programatically ?

    Set color programatically ?

    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 :

    issue_donut_progress

    Am I using setFinishedStrokeColor the right way ? Thanks in advance, Max

    opened by TcQPAD 2
  • DonutProgress draw arc wrongly.

    DonutProgress draw arc wrongly.

    screenshot_2015-02-27-13-57-24 As the image above ,

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

    screenshot_2015-02-27-14-06-14

    the problem resolved, and I commited a PR.

    opened by taoliuh 2
  • (CircleProgress) Last view

    (CircleProgress) Last view "saved" ? Getting the same % for all views

    Hi,

    I'm saving my data in a database and when I load the fragment for a first time, it does a great job : First load And then, at the second and furthers loads : it displays only 83%. Second load

    When I debug here it displays me the good %. But in the View, i see only 83% as you saw before. Debug

    Any ideas if it is a bug ?

    opened by SwiTool 2
  • Solve the innerText adaptation problem of different Android systems / DonutProgress

    Solve the innerText adaptation problem of different Android systems / DonutProgress

    Please add this below code on DonutProgress.java under onDraw method after 500 line

      if(innerBottomTextHeight == 0) { 
                    innerBottomTextHeight  = getHeight() - (getHeight() * 3) / 4;
                }
    

    The value of innerbottomtextheight in different systems is 0, which leads to problems

    This is a common problem of this library. If you encounter similar problems in arcprogress and circleprogress, you can refer to it

    opened by HAPENLY 0
  • setProgress Float issue

    setProgress Float issue

    I am unable to set a floating value to setProgress function. I'm using Kotlin. My library version is 1.2.1. 1.2.3 and 1.2.4 cannot be implemented as it is not recognised in the project. Can you please give me a solution? @lzyzsd

    opened by rishabcaxigo 0
  • Arc Progress Crash On Persian Language Apps

    Arc Progress Crash On Persian Language Apps

    When use arc progress in Persian language apps when use decimal formatter change number character and its make crash

    Caused by: java.lang.NumberFormatException: For input string: "۷۰" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122) at java.lang.Float.parseFloat(Float.java:451) at com.github.lzyzsd.circleprogress.ArcProgress.setProgress(ArcProgress.java:191) at com.github.lzyzsd.circleprogress.ArcProgress.initByAttributes(ArcProgress.java:112) at com.github.lzyzsd.circleprogress.ArcProgress.(ArcProgress.java:99) at com.github.lzyzsd.circleprogress.ArcProgress.(ArcProgress.java:83) ... 61 more

    opened by sdarvish 0
  • checksum for circleprogress-1.2.1.aar does not match on jitpack.io

    checksum for circleprogress-1.2.1.aar does not match on jitpack.io

    $ curl -s https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar | sha1sum
    eba204ef7eb75c26ae9a0eef979782a67a21999b  -
    $ curl https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar.sha1
    8a5df8d876a5fc8e210894c481ce25351a26ad53%
    

    md5 also differs for circleprogress-1.2.1.aar. This makes the package unusable when checksum verification is turned on, for example,

    $ coursier fetch com.github.lzyzsd:circleprogress:1.2.1  -r https://jitpack.io  -v -m force --checksum MD5 --artifact-type aar
    
      Dependencies:
    com.github.lzyzsd:circleprogress:1.2.1:
    https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.pom
      100.0% [##########] 433B (4.1 KiB / s)
    https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar
      100.0% [##########] 18.3 KiB (300.3 KiB / s)
    https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar
      100.0% [##########] 18.3 KiB (321.4 KiB / s)
    Error fetching artifacts:
    https://jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar: wrong checksum: /.../Caches/Coursier/v1/https/jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar (expected MD5 ab724a205558dea29986fd76373327f in /.../Caches/Coursier/v1/https/jitpack.io/com/github/lzyzsd/circleprogress/1.2.1/circleprogress-1.2.1.aar.md5, got 62fc55f2831c5c016abfc21826669fcd)
    
    opened by tsawada 2
  • ArcProgress.setProgress can generate java.lang.NumberFormatException

    ArcProgress.setProgress can generate java.lang.NumberFormatException

    bugged because under some locale, decimal format returns a string not parseable by Float.valueOf that always wants the . as decimal separator

    crashing line this.progress = Float.valueOf(new DecimalFormat("#.##").format(progress));

    fix this.progress = (float)Math.round(progress * 100.0f) / 100.0f;

    opened by giovdain 0
Owner
hi大头鬼hi
Engineer@Taobao
hi大头鬼hi