Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork25
A fancy CircularProgressView
License
GuilhE/CircularProgressView
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A fancy CircularProgressView.
CircularProgressView is distributed throughMaven Central andJitpack.
implementation'com.github.guilhe:circular-progress-view:${LATEST_VERSION}'Check out thesample module where you can find a few examples of how to create it byxml orjava.
Attributes accepted in xml:
<attrname="max"format="integer" /> <attrname="shadow"format="boolean" /> <attrname="progressThumb"format="boolean" /> <attrname="progressThumbSize"format="dimension" /> <attrname="progressThumbSizeRate"format="float" /> <attrname="progressThumbSizeMaxRate"format="float" /> <attrname="startingAngle"format="integer" /> <attrname="progress"format="integer" /> <attrname="progressBarThickness"format="dimension" /> <attrname="progressBarColor"format="color" /> <attrname="progressBarColorArray"format="reference" /> <attrname="progressBarColorArrayPositions"format="reference" /> <attrname="duplicateFirstColorInArray"format="boolean" /> <attrname="progressBarRounded"format="boolean" /> <attrname="progressBackgroundColor"format="color" /> <attrname="progressBackgroundAlphaEnabled"format="boolean" /> <attrname="reverse"format="boolean" /> <attrformat="enum"name="progressThumbScaleType"> <enumname="auto"value="0"/> <enumname="point"value="1"/> <enumname="rate"value="2"/> </attr>
Example:
<com.github.guilhe.views.CircularProgressViewandroid:layout_width="100dp"android:layout_height="100dp"app:progress="60"app:progressBarThickness="10dp"app:progressBarColor="@android:color/holo_purple"/>
You can take advantage ofBinding Adapters (from Data Binding) to create some helper attributes, example:
@BindingAdapter("progressAnimated")funsetProgressAnimated(view:CircularProgressView,progress:Int) { view.setProgress(progress,true);}
<com.github.guilhe.views.CircularProgressView ...app:progressAnimated="@{viewModel.progress}"/>
For the given array of colors:
<arrayname="rainbow"> <item>#FFF60000</item> <item>#FFFF8C00</item> <item>#FFFFEE00</item> <item>#FF4DE94C</item> <item>#FF3783FF</item> <item>#FF4815AA</item></array>
The default result will be (left):
To achieve the result on the right side you have two options: either copy the first color and add it as last, or use the helper attribute/method that does that for you:
<attrname="duplicateFirstColorInArray"format="boolean"/>
funsetProgressColors(@NonNull @ColorInt int[] colors, @Nullable float[] positions, boolean duplicateFirst)
Finally, you may also use the attributeprogressBarColorArrayPositions to pass afloat[] positions:
<arrayname="rainbow_positions"> <itemtype="dimen"format="float">.44</item> ...</array>
note: when using the helper functionandpositions[], you'll have to add an extra position for the last one being copied.
There are many methods to help you customize thisView by code. For more details checkout thesample app,javadocs or the code itself.
funsetProgress(@NonNullList<Float> progressList, @NonNullList<Integer> progressColorList)
This mode can be used to display a simple pie chart. It will disable the progress thumb, the background color and the progress will not be round.
Animation last update on April, 2019
For bugs, questions and discussions please use theGithub Issues.
Copyright (c) 2017-present, GuilhE.
Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
About
A fancy CircularProgressView
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.



