Coder Social home page Coder Social logo

emre1512 / circleprogressbar Goto Github PK

View Code? Open in Web Editor NEW
112.0 4.0 33.0 174 KB

A simple library for creating circular progressbars for Android

License: Other

Java 100.00%
android progressbar android-ui circle circular-progress-bar circular-progress

circleprogressbar's Introduction

CircleProgressBar

https://github.com/emre1512/CircleProgressBar https://github.com/emre1512/CircleProgressBar https://www.apache.org/licenses/LICENSE-2.0 https://github.com/emre1512/CircleProgressBar

A simple library for creating circular progressbars for Android.

Examples

Installation

  • Get it via gradle: implementation 'com.emredavarci:CircleProgressBar:1.0.8'

Usage

  1. Add CircleProgressBar to your layout
    <com.emredavarci.circleprogressbar.CircleProgressBar
    	xmlns:cpb="http://schemas.android.com/apk/res-auto"
        android:id="@+id/progressBar"
        android:layout_width="150dp"
        android:layout_height="150dp"
        cpb:progressColor="#e76130"
        cpb:backgroundColor="#e7b330"
        cpb:dimension="14"
        cpb:backgroundWidth="8"
        cpb:textSize="18sp"
        cpb:roundedCorners="true"
        cpb:suffix="%"
        cpb:prefix=""
        cpb:progressText="Loading..."
        cpb:maxValue="100"
        cpb:progressTextColor="#f9916b"/>
  1. Get it from your activity/fragment etc.
	CircleProgressBar progressBar = (CircleProgressBar) findViewById(R.id.progressBar);
	progressBar.setProgress(progress1);

You can modify it programmatically if you want

Setters

	progressBar.setProgress(progress); 		// set progress value
	progressBar.setMaxValue(100); 			// set progress max value
	progressBar.setStrokeWidthDimension(10); 		// set stroke width
	progressBar.setBackgroundWidth(10); 		// set progress background width
	progressBar.setProgressColor("#FF6FD99D"); 	// set progress color
	progressBar.setBackgroundColor("#FFF9916B"); 	// set progress backgorund color
	progressBar.setText(String.valueOf(progress)); 	// set progress text
	progressBar.setTextColor("#FF6FD99D"); 		// set text color
	progressBar.setSuffix("%"); 			// set suffix
	progressBar.setPrefix(""); 			// set prefix

Getters

	progressBar.getProgress();			// get progress value
	progressBar.getProgressPercentage();		// get progress percentage
	progressBar.getMaxValue();			// get progress max value
	progressBar.getStrokeWidthDimension();			// get stroke width
	progressBar.getBackgroundWidth();		// get progress background width
	progressBar.getProgressColor();			// get progress color
	progressBar.getBackgroundColor();		// get progress backgorund color
	progressBar.getText();  			// get progress text
	progressBar.getTextColor();			// get text color
	progressBar.getSuffix();			// get suffix
	progressBar.getPrefix();			// get prefix

LICENSE

Copyright 2017 M. Emre Davarci

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, software distributed 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 and limitations under the License.

circleprogressbar's People

Contributors

allan-on avatar emre1512 avatar theredspy15 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

circleprogressbar's Issues

error: duplicate value for resource 'attr/strokeWidth' with config ''

Can't build the project, getting the following error

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\Yanay.gradle\caches\transforms-1\files-1.1\jetified-circleprogressbar-1.0.4.aar\0fe22733a8a04170d80035415cb5406a\res\values\values.xml:6:5-533: AAPT: error: duplicate value for resource 'attr/strokeWidth' with config ''.

C:\Users\Yanay.gradle\caches\transforms-1\files-1.1\jetified-circleprogressbar-1.0.4.aar\0fe22733a8a04170d80035415cb5406a\res\values\values.xml:6:5-533: AAPT: error: resource previously defined here.

Animation Support?

Have you got any sample to animate the progress

ObjectAnimator animation = ObjectAnimator.ofInt(progressBar, "progress", 0, currentValue);
// see this max value coming back here, we animale towards that value
animation.setDuration(1000); //in milliseconds
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
This doesn't work

Reading the strokeWidthDimension attribute causes exception

The line 68 in CircleProgressBar.java

strokeWidthDimension = ta.getFloat(R.styleable.CircleProgressBar_strokeWidthDimension, 10);

should be changed to:

strokeWidthDimension = ta.getDimension(R.styleable.CircleProgressBar_strokeWidthDimension, 10);

because the strokeWidthDimension is defined as a dimension.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.