All Projects → anthonycr → AnimatedProgressBar

anthonycr / AnimatedProgressBar

Licence: Apache-2.0 license
A ProgressBar that animates instead of jumps

Programming Languages

java
68154 projects - #9 most used programming language

AnimatedProgressBar

A ProgressBar that animates smoothly

Branch Build Status
master Build Status
dev Build Status
Latest Version
Download

Usage

From jcenter

  • compile 'com.anthonycr.progress:animated-progress:1.0'

From submodule

  • run git submodule add [email protected]:anthonycr/AnimatedProgressBar.git /yourProject/subFolder
  • include the library in your settings.gradle file
    • include ':animated-progress-bar'
    • project(':animated-progress-bar').projectDir = new File(rootProject.projectDir, '/yourProject/subFolder')
  • compile the project: compile project(':animated-progress-bar')

Other

  • Copy AnimatedProgressBar.java and the contents of attrs.xml into your project and you're all set.

API

XML Usage

<com.anthonycr.progress.AnimatedProgressBar
        xmlns:custom="http://schemas.android.com/apk/res-auto"
        android:id="@+id/progress_view"
        android:layout_width="match_parent"
        android:layout_height="5dp"
        android:background="#424242"
        custom:bidirectionalAnimate="true"
        custom:progressColor="#2196f3"
        custom:animationDuration="300" />
  • progressColor: Set the progress color of the AnimatedProgressBar. Default value is #FF0000.
  • bidirectionalAnimate: Set to true to have it animate up and down, set it to false to only have it animate up. Default is true.
  • animationDuration: Set to the duration in milliseconds that the progress animation sure take. Default value is 500ms.

Java Usage

int progressNum = 50;
progressBar = (AnimatedProgressBar) findViewById(R.id.progress_view);
progressBar.setProgress(50);
progressNum = progressBar.getProgress();
  • void setProgress(int number): a number between 0 and 100 that sets the progress of the view. If you set it out of these bounds, the view will set it to the closest bound, i.e. setting progress to 150 will correct it to 100.
  • int getProgress(): returns an integer of the view's progress between 0 and 100.

License

Copyright 2014 Anthony Restaino

   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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].