Giter Site home page Giter Site logo

progresswheel's Introduction

Progress Wheel

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

Sample Image Sample Image 2 Sample Image 3 Sample Image 4

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="text" format="string" />   
	<attr name="textColor" format="color" />   
	<attr name="textSize" format="dimension" />   
	<attr name="barColor" format="color" />   
	<attr name="rimColor" format="color" />   
	<attr name="rimWidth" format="dimension" />   
	<attr name="spinSpeed" format="integer" />     
	<attr name="circleColor" format="color" />     
	<attr name="radius" format="dimension" />   
	<attr name="barWidth" format="dimension" />   
	<attr name="barLength" 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:text="Authenticating..."    
    ProgressWheel:textColor="#222"   
    ProgressWheel:textSize="14sp"   
    ProgressWheel:rimColor="#330097D6"   
    ProgressWheel:barLength="60dp"    
    ProgressWheel:barColor="#0097D6"   
    ProgressWheel:barWidth="5dp"   
    ProgressWheel:rimWidth="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 .spin() 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.

Todd Davies - 2012

progresswheel's People

Contributors

todd-davies avatar

Watchers

James Cloos avatar Jamie Matthews avatar  avatar

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.