Skip to content

Commit

Permalink
Added gifs and updated readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
panwrona committed Jun 28, 2015
1 parent a4164e5 commit bb514ec
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -2,8 +2,8 @@

Android progress bar with cool animation, inspired by : https://dribbble.com/shots/2012292-Download-Animation

![Download Progress Bar Animation](downloadprogressbar1.gif)
![Download Progress Bar Animation](downloadprogressbar2.gif)
![Download Progress Bar Animation](success.gif)
![Download Progress Bar Animation](error.gif)

---
###Attributes
Expand Down Expand Up @@ -41,18 +41,18 @@ dependencies {
Below I will show You how to use this custom view. First we need to distinguish two kinds of result we can get: success and error.
To play success animation, simply call this one line:
```java
DownloadProgressView downloadProgressView = (DownloadProgressView)findViewById(R.id.download_progress_view);
downloadProgressView.playToSuccess();
DownloadProgressBar downloadProgressBar = (DownloadProgressBar)findViewById(R.id.download_progress_view);
downloadProgressBar.playToSuccess();
```
If you want to play error animation, simply call:
```java
DownloadProgressView downloadProgressView = (DownloadProgressView)findViewById(R.id.download_progress_view);
downloadProgressView.playToError();
DownloadProgressBar downloadProgressBar = (DownloadProgressBar)findViewById(R.id.download_progress_view);
downloadProgressBar.playToError();
```
I've also added listener for common events: whole animation start, whole animation end, progress update, animation success, animation error.
To define it, call this one:
```java
downloadProgressView.setOnProgressUpdateListener(new DownloadProgressView.OnProgressUpdateListener() {
downloadProgressBar.setOnProgressUpdateListener(new DownloadProgressBar.OnProgressUpdateListener() {
@Override
public void onProgressUpdate(float currentPlayTime) {
// Here we are setting % value on our text view.
Expand All @@ -62,13 +62,13 @@ downloadProgressView.setOnProgressUpdateListener(new DownloadProgressView.OnProg
@Override
public void onAnimationStarted() {
// Here we are disabling our view because of possible interactions while animating.
downloadProgressView.setEnabled(false);
downloadProgressBar.setEnabled(false);
}

@Override
public void onAnimationEnded() {
successTextView.setText("Click to download");
downloadProgressView.setEnabled(true);
downloadProgressBar.setEnabled(true);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions app/app.iml
Expand Up @@ -86,6 +86,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
Expand Up @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) {
downloadProgressView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
downloadProgressView.playToSuccess();
downloadProgressView.playToError();
}
});
downloadProgressView.setOnProgressUpdateListener(new DownloadProgressBar.OnProgressUpdateListener() {
Expand All @@ -50,7 +50,7 @@ public void onAnimationSuccess() {

@Override
public void onAnimationError() {

successTextView.setText("Aborted!");
}
});

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Expand Up @@ -5,18 +5,18 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue_primary_color">
android:background="@color/red_primary_color">

<com.panwrona.downloadprogressbar.library.DownloadProgressBar
android:id="@+id/dpv3"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_gravity="center"
android:layout_marginTop="100dp"
dpv:circleBackgroundColor="@color/blue_light_primary_color"
dpv:progressBackgroundColor="@color/blue_light_primary_color"
dpv:progressColor="@color/blue_text_icon_color"
dpv:drawingColor="@color/blue_text_icon_color"
dpv:circleBackgroundColor="@color/red_light_primary_color"
dpv:progressBackgroundColor="@color/red_light_primary_color"
dpv:progressColor="@color/red_text_icon_color"
dpv:drawingColor="@color/red_text_icon_color"
dpv:progressDuration="2000"
dpv:resultDuration="5000"
dpv:circleRadius="48dp"
Expand Down
Binary file added error.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions library/library.iml
Expand Up @@ -85,6 +85,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
Expand Down
Binary file added success.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bb514ec

Please sign in to comment.