Coder Social home page Coder Social logo

progresswheel's Introduction

Project frozen Project unmaintained

Deprecation warning

This project is no-longer maintained, and has not been maintained for a few years now. If you're looking for an alternative library, consider the below options:

If, on the other hand, you'd like to take over maintinance of the project or modernise it, feel free to do so; just send me pull requests or an email (at [email protected]).

Progress Wheel

This is a custom component for Android intended for use instead of a progress bar.

Sample Image Sample Image 3 Sample Image 4

Compare it side by side with the Android 2x progress wheel:

Sample Image 5

A complete walkthrough of how to use this component in your app

XML:
To implement the view in your xml layout do the following:

  1. Add the following to your attrs.xml file (in res/values):
<declare-styleable name="ProgressWheel">
        <attr name="pwText" format="string" />
        <attr name="pwTextColor" format="color" />
        <attr name="pwTextSize" format="dimension" />
        <attr name="pwBarColor" format="color" />
        <attr name="pwRimColor" format="color" />
        <attr name="pwRimWidth" format="dimension" />
        <attr name="pwSpinSpeed" format="dimension" />
        <attr name="pwDelayMillis" format="integer" />
        <attr name="pwCircleColor" format="color" />
        <attr name="pwRadius" format="dimension" />
        <attr name="pwBarWidth" format="dimension" />
        <attr name="pwBarLength" format="dimension" />
        <attr name="pwContourColor" format="color"/>
        <attr name="pwContourSize" format="dimension"/>
</declare-styleable>
  1. Add the following code to the root view of your layout: xmlns:ProgressWheel="http://schemas.android.com/apk/res/com.visualdenim.schooltraq"

  2. Add the widget code in the appropriate place in your xml file. Here's a sample implementation:

<com.todddavies.components.progressbar.ProgressWheel   
    android:id="@+id/pw_spinner"     
    android:layout_width="200dp"    
    android:layout_height="200dp"   
    android:layout_centerInParent="true"   
    ProgressWheel:pwText="Authenticating..."    
    ProgressWheel:pwTextColor="#222"   
    ProgressWheel:pwTextSize="14sp"   
    ProgressWheel:pwRimColor="#330097D6"   
    ProgressWheel:pwBarLength="60dp"    
    ProgressWheel:pwBarColor="#0097D6"   
    ProgressWheel:pwBarWidth="5dp"   
    ProgressWheel:pwRimWidth="2dp" /> 

Java:
First you need to either get a ProgressWheel from a layout file, or initalise one. Do this by:

  • ProgressWheel pw = new ProgressWheel(myContext, myAttributes);
  • ProgressWheel pw = (ProgressWheel) findViewById(R.id.pw_spinner);

To spin the progress wheel, you just call .startSpinning() and to stop it spinning, you call .stopSpinning()

Incrementing the progress wheel is slightly more tricky, you call .incrementProgress(). However, this is out of 360,
(because a circle has 360 degrees), and will automatically reset once you get past 360. A percentage display is
automatically displayed.

Using as a dependency

Add this to your build.gradle:

	repositories {
	    maven { url "https://jitpack.io" }
	}
	
	dependencies {
	    compile 'com.github.Todd-Davies:ProgressWheel:1.2'
	}

Using as a library project

To use it as a library in Android Studio, please edit build.gradle.

Modify:

apply plugin: 'android'

Into:

apply plugin: 'android-library'

Since Android SDK Tools revision 17 (released March 2012), this component can be used as a library project. In this case, you do not need to copy anything into your project's attrs.xml, and you must use the following namespace URI, instead of the above:

xmlns:ProgressWheel="http://schemas.android.com/apk/res-auto"

Otherwise, usage should be the same.

Todd Davies - @Todd__Davies - 2012

progresswheel's People

Contributors

