├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── xuyong.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── xuyong │ │ └── circleprogress │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── xuyong │ │ │ └── circleprogress │ │ │ ├── ArcProgressBar.java │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── xuyong │ └── circleprogress │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screen └── xiaoguotu.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/xuyong.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Android > Lint > Correctness 39 | 40 | 41 | Android > Lint > Internationalization 42 | 43 | 44 | Android > Lint > Security 45 | 46 | 47 | Class metricsJava 48 | 49 | 50 | Class structureJava 51 | 52 | 53 | Cloning issuesJava 54 | 55 | 56 | Code style issuesJava 57 | 58 | 59 | Control flow issuesJava 60 | 61 | 62 | Declaration redundancyJava 63 | 64 | 65 | DeclarationGroovy 66 | 67 | 68 | Dependency issuesJava 69 | 70 | 71 | Encapsulation issuesJava 72 | 73 | 74 | Error handlingGroovy 75 | 76 | 77 | Error handlingJava 78 | 79 | 80 | Finalization issuesJava 81 | 82 | 83 | Google Cloud Endpoints 84 | 85 | 86 | Groovy 87 | 88 | 89 | HTML 90 | 91 | 92 | ImportsJava 93 | 94 | 95 | Inheritance issuesJava 96 | 97 | 98 | Initialization issuesJava 99 | 100 | 101 | Internationalization issuesJava 102 | 103 | 104 | J2ME issuesJava 105 | 106 | 107 | Java 108 | 109 | 110 | Java language level migration aidsJava 111 | 112 | 113 | Javadoc issuesJava 114 | 115 | 116 | Memory issuesJava 117 | 118 | 119 | Method metricsJava 120 | 121 | 122 | Naming conventionsJava 123 | 124 | 125 | Packaging issuesJava 126 | 127 | 128 | Performance issuesJava 129 | 130 | 131 | Potentially confusing code constructsGroovy 132 | 133 | 134 | Probable bugsJava 135 | 136 | 137 | Properties Files 138 | 139 | 140 | RELAX NG 141 | 142 | 143 | Security issuesJava 144 | 145 | 146 | Threading issuesGroovy 147 | 148 | 149 | Threading issuesJava 150 | 151 | 152 | Visibility issuesJava 153 | 154 | 155 | XML 156 | 157 | 158 | 159 | 160 | Android 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 182 | 183 | 185 | 186 | 187 | 188 | 189 | 1.8 190 | 191 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CircleProgress 2 | 自定义圆弧刻度,和市场上大部分信用额度的圆弧显示差不多,这是公司项目中用到,单独抽出来。 3 | 自定义属性attrs已经set方法api及释义如下: 4 | ----------------------- 5 | 6 | | Attribute | default value | xml | java | 释义 | 7 | |------------------|------------------------|--------------------------|-------------------------------|-----------------| 8 | | arcDistance |mPdDistance | arcDistance| setmPdDistance(int mPdDistance)| 圆弧两边的距离 9 | | arcBgColor |mArcBgColor | arcBgColor| setmArcBgColor(int mArcBgColor)| 背景圆弧的颜色 10 | | arcForeEndColor |mArcForeEndColor| arcForeEndColor| setmArcForeEndColor(int mArcForeEndColor)|前景圆弧渐变结束时的颜色 11 | | arcForeStartColor|mArcForeStartColor| arcForeStartColor| setmArcForeStartColor(int mArcForeStartColor)|前景圆弧渐变开始时候的颜色 12 | | progressTextRunColor|mProgressTextRunColor|progressTextRunColor|setmProgressTextRunColor(int mProgressTextRunColor)|进度文字颜色 13 | | dottedDefaultColor|mDottedDefaultColor| dottedDefaultColor|setmDottedDefaultColor(int mDottedDefaultColor)|虚线默认颜色 14 | | dottedRunColor |mDottedRunColor| dottedRunColor|setmDottedRunColor(int mDottedRunColor)|虚线变动颜色 15 | | dottedLineCount |mDottedLineCount| dottedLineCount|setmDottedLineCount(int mDottedLineCount)|画多少线条数 16 | | dottedLineWidth |mDottedLineWidth| dottedLineWidth|setmDottedLineWidth(int mDottedLineWidth)|线条宽度 17 | | dottedLineHeight |mDottedLineHeight| dottedLineHeight|setmDottedLineHeight(int mDottedLineHeight)|线条高度 18 | | lineDistance|mLineDistance| lineDistance|setmLineDistance(int mLineDistance)|圆弧和虚线之间的距离 19 | | progressMax |mProgressMax| progressMax|setmProgressMax(int mProgressMax)|进度条最大值 20 | | progressTextSize |mProgressTextSize| progressTextSize|setmProgressTextSize(int mProgressTextSize)|进度文字大小 21 | | progressDesc |mProgressDesc| progressDesc|setmProgressDesc(String mProgressDesc)|进度文字描述 22 | | arcUseGradient |useGradient| arcUseGradient|setUseGradient(boolean useGradient)|是否使用渐变 23 | 24 | ----------------------------- 25 | 效果图:切到分支1查看 26 | 27 | -------------------------------------------------------------------------------- /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.xuyong.circleprogress" 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(dir: 'libs', include: ['*.jar']) 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.3.1' 28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 29 | testCompile 'junit:junit:4.12' 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 /Users/xuyong/Library/Android/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/xuyong/circleprogress/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.xuyong.circleprogress; 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.xuyong.circleprogress", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/xuyong/circleprogress/ArcProgressBar.java: -------------------------------------------------------------------------------- 1 | package com.xuyong.circleprogress; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Canvas; 7 | import android.graphics.Color; 8 | import android.graphics.LinearGradient; 9 | import android.graphics.Paint; 10 | import android.graphics.Path; 11 | import android.graphics.Rect; 12 | import android.graphics.RectF; 13 | import android.graphics.Shader; 14 | import android.text.TextUtils; 15 | import android.util.AttributeSet; 16 | import android.util.DisplayMetrics; 17 | import android.view.View; 18 | import android.view.WindowManager; 19 | 20 | /** 21 | * Created by xuyong on 17/7/17. 22 | */ 23 | public class ArcProgressBar extends View { 24 | /** 25 | * 外层背景圆弧画笔 26 | */ 27 | private Paint mArcBgPaint; 28 | /** 29 | * 外层前景圆弧画笔 30 | */ 31 | private Paint mArcForePaint; 32 | /** 33 | * 内层虚线画笔 34 | */ 35 | private Paint mDottedLinePaint; 36 | /** 37 | * 底部字矩形背景画笔 38 | */ 39 | private Paint mRonudRectPaint; 40 | /** 41 | * 中间进度画笔 42 | */ 43 | private Paint mProgressPaint; 44 | /** 45 | * 外层圆弧需要 46 | */ 47 | private RectF mArcRect; 48 | /** 49 | * 圆弧宽度 50 | */ 51 | private float mArcWidth = 11.0f; 52 | /** 53 | * 背景圆弧颜色 54 | */ 55 | private int mArcBgColor = 0xFFC9D7EC; 56 | /** 57 | * 前景圆弧结束颜色 58 | */ 59 | private int mArcForeEndColor = 0xFF46D0FA; 60 | /** 61 | * 前景圆弧开始颜色 62 | */ 63 | private int mArcForeStartColor = 0xFF3486D7; 64 | /** 65 | * 虚线默认颜色 66 | */ 67 | private int mDottedDefaultColor = 0xFF9799A1; 68 | /** 69 | * 虚线变动颜色 70 | */ 71 | private int mDottedRunColor = 0xFF3895EB; 72 | /** 73 | * 圆弧两边的距离 74 | */ 75 | private int mPdDistance = 50; 76 | 77 | /** 78 | * 线条数 79 | */ 80 | private int mDottedLineCount = 100; 81 | /** 82 | * 线条宽度 83 | */ 84 | private int mDottedLineWidth = 40; 85 | /** 86 | * 线条高度 87 | */ 88 | private int mDottedLineHeight = 6; 89 | /** 90 | * 圆弧跟虚线之间的距离 91 | */ 92 | private int mLineDistance = 8; 93 | /** 94 | * 进度条最大值 95 | */ 96 | private int mProgressMax = 100; 97 | /** 98 | * 进度文字大小 99 | */ 100 | private int mProgressTextSize = 35; 101 | /** 102 | * 进度文字颜色 103 | */ 104 | private int mProgressTextRunColor = 0xFFDA6E81; 105 | 106 | /** 107 | * 进度描述 108 | */ 109 | private String mProgressDesc; 110 | 111 | //是否使用渐变 112 | protected boolean useGradient = true; 113 | 114 | private int mScressWidth; 115 | private int mProgress; 116 | private float mExternalDottedLineRadius; 117 | private float mInsideDottedLineRadius; 118 | private int mArcCenterX; 119 | private int mArcRadius; // 圆弧半径 120 | private double bDistance; 121 | private double aDistance; 122 | private boolean isRestart = false; 123 | private int mRealProgress; 124 | 125 | 126 | public ArcProgressBar(Context context) { 127 | this(context, null, 0); 128 | } 129 | 130 | public ArcProgressBar(Context context, AttributeSet attrs) { 131 | this(context, attrs, 0); 132 | } 133 | 134 | public ArcProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { 135 | super(context, attrs, defStyleAttr); 136 | intiAttributes(context, attrs); 137 | initView(); 138 | } 139 | 140 | //开放api// 141 | public void setmArcBgColor(int mArcBgColor) { 142 | this.mArcBgColor = mArcBgColor; 143 | } 144 | 145 | public void setmArcForeEndColor(int mArcForeEndColor) { 146 | this.mArcForeEndColor = mArcForeEndColor; 147 | } 148 | 149 | public void setmArcForeStartColor(int mArcForeStartColor) { 150 | this.mArcForeStartColor = mArcForeStartColor; 151 | } 152 | 153 | public void setmDottedDefaultColor(int mDottedDefaultColor) { 154 | this.mDottedDefaultColor = mDottedDefaultColor; 155 | } 156 | 157 | public void setmDottedRunColor(int mDottedRunColor) { 158 | this.mDottedRunColor = mDottedRunColor; 159 | } 160 | 161 | public void setmPdDistance(int mPdDistance) { 162 | this.mPdDistance = mPdDistance; 163 | } 164 | 165 | public void setmDottedLineCount(int mDottedLineCount) { 166 | this.mDottedLineCount = mDottedLineCount; 167 | } 168 | 169 | public void setmDottedLineWidth(int mDottedLineWidth) { 170 | this.mDottedLineWidth = mDottedLineWidth; 171 | } 172 | 173 | public void setmDottedLineHeight(int mDottedLineHeight) { 174 | this.mDottedLineHeight = mDottedLineHeight; 175 | } 176 | 177 | public void setmLineDistance(int mLineDistance) { 178 | this.mLineDistance = mLineDistance; 179 | } 180 | 181 | public void setmProgressMax(int mProgressMax) { 182 | this.mProgressMax = mProgressMax; 183 | } 184 | 185 | public void setmProgressTextSize(int mProgressTextSize) { 186 | this.mProgressTextSize = mProgressTextSize; 187 | } 188 | 189 | public void setmProgressTextRunColor(int mProgressTextRunColor) { 190 | this.mProgressTextRunColor = mProgressTextRunColor; 191 | } 192 | 193 | public void setmProgressDesc(String mProgressDesc) { 194 | this.mProgressDesc = mProgressDesc; 195 | } 196 | 197 | public void setUseGradient(boolean useGradient) { 198 | this.useGradient = useGradient; 199 | } 200 | 201 | //开放api// 202 | 203 | private void intiAttributes(Context context, AttributeSet attrs) { 204 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ArcProgressBar); 205 | mPdDistance = a.getInteger(R.styleable.ArcProgressBar_arcDistance, mPdDistance); 206 | mArcBgColor = a.getColor(R.styleable.ArcProgressBar_arcBgColor, mArcBgColor); 207 | mArcForeStartColor = a.getColor(R.styleable.ArcProgressBar_arcForeStartColor, mArcForeStartColor); 208 | mArcForeEndColor = a.getColor(R.styleable.ArcProgressBar_arcForeEndColor, mArcForeEndColor); 209 | mDottedDefaultColor = a.getColor(R.styleable.ArcProgressBar_dottedDefaultColor, mDottedDefaultColor); 210 | mDottedRunColor = a.getColor(R.styleable.ArcProgressBar_dottedRunColor, mDottedRunColor); 211 | mDottedLineCount = a.getInteger(R.styleable.ArcProgressBar_dottedLineCount, mDottedLineCount); 212 | mDottedLineWidth = a.getInteger(R.styleable.ArcProgressBar_dottedLineWidth, mDottedLineWidth); 213 | mDottedLineHeight = a.getInteger(R.styleable.ArcProgressBar_dottedLineHeight, mDottedLineHeight); 214 | mLineDistance = a.getInteger(R.styleable.ArcProgressBar_lineDistance, mLineDistance); 215 | mProgressMax = a.getInteger(R.styleable.ArcProgressBar_progressMax, mProgressMax); 216 | mProgressTextSize = a.getInteger(R.styleable.ArcProgressBar_progressTextSize, mProgressTextSize); 217 | mProgressDesc = a.getString(R.styleable.ArcProgressBar_progressDesc); 218 | mProgressTextRunColor = a.getColor(R.styleable.ArcProgressBar_progressTextRunColor, mProgressTextRunColor); 219 | useGradient = a.getBoolean(R.styleable.ArcProgressBar_arcUseGradient, useGradient); 220 | a.recycle(); 221 | } 222 | 223 | private void initView() { 224 | int[] screenWH = getScreenWH(); 225 | mScressWidth = screenWH[0]; 226 | // 外层背景圆弧的画笔 227 | mArcBgPaint = new Paint(); 228 | mArcBgPaint.setAntiAlias(true); 229 | mArcBgPaint.setStyle(Paint.Style.STROKE); 230 | mArcBgPaint.setStrokeWidth(dp2px(getResources(), mArcWidth)); 231 | mArcBgPaint.setColor(mArcBgColor); 232 | mArcBgPaint.setStrokeCap(Paint.Cap.ROUND); 233 | // 外层前景圆弧的画笔 234 | mArcForePaint = new Paint(); 235 | mArcForePaint.setAntiAlias(true); 236 | mArcForePaint.setStyle(Paint.Style.STROKE); 237 | mArcForePaint.setStrokeWidth(dp2px(getResources(), mArcWidth)); 238 | mArcForePaint.setStrokeCap(Paint.Cap.ROUND); 239 | // 内测虚线的画笔 240 | mDottedLinePaint = new Paint(); 241 | mDottedLinePaint.setAntiAlias(true); 242 | mDottedLinePaint.setStrokeWidth(dp2px(getResources(), mDottedLineHeight)); 243 | mDottedLinePaint.setColor(mDottedDefaultColor); 244 | // 245 | mRonudRectPaint = new Paint(); 246 | mRonudRectPaint.setAntiAlias(true); 247 | mRonudRectPaint.setColor(mDottedRunColor); 248 | mRonudRectPaint.setStyle(Paint.Style.FILL); 249 | // 中间进度画笔 250 | mProgressPaint = new Paint(); 251 | mProgressPaint.setAntiAlias(true); 252 | } 253 | 254 | @Override 255 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 256 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 257 | // int width = mScressWidth - 2 * mPdDistance; 258 | // setMeasuredDimension(width, width); 259 | } 260 | 261 | @Override 262 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 263 | super.onSizeChanged(w, h, oldw, oldh); 264 | mArcCenterX = (int) (w / 2.f); 265 | 266 | mArcRect = new RectF(); 267 | mArcRect.top = 0; 268 | mArcRect.left = 0; 269 | mArcRect.right = w; 270 | mArcRect.bottom = h; 271 | mArcRect.inset(dp2px(getResources(), mArcWidth) / 2, dp2px(getResources(), mArcWidth) / 2);//设置矩形的宽度 272 | mArcRadius = (int) (mArcRect.width() / 2); 273 | 274 | double sqrt = Math.sqrt(mArcRadius * mArcRadius + mArcRadius * mArcRadius); 275 | bDistance = Math.cos(Math.PI * 45 / 180) * mArcRadius; 276 | aDistance = Math.sin(Math.PI * 45 / 180) * mArcRadius; 277 | 278 | // 内部虚线的外部半径 279 | mExternalDottedLineRadius = mArcRadius - dp2px(getResources(), mArcWidth) / 2 - dp2px(getResources(), mLineDistance); 280 | // 内部虚线的内部半径 281 | mInsideDottedLineRadius = mExternalDottedLineRadius - dp2px(getResources(), mDottedLineWidth); 282 | if (useGradient) { 283 | LinearGradient gradient = new LinearGradient(0, 0, getMeasuredWidth(), getMeasuredHeight(), mArcForeEndColor, mArcForeStartColor, Shader.TileMode.CLAMP); 284 | mArcForePaint.setShader(gradient); 285 | } else { 286 | mArcForePaint.setColor(mArcForeStartColor); 287 | } 288 | } 289 | 290 | @Override 291 | protected void onDraw(Canvas canvas) { 292 | super.onDraw(canvas); 293 | mArcBgPaint.setColor(mArcBgColor); 294 | canvas.drawText("信用额度", mArcCenterX - mProgressPaint.measureText("信用额度") / 2, 295 | mArcCenterX - (mProgressPaint.descent() + mProgressPaint.ascent()) / 2 - dp2px(getResources(), 20), mProgressPaint); 296 | drawDottedLineArc(canvas); 297 | drawRunDottedLineArc(canvas); 298 | drawRunText(canvas); 299 | canvas.rotate(135, mArcCenterX, mArcCenterX); 300 | canvas.drawArc(mArcRect, 0, 270, false, mArcBgPaint);//画背景圆弧 301 | // canvas.drawRect(mArcRect, mArcBgPaint);//画直角矩形 302 | // canvas.drawCircle(400, 400, 100, mArcForePaint);//画圆 303 | canvas.drawArc(mArcRect, 0, 0, false, mArcForePaint);//画前景圆弧 304 | // canvas.drawColor(Color.TRANSPARENT);//设置画布背景 305 | // canvas.drawLine(100, 100, 400, 400, mArcBgPaint);//画直线 306 | // canvas.drawPoint(500, 500, mArcBgPaint);//画点 307 | mProgressPaint.setColor(getResources().getColor(R.color.gray)); 308 | mProgressPaint.setTextSize(dp2px(getResources(), 18)); 309 | drawRunFullLineArc(canvas); 310 | if (isRestart) { 311 | drawDottedLineArc(canvas); 312 | } 313 | } 314 | 315 | private void drawRunText(Canvas canvas) { 316 | String progressStr = (mRealProgress * 25) + ""; 317 | if (!TextUtils.isEmpty(mProgressDesc)) { 318 | progressStr = mProgressDesc; 319 | } 320 | mProgressPaint.setTextSize(dp2px(getResources(), mProgressTextSize)); 321 | mProgressPaint.setColor(mProgressTextRunColor); 322 | canvas.drawText(progressStr, mArcCenterX - mProgressPaint.measureText(progressStr) / 2, 323 | mArcCenterX - (mProgressPaint.descent() + mProgressPaint.ascent()) / 2 + dp2px(getResources(), 13), mProgressPaint); 324 | } 325 | 326 | public void restart() { 327 | isRestart = true; 328 | this.mRealProgress = 0; 329 | this.mProgressDesc = ""; 330 | invalidate(); 331 | } 332 | 333 | /** 334 | * 设置中间进度描述 335 | * 336 | * @param desc 337 | */ 338 | public void setProgressDesc(String desc) { 339 | this.mProgressDesc = desc; 340 | postInvalidate(); 341 | } 342 | 343 | /** 344 | * 设置最大进度 345 | * 346 | * @param max 347 | */ 348 | public void setMaxProgress(int max) { 349 | this.mProgressMax = max; 350 | } 351 | 352 | /** 353 | * 设置当前进度 354 | * 355 | * @param progress 356 | */ 357 | public void setProgress(int progress) { 358 | // 进度100% = 控件的75% 359 | this.mRealProgress = progress; 360 | isRestart = false; 361 | this.mProgress = ((mDottedLineCount * 3 / 4) * progress) / mProgressMax; 362 | postInvalidate(); 363 | } 364 | 365 | 366 | /** 367 | * 虚线变动 368 | * 369 | * @param canvas 370 | */ 371 | private void drawRunDottedLineArc(Canvas canvas) { 372 | mDottedLinePaint.setColor(mDottedRunColor); 373 | float evenryDegrees = (float) (2.0f * Math.PI / mDottedLineCount); 374 | 375 | float startDegress = (float) (225 * Math.PI / 180) + evenryDegrees / 2; 376 | 377 | for (int i = 0; i < mProgress; i++) { 378 | float degrees = i * evenryDegrees + startDegress; 379 | 380 | float startX = mArcCenterX + (float) Math.sin(degrees) * mInsideDottedLineRadius; 381 | float startY = mArcCenterX - (float) Math.cos(degrees) * mInsideDottedLineRadius; 382 | 383 | float stopX = mArcCenterX + (float) Math.sin(degrees) * mExternalDottedLineRadius; 384 | float stopY = mArcCenterX - (float) Math.cos(degrees) * mExternalDottedLineRadius; 385 | 386 | canvas.drawLine(startX, startY, stopX, stopY, mDottedLinePaint); 387 | } 388 | } 389 | 390 | /** 391 | * 实线变动 392 | * 393 | * @param canvas 394 | */ 395 | private void drawRunFullLineArc(Canvas canvas) { 396 | for (int i = 0; i < mProgress; i++) { 397 | canvas.drawArc(mArcRect, 0, 270 * mProgress / 75, false, mArcForePaint); 398 | } 399 | } 400 | 401 | private void drawDottedLineArc(Canvas canvas) { 402 | mDottedLinePaint.setColor(mDottedDefaultColor); 403 | // 360 * Math.PI / 180 404 | float evenryDegrees = (float) (2.0f * Math.PI / mDottedLineCount); 405 | 406 | float startDegress = (float) (135 * Math.PI / 180); 407 | float endDegress = (float) (225 * Math.PI / 180); 408 | 409 | for (int i = 0; i < mDottedLineCount; i++) { 410 | float degrees = i * evenryDegrees; 411 | // 过滤底部90度的弧长 412 | if (degrees > startDegress && degrees < endDegress) { 413 | continue; 414 | } 415 | 416 | float startX = mArcCenterX + (float) Math.sin(degrees) * mInsideDottedLineRadius; 417 | float startY = mArcCenterX - (float) Math.cos(degrees) * mInsideDottedLineRadius; 418 | 419 | float stopX = mArcCenterX + (float) Math.sin(degrees) * mExternalDottedLineRadius; 420 | float stopY = mArcCenterX - (float) Math.cos(degrees) * mExternalDottedLineRadius; 421 | 422 | 423 | canvas.drawLine(startX, startY, stopX, stopY, mDottedLinePaint); 424 | } 425 | } 426 | 427 | private int[] getScreenWH() { 428 | WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); 429 | DisplayMetrics displayMetrics = new DisplayMetrics(); 430 | windowManager.getDefaultDisplay().getMetrics(displayMetrics); 431 | int[] wh = {displayMetrics.widthPixels, displayMetrics.heightPixels}; 432 | return wh; 433 | } 434 | 435 | private float dp2px(Resources resources, float dp) { 436 | final float scale = resources.getDisplayMetrics().density; 437 | return dp * scale + 0.5f; 438 | } 439 | } 440 | -------------------------------------------------------------------------------- /app/src/main/java/com/xuyong/circleprogress/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.xuyong.circleprogress; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.animation.ValueAnimator; 6 | import android.graphics.Canvas; 7 | import android.graphics.Paint; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | 11 | public class MainActivity extends AppCompatActivity { 12 | private ArcProgressBar mArcProgressBar; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | mArcProgressBar = (ArcProgressBar) findViewById(R.id.arcProgressBar); 19 | ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 61); 20 | valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 21 | @Override 22 | public void onAnimationUpdate(ValueAnimator animation) { 23 | mArcProgressBar.setProgress((int) animation.getAnimatedValue()); 24 | } 25 | }); 26 | valueAnimator.addListener(new AnimatorListenerAdapter() { 27 | @Override 28 | public void onAnimationEnd(Animator animation) { 29 | super.onAnimationEnd(animation); 30 | mArcProgressBar.setProgressDesc("1530"); 31 | } 32 | }); 33 | valueAnimator.setDuration(5000); 34 | valueAnimator.start(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #999999 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CircleProgress 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/xuyong/circleprogress/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xuyong.circleprogress; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 17 14:32:12 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /screen/xiaoguotu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daoxiaomianzi/CircleProgress/ee9a5f199a7b391b698f116d358ef604ab317cef/screen/xiaoguotu.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------