DownloadProgressBar

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.         });

[repo owner="panwrona" name="DownloadProgressBar"]

 

 

avatar
  • 本文由 发表于 2016-05-1811:04:44
andorid crop-裁剪开源项目 Android开源

andorid crop-裁剪开源项目

介绍 一个剪裁图片的开发库,他提供了实现剪裁单张图片的activity,其实现是基于AOSP的代码 使用说明: 因为他提供的方式是activity的形式所以首先你需要在manifest 文件中声明: ...
Android CameraView Android开源

Android CameraView

项目说明 这个项目基于Google的非正式开源的CameraView组件,兼容Camera 1 API和Camera 2 API,提供了相机预览、切换前后摄像头、切换闪光灯、切换预览图片的比例以及拍照...
Android常用图片压缩开源项目——Luban Android开源

Android常用图片压缩开源项目——Luban

Luban Luban(鲁班) —— Android图片压缩工具,仿微信朋友圈压缩策略。 项目描述 目前做App开发总绕不开图片这个元素。但是随着手机拍照分辨率的提升,图片的压缩成为一个很重要的问题。...
匿名

发表评论 取消回复

匿名网友 填写信息

:?: :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

      动画不错!