af-chacon avatar ayyoitsp avatar birajpatel avatar boyserk84 avatar cliffus avatar felipeska avatar gherfray avatar golharam avatar gracker avatar jitpack-io avatar joeykrim avatar krislq avatar pidelport avatar pyus13 avatar rocboronat avatar rohithramachandran avatar rtfrex avatar shyri avatar skjolber avatar stormzhang avatar the4ndy avatar todd-davies avatar vicktor 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  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

progresswheel's Issues

How to install this ?

Your project is very interesting but i can't use it.
I don't understand how to use it. Can anyone explain how to install ProgressWheel ?

Thx !

Possible chnes

I was unable to use project as library in last Android studio 0.5.5

Without changing in build.gradle from

apply plugin: 'android'

to

apply plugin: 'android-library'

and using namespace

xmlns:ProgressWheel="http://schemas.android.com/apk/res-auto"

add animation to the component

Hello, I would like to add animation to the component. the animation would go from 0 to value, and would increase the value inside (setText) from 0 to value.

Do you have any clue on how to do it???

Tx man, you component rocks !!

Why I can't use this library on eclipse

hello
I tried to import this library in eclipse , I right click and import it as android project .On the properties , the "is library" is checked .

The problem is ,in the main.java and ProgressWheel.java , every "R" has this error "R cannot be resolved to a variable" . For instance , this line has the problem "R.styleable.ProgressWheel" .

What is the problem ?Why I can't import it ?

Looking to hear from you
King Regards

Double application

After adding the project as a dependency, when I run my application in an Android device it installs two applications, one of them is the actual application and the other one is the sample app from Progress Wheel. I cant figure out how to solve this.
device-2015-07-20-150843

No style.xml

not working as parseAttributes(context.obtainStyledAttributes(attrs,
R.styleable.ProgressWheel));

License ambiguity

The project seems to be licensed under MIT license but here in source file it says CC license.

Fix / clarification on this would be great. Thanks.

Bar Shader

Please add getter/setter for bar Shader.
I wanted to apply a gradient to the progress bar and I needed the bar shader.
Also, why not add a Shader for every type?

public Shader getBarShader() {
    return barPaint.getShader();
}
public void setBarShader(Shader shader) {
    this.barPaint.setShader(shader);
}

I had some trouble applying a gradient for the bar, so here is what I did:

Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.blue_conical_gradient);
Shader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
progressBar.setBarShader(shader);

The gradient made with GIMP:
blue_conical_gradient

The result:
image

Great component! Thanks!

Add to Home Widget

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

attrs.xml file shows error

I have copy down the code in guidence in file named attrs.xml file but it shows error

so please tell me how to make attrs.xml file.

Attribute "radius" has already been defined

Hello. When I build gradle, it keeps showing me this error: "Attribute "radius" has already been defined". After a little research I discovered ViewPagerIndicator library also uses "radius" attribute. They conflict.

So how can I successfully build both of them?

Match parent width and height

The ProgressWheel control does not draw when I specify it as :

<com.todddavies.components.progressbar.ProgressWheel
android:id="@+id/dialProgressWheel"
android:layout_width="match_parent"
android:layout_height="match_parent"
ProgressWheel:barColor="#FF0000"
ProgressWheel:barLength="5dp"
ProgressWheel:barWidth="5dp"
ProgressWheel:rimColor="#000000"
ProgressWheel:rimWidth="10dp"
ProgressWheel:text=""
ProgressWheel:textColor="#222"
ProgressWheel:textSize="14sp"
/>

Setting bounds with this.getLayoutParams().width error

When setting bounds this.getLayoutParams().width/height is used, however when user specifies the width/height as WRAP_CONTENT or MATCH_PARENT it will return a constant -1 for MATCH_PARENT or -2 for WRAP_CONTENT, which just kills it. Using getWidth() seems to work, but I haven't fully tested it yet!

Not Working

could put more examples of how to use your lib project in android?

License

Hi, this is a great library ๐Ÿ‘

Can you specify the license for it? Thanks

Gradle dependency causes AndroidManifest errors

After I install this dependency, I'm getting some AndroidManifest issues (Android 1.2.2 - Gradle tools 1.2.3).

