Skip to content

Commit

Permalink
改了一些注释和增加README
Browse files Browse the repository at this point in the history
  • Loading branch information
totond committed May 17, 2017
1 parent dc29686 commit 53c3a88
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 25 deletions.
16 changes: 8 additions & 8 deletions CustomProgressBar/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.novoda.bintray-release'//添加

android {
compileSdkVersion 23
Expand Down Expand Up @@ -31,11 +31,11 @@ dependencies {
}

publish {
userOrg = 'yanzhikaijky'
repoName = 'CustomViewRepository'
groupId = 'com.yanzhikaijky'
artifactId = 'PictureProgressbar'
publishVersion = '1.0.4'
desc = 'a picture progressbar'
website = 'https://github.com/totond/PictureProgressBar'
userOrg = 'yanzhikaijky' //Binary用户名
repoName = 'CustomViewRepository' //Repository的名字
groupId = 'com.yanzhikaijky' //包名
artifactId = 'PictureProgressbar' //项目名
publishVersion = '1.1.0' //版本号
desc = 'a picture progressbar' //description说明,随便写
website = 'https://github.com/totond/PictureProgressBar'//VCS地址,这里最好写GitHub的,我试过不写然后上传不了
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.view.ViewTreeObserver;

/**
* @author [email protected]
* 一个在当前进度中心带图片和动画的ProgressBar
*/

Expand Down
Binary file removed CustomProgressBar/src/main/res/drawable/b333.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/b666.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i00.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i01.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i02.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i03.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i04.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i05.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/i06.png
Binary file not shown.
Binary file removed CustomProgressBar/src/main/res/drawable/sun1.png
Binary file not shown.
12 changes: 0 additions & 12 deletions CustomProgressBar/src/main/res/drawable/test_shape.xml

This file was deleted.

102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#PictureProgressBar
Welcome to Star or Fork!
##简介
  这是一个可在进度条的当前进度点设置图片的ProgressBar,并且可以设置几种动画模式,效果如图:
![](http://i.imgur.com/076zTuA.gif)

##使用
###Gradle

```
compile 'com.yanzhikaijky:PictureProgressbar:1.0.2'
```

###Maven

```
<dependency>
<groupId>com.yanzhikaijky</groupId>
<artifactId>PictureProgressbar</artifactId>
<version>1.0.2</version>
<type>pom</type>
</dependency>
```

###属性

|**属性名称**|**意义**|**类型**|**默认值**|
|--|--|:--:|:--:|
|backGroundColor | 进度条背景颜色 | color| #888888|
|barColor | 进度条颜色 | color | #ff0000|
|drawable | 进度条图片drawable| drawable| null|
|halfDrawableWidth | drawable宽度 | dimension| 0 |
|halfDrawableHeight | drawable高度 | dimension| 0 |
|drawableHeightOffset | drawable高度偏移量 | dimension | 0 |
|isRound | 进度条是否为圆角 |boolean | true|
|roundX | 进度条圆角X半径 | dimension| 20px|
|roundY | 进度条圆角Y半径 | dimension| 20px|
|progress | 初始进度 | int| 0 |
|max | 最大进度 | int| 0 |
|isSetBar | 是否自定义进度条高度 |boolean |flase |
|progressHeight | 进度条高度 | dimension| 100px |
|progressHeightOffset | 进度条高度偏移量 | dimension| | 30px |
|refreshTime | 刷新时间 | int | 100|
|animMode | 动画模式 | eunm| ANIM_NULL|
|rotateRate | 旋转角度/每次刷新 | int| 10 |
|rotateDegree | 旋转初始角度 | int| 0 |
|scaleMax | 缩放最大倍数 | float| 1.5f|
|scaleMin | 缩放最小倍数 | float| 0.5f|
|scaleRate | 缩放倍数/每次刷新 | float | 0.1|
|gradientStartColor | 进度条渐变色开始颜色 |color | #ff0000 |
|gradientEndColor | 进度条渐变色结束颜色 |color | #ffff00|

> 注意:上面的drawable属性可以是图片,也可以是Shape(demo里面的正方形就是自动画的Shape),其他的类型应该不行了。
**对应的animMode模式有:**

|animMode模式|意义|使用|
|--|--|--
|ANIM_NULL|无动画模式|不需要设置Drawable|
|ANIM_ROTATE|旋转动画模式|需要设置Drawable,最好设置rotateRate、rotateDegree属性,使用时注意动画范围会不会超出View的实际范围,超出部分不会显示|
|ANIM_SCALE |缩放动画模式|需要设置Drawable,最好设置scaleMax、scaleMin,scaleRate属性,使用时注意动画范围会不会超出View的实际范围,超出部分不会显示|
|ANIM_ROTATE_SCALE|旋转加缩放动画模式|需要设置Drawable,上两个模式的属性,使用时注意动画范围会不会超出View的实际范围,超出部分不会显示|
|ANIM_FRAME|帧动画模式|不需要设置Drawable,需要设置drawableIds数组|


除了上面属性的set、get方法,还有:

```
//设置动画开关
public void setAnimRun(boolean isAnimRun)
//设置帧动画时要传入的图片ID数组
public void setDrawableIds(int[] drawableIds)
//设置图片
public void setPicture(int id)
//设置颜色渐变器
public void setLinearGradient(LinearGradient linearGradient)
//设置进度监听器
public void setOnProgressChangeListener(OnProgressChangeListener onProgressChangeListener)
//进度监听器
public interface OnProgressChangeListener {
//进度改变时的回调
public void onOnProgressChange(int progress);
//进度完成时的回答
public void onOnProgressFinish();
}
```
##开源协议
  PictureProgressBar遵循Apache 2.0开源协议。
##后续
  目前没有加入文字,主要是想不到在哪个位置加比较好。后续看看需求加入文字和一些其它的动画,目前在学习RxJava,看看用观察者模式来实现会不会更好,貌似Android源码的ProgressBar就是基于观察者模式来刷新进度条的,可以继承它来实现试试,不同于我这种定时刷新,减少了资源的消耗,但是这样的话动画的处理会是个难点。

##关于作者
id:炎之铠
炎之铠的邮箱:[email protected]
PictureProgressBar全解析blog:


2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:23.4.0'
testCompile 'junit:junit:4.12'
compile project(':CustomProgressBar')
compile 'com.yanzhikaijky:PictureProgressbar:1.1.0'
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


<Button
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="start"
android:id="@+id/btn_start"
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.novoda:bintray-release:0.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.novoda:bintray-release:0.3.4'//添加bintray-release插件
}
}

allprojects {
repositories {
jcenter()
}
//防止中文注释出错
tasks.withType(Javadoc) {
options {
encoding "UTF-8"
Expand Down

0 comments on commit 53c3a88

Please sign in to comment.