├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bolex │ │ └── circleprogressview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── bolex │ │ │ └── circleprogressview │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── bolex │ └── circleprogressview │ └── ExampleUnitTest.java ├── build.gradle ├── circleprogresslibrary ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bolex │ │ └── circleprogresslibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── bolex │ │ │ └── circleprogresslibrary │ │ │ └── CircleProgressView.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── bolex │ └── circleprogresslibrary │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── show.gif └── show.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 bolex 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CircleProgressView 2 | 一个圆型进度条,带头部进度显示,颜色、宽度大小等高度可配置 3 | 4 | # 效果 5 | ![](./show.png) 6 | ![](./show.gif) 7 | 8 | 9 | ## 支持属性 10 | #### CircleProgressView 11 | 12 | | 属性名 | 属性说明 | 类型 | 13 | | :------------------: | :-------------------------------: |:--------------:| 14 | | progressBackgroundColor | 进度条背景色 | color | 15 | | progressColor | 进度条前景色 | color | 16 | | progressHeadColor | 头部圆圈颜色 | color | 17 | | textColor | 头部进度文字字体颜色 | color | 18 | | startupText | 是否显示文字进度(boolean) | boolean | 19 | |progressBackgroundWidth| 进度条背景宽度 | dimension | 20 | |progressWidth | 进度条宽度 |dimension | 21 | |progressHeadRadius | 头部圆圈半径 |dimension | 22 | |textSize | 头部进度文字大小 |dimension | 23 | |maxProgressValue | 最大进度 |integer | 24 | |progressValue | 当前默认进度 |integer | 25 | 26 | ## 使用 27 | 28 | - 添加到你项目的根build.gradle脚本代码中: 29 | ``` 30 | allprojects { 31 | repositories { 32 | ... 33 | maven { url 'https://jitpack.io' } 34 | } 35 | } 36 | ``` 37 | 38 | - 添加 dependency 39 | 40 | ``` 41 | dependencies { 42 | compile 'com.github.BolexLiu:CircleProgressView:v1.0.0' 43 | } 44 | ``` 45 | 46 | - 在布局文件中添加CircleProgressView并设置相关自定义属性 47 | 48 | ```xml 49 | 60 | ``` 61 | 62 | - 进度获取和设置 63 | 64 | ``` java 65 | mCircleProgressView.getmProgressValue(); 66 | mCircleProgressView1.setProgress(10); 67 | 68 | ``` 69 | 70 | - 颜色和大小等属性配置 Api请参考属性表 71 | 72 | ```java 73 | mCircleProgressView.setmProgressBackgroundColor(); 74 | mCircleProgressView.setmProgressHeadColor(); 75 | mCircleProgressView.setmProgressColor(); 76 | mCircleProgressView.setmProgressHeadColor(); 77 | 78 | mCircleProgressView.setmTextSize(); 79 | mCircleProgressView.setmTextColor(); 80 | mCircleProgressView.setmStartupText(); 81 | mCircleProgressView.setmProgressWidth(); 82 | 83 | mCircleProgressView.setmProgressBackgroundWidth() 84 | mCircleProgressView.setmProgressWidth() 85 | 86 | mCircleProgressView.setmMaxProgressValue() 87 | mCircleProgressView.setmProgressHeadRadius() 88 | 89 | ``` 90 | 91 | ## License 92 | 93 | ``` 94 | MIT License 95 | 96 | Copyright (c) 2017 bolex 97 | 98 | Permission is hereby granted, free of charge, to any person obtaining a copy 99 | of this software and associated documentation files (the "Software"), to deal 100 | in the Software without restriction, including without limitation the rights 101 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 102 | copies of the Software, and to permit persons to whom the Software is 103 | furnished to do so, subject to the following conditions: 104 | 105 | The above copyright notice and this permission notice shall be included in all 106 | copies or substantial portions of the Software. 107 | 108 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 109 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 110 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 111 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 112 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 113 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 114 | SOFTWARE. 115 | ``` 116 | 117 | 118 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.bolex.circleprogressview" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.1.1' 28 | testCompile 'junit:junit:4.12' 29 | compile project(':circleprogresslibrary') 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android_sdk\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/bolex/circleprogressview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.bolex.circleprogressview; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.bolex.circleprogressview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/bolex/circleprogressview/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.bolex.circleprogressview; 2 | 3 | import android.graphics.Color; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.Button; 8 | 9 | import com.bolex.circleprogresslibrary.CircleProgressView; 10 | 11 | public class MainActivity extends AppCompatActivity { 12 | 13 | private CircleProgressView mCircleProgressView1; 14 | private CircleProgressView mCircleProgressView2; 15 | private CircleProgressView mCircleProgressView3; 16 | private Button add; 17 | private Button change_color; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_main); 23 | mCircleProgressView1 = (CircleProgressView) findViewById(R.id.circleProgressView1); 24 | mCircleProgressView2 = (CircleProgressView) findViewById(R.id.circleProgressView2); 25 | mCircleProgressView3 = (CircleProgressView) findViewById(R.id.circleProgressView3); 26 | add = (Button) findViewById(R.id.add); 27 | change_color = (Button) findViewById(R.id.change_color); 28 | change_color.setOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View v) { 31 | mCircleProgressView2.setmProgressBackgroundColor(Color.parseColor("#FF5722")); 32 | mCircleProgressView2.setmProgressHeadColor(Color.parseColor("#FF5722")); 33 | mCircleProgressView3.setmProgressColor(Color.parseColor("#689F38")); 34 | mCircleProgressView3.setmProgressHeadColor(Color.parseColor("#689F38")); 35 | } 36 | }); 37 | 38 | add.setOnClickListener(new View.OnClickListener() { 39 | @Override 40 | public void onClick(View v) { 41 | float v1 = mCircleProgressView1.getmProgressValue(); 42 | mCircleProgressView1.setProgress(v1+10); 43 | mCircleProgressView2.setProgress(v1+10); 44 | mCircleProgressView3.setProgress(v1+10); 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 20 | 21 | 26 | 27 | 38 | 49 | 50 | 51 | 52 | 53 |