Error:(11, 9) Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:11:9
Error:(13, 9) Attribute application@theme value=(@style/AppTheme) from AndroidManifest.xml:13:9
is also present at com.github.Todd-Davies:ProgressWheel:1.0:14:9 value=(@android:style/Theme.NoTitleBar)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:8:5 to override

readme's demo is wrong

  1. Add the following to your attrs.xml file (in res/values):
<declare-styleable name="ProgressWheel">   
        <attr name="pwText" format="string" />
        <attr name="pwTextColor" format="color" />
        <attr name="pwTextSize" format="dimension" />
        <attr name="pwBarColor" format="color" />
        <attr name="pwRimColor" format="color" />
        <attr name="pwRimWidth" format="dimension" />
        <attr name="pwSpinSpeed" format="dimension" />
        <attr name="pwDelayMillis" format="integer" />
        <attr name="pwCircleColor" format="color" />
        <attr name="pwRadius" format="dimension" />
        <attr name="pwBarWidth" format="dimension" />
        <attr name="pwBarLength" format="dimension" />
        <attr name="pwContourColor" format="color" />
        <attr name="pwContourSize" format="dimension" />
</declare-styleable> 
  1. Add the following code to the root view of your layout:
    xmlns:ProgressWheel="http://schemas.android.com/apk/res/com.visualdenim.schooltraq"
  2. Add the widget code in the appropriate place in your xml file. Here's a sample implementation:
<com.todddavies.components.progressbar.ProgressWheel   
    android:id="@+id/pw_spinner"     
    android:layout_width="200dp"    
    android:layout_height="200dp"   
    android:layout_centerInParent="true"   
    ProgressWheel:pwText="Authenticating..."    
    ProgressWheel:pwTextColor="#222"   
    ProgressWheel:pwTextSize="14sp"   
    ProgressWheel:pwRimColor="#330097D6"   
    ProgressWheel:pwBarLength="60dp"    
    ProgressWheel:pwBarColor="#0097D6"   
    ProgressWheel:pwBarWidth="5dp"   
    ProgressWheel:pwRimWidth="2dp" /> 

bar length

I am trying to tamper with bar length attribute but nothing seems to change. How does it work exactly?
(thanks for the overall good work on this widget by the way)

Progess wheel radius

Hi Todd i am very much impressed with your work.
but u didnt mentioned for specific radis of the circle.
i want radius of 100dp progress circle in increment mode how to achieve it.

i dont want any rim.
i want plain circle in increment mode

Allowing to set the circle value

Hello,

I have not found a way to manually set the progress value.

Am I missing something?

I just added this:

public void setProgress(int i) {
    isSpinning = false;
    progress=i;
    spinHandler.sendEmptyMessage(0);
}

Is there a better way to achieve this? Maybe you would like to add it the lib...

Failed to resolve Gradle dependency

No matter what I try, I just can't get this to work as a Gradle dependency.
Can someone tell me what I'm doing wrong?
I just get the following error:
Error:(24, 13) Failed to resolve: com.github.Todd-Davies:ProgressWheel:1.0
The repo and the dependency are both configured in my project just like any other library but this one just won't work

Potential memory leak?

If we start spin it will forever post messages to handler (to update view). Since there are always messages in queue gc won't be able to collect this handler and therefore won't collect view and context it's attached to. So the only way to avoid leak is to call stop spin manually, which is troublesome in some situations.
Maybe view should override onDetachedFromWindow to stop message posting to handler, but save state, so on the next attach it will start spinning again.

Change bar color dynamically

Hi there,

Is there any way to change the bar color in the middle of the progress?
I am using a timer and i want to change the color of the bar every tick depending on a certain algorithm

does not respond to different dpis

there seems to be large layout problems, you cant use fill_parent, wrap_content and even dp wont scale between resolutions. Client says it appears as a tiny dot for him even when ive specified 58dp, wonder whats going on ?

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.