DownloadProgressBar

  • A+
所属分类:Android开源

DownloadProgressBar是一个Android库,提供出色的自定义进度条。你可以在每一个方式来操纵它的状态。

先看效果:

 

 

 

Attributes

Attribute Type Usage
app:circleRadius dimension The dimension of the circle radius
app:strokeWidth dimension The dimension of the circle stroke width
app:lineWidth dimension Color used for the progress completed
app:progressDuration integer Duration of progress. Default value is set to 1000 ms
app:resultDuration integer Duration of result, either success and error. Default set to 4000 ms
app:overshootValue dimension Value of overshoot interpolator (used for popping up the circle)
app:drawingColor color Color used for drawing inside drawables (white on gif)
app:progressColor color Color used for drawing the progress (white on gif)
app:circleBackgroundColor color Color used for drawing background circle (light blue on gif)
app:progressBackgroundColor color Color used for drawing progress background (light blue on gif)

 

基础用法:

v1.1

  • Added new animation - ManipulateProgressAnimation - now you can set your progress manually. The default result is set to Success. Just play the animation with:
downloadProgressBar.playManualProgressAnimation();
  • You can change the result type with:
downloadProgressBar.setErrorResultState();

or

downloadProgressBar.setSuccessResultState();
  • To set the progress use setProgress method. The value must be between 1-100 - it determines percent value:
downloadProgressBar.setProgress(value);
  • You can abort the progress and set the error result immediately just by typing:
downloadProgressBar.abortDownload();
  • Also I've added two methods to the callback - onManualProgressStarted() and onManualProgressEnded(). They're called everytime the setProgress() method ends.

做监听:

  1. downloadProgressBar.setOnProgressUpdateListener(new DownloadProgressBar.OnProgressUpdateListener() {
  2.             @Override
  3.             public void onProgressUpdate(float currentPlayTime) {
  4.                 // Here we are setting % value on our text view.
  5.                 successTextView.setText(Math.round(currentPlayTime / 3.6) + " %");
  6.             }
  7.             @Override
  8.             public void onAnimationStarted() {
  9.                 // Here we are disabling our view because of possible interactions while animating.
  10.                 downloadProgressBar.setEnabled(false);
  11.             }
  12.             @Override
  13.             public void onAnimationEnded() {
  14.                 successTextView.setText("Click to download");
  15.                 downloadProgressBar.setEnabled(true);
  16.             }
  17.             @Override
  18.             public void onAnimationSuccess() {
  19.                 successTextView.setText("Downloaded!");
  20.             }
  21.             @Override
  22.             public void onAnimationError() {
  23.             }
  24.         });
GitHub 仓库挂件 WordPress 插件

panwrona / DownloadProgressBar

DownloadProgressBar is an android library that delivers awesome custom progress bar. You can manipulate it's state in every way.

 

 

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:1   其中:访客  1   博主  0

    • avatar ioskaifa 0

      动画不错!