├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── qusion
│ │ └── roundprogressbar
│ │ └── MainActivity.kt
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ ├── ic_back.xml
│ ├── ic_bag.xml
│ ├── ic_car.xml
│ ├── ic_coin_stack.xml
│ ├── ic_launcher_background.xml
│ └── ic_pizza.xml
│ ├── font
│ └── roboto.ttf
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.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
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── banner.png
├── build.gradle
├── demo.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lib-roundprogressbar
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── qusion
│ │ └── lib_roundprogressbar
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── qusion
│ │ │ └── lib_roundprogressbar
│ │ │ ├── RoundProgressBar.kt
│ │ │ └── RoundProgressBarAnimation.kt
│ └── res
│ │ └── values
│ │ ├── attr.xml
│ │ └── colors.xml
│ └── test
│ └── java
│ └── com
│ └── qusion
│ └── lib_roundprogressbar
│ └── ExampleUnitTest.kt
├── license.txt
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/kotlin,android,androidstudio
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the ART/Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 | out/
18 |
19 | # Gradle files
20 | .gradle/
21 | build/
22 |
23 | # Local configuration file (sdk path, etc)
24 | local.properties
25 |
26 | # Proguard folder generated by Eclipse
27 | proguard/
28 |
29 | # Log Files
30 | *.log
31 |
32 | # Android Studio Navigation editor temp files
33 | .navigation/
34 |
35 | # Android Studio captures folder
36 | captures/
37 |
38 | # IntelliJ
39 | *.iml
40 | .idea/workspace.xml
41 | .idea/tasks.xml
42 | .idea/gradle.xml
43 | .idea/assetWizardSettings.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 | .idea/caches
47 |
48 | # Keystore files
49 | # Uncomment the following line if you do not want to check your keystore files in.
50 | #*.jks
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 |
55 | # Google Services (e.g. APIs or Firebase)
56 | # google-services.json
57 |
58 | # Freeline
59 | freeline.py
60 | freeline/
61 | freeline_project_description.json
62 |
63 | # fastlane
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
68 | fastlane/readme.md
69 |
70 | ### Android Patch ###
71 | gen-external-apklibs
72 |
73 | ### AndroidStudio ###
74 | # Covers files to be ignored for android development using Android Studio.
75 |
76 | # Built application files
77 |
78 | # Files for the ART/Dalvik VM
79 |
80 | # Java class files
81 |
82 | # Generated files
83 |
84 | # Gradle files
85 | .gradle
86 |
87 | # Signing files
88 | .signing/
89 |
90 | # Local configuration file (sdk path, etc)
91 |
92 | # Proguard folder generated by Eclipse
93 |
94 | # Log Files
95 |
96 | # Android Studio
97 | /*/build/
98 | /*/local.properties
99 | /*/out
100 | /*/*/build
101 | /*/*/production
102 | *.ipr
103 | *~
104 | *.swp
105 |
106 | # Android Patch
107 |
108 | # External native build folder generated in Android Studio 2.2 and later
109 |
110 | # NDK
111 | obj/
112 |
113 | # IntelliJ IDEA
114 | *.iws
115 | /out/
116 |
117 | # User-specific configurations
118 | .idea/*
119 |
120 | # OS-specific files
121 | .DS_Store
122 | .DS_Store?
123 | ._*
124 | .Spotlight-V100
125 | .Trashes
126 | ehthumbs.db
127 | Thumbs.db
128 |
129 | # Legacy Eclipse project files
130 | .classpath
131 | .project
132 | .cproject
133 | .settings/
134 |
135 | # Mobile Tools for Java (J2ME)
136 | .mtj.tmp/
137 |
138 | # Package Files #
139 | *.war
140 | *.ear
141 |
142 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
143 | hs_err_pid*
144 |
145 | ## Plugin-specific files:
146 |
147 | # mpeltonen/sbt-idea plugin
148 | .idea_modules/
149 |
150 | # JIRA plugin
151 | atlassian-ide-plugin.xml
152 |
153 | # Mongo Explorer plugin
154 | .idea/mongoSettings.xml
155 |
156 | # Crashlytics plugin (for Android Studio and IntelliJ)
157 | com_crashlytics_export_strings.xml
158 | crashlytics.properties
159 | crashlytics-build.properties
160 | fabric.properties
161 |
162 | ### AndroidStudio Patch ###
163 |
164 | ### Kotlin ###
165 | # Compiled class file
166 |
167 | # Log file
168 |
169 | # BlueJ files
170 | *.ctxt
171 |
172 | # Mobile Tools for Java (J2ME)
173 |
174 | # Package Files #
175 | *.nar
176 | *.zip
177 | *.tar.gz
178 | *.rar
179 |
180 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
181 |
182 | # End of https://www.gitignore.io/api/kotlin,android,androidstudio
183 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Android-RoundProgressbar
4 | Progress bar library with different styles and built-in animations
5 |
6 |
7 |
8 | ## Usage
9 | ### Implementation
10 |
11 | Add jitpack to project-level build.gradle file
12 | ```
13 | allprojects {
14 | repositories {
15 | ...
16 | maven { url 'https://jitpack.io' }
17 | }
18 | }
19 | ```
20 | Add dependency to module-level build.gradle file
21 | ```
22 | dependencies {
23 | implementation 'com.github.Qusion:android-roundprogressbar:0.3.0'
24 | }
25 | ```
26 |
27 | ### Layout
28 | ```
29 |
40 | ```
41 | supports `max`, `progress`, `progress_color`, `background_color`, `zero_progress_enabled`, `end_cap_visible`, `end_cap_size`, `stroke_width`, `background_stroke_width`, `animation_duration`, `style` (full, half), `background_style` (full, dotted) params
42 |
43 | ## License
44 | ```
45 | MIT License
46 | Copyright (c) 2020 QusionDev
47 |
48 | Permission is hereby granted, free of charge, to any person obtaining a copy
49 | of this software and associated documentation files (the "Software"), to deal
50 | in the Software without restriction, including without limitation the rights
51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52 | copies of the Software, and to permit persons to whom the Software is
53 | furnished to do so, subject to the following conditions:
54 |
55 | The above copyright notice and this permission notice shall be included in all
56 | copies or substantial portions of the Software.
57 |
58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
64 | SOFTWARE.
65 | ```
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/kotlin,android,androidstudio
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the ART/Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 | out/
18 |
19 | # Gradle files
20 | .gradle/
21 | build/
22 |
23 | # Local configuration file (sdk path, etc)
24 | local.properties
25 |
26 | # Proguard folder generated by Eclipse
27 | proguard/
28 |
29 | # Log Files
30 | *.log
31 |
32 | # Android Studio Navigation editor temp files
33 | .navigation/
34 |
35 | # Android Studio captures folder
36 | captures/
37 |
38 | # IntelliJ
39 | *.iml
40 | .idea/workspace.xml
41 | .idea/tasks.xml
42 | .idea/gradle.xml
43 | .idea/assetWizardSettings.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 | .idea/caches
47 |
48 | # Keystore files
49 | # Uncomment the following line if you do not want to check your keystore files in.
50 | #*.jks
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 |
55 | # Google Services (e.g. APIs or Firebase)
56 | # google-services.json
57 |
58 | # Freeline
59 | freeline.py
60 | freeline/
61 | freeline_project_description.json
62 |
63 | # fastlane
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
68 | fastlane/readme.md
69 |
70 | ### Android Patch ###
71 | gen-external-apklibs
72 |
73 | ### AndroidStudio ###
74 | # Covers files to be ignored for android development using Android Studio.
75 |
76 | # Built application files
77 |
78 | # Files for the ART/Dalvik VM
79 |
80 | # Java class files
81 |
82 | # Generated files
83 |
84 | # Gradle files
85 | .gradle
86 |
87 | # Signing files
88 | .signing/
89 |
90 | # Local configuration file (sdk path, etc)
91 |
92 | # Proguard folder generated by Eclipse
93 |
94 | # Log Files
95 |
96 | # Android Studio
97 | /*/build/
98 | /*/local.properties
99 | /*/out
100 | /*/*/build
101 | /*/*/production
102 | *.ipr
103 | *~
104 | *.swp
105 |
106 | # Android Patch
107 |
108 | # External native build folder generated in Android Studio 2.2 and later
109 |
110 | # NDK
111 | obj/
112 |
113 | # IntelliJ IDEA
114 | *.iws
115 | /out/
116 |
117 | # User-specific configurations
118 | .idea/*
119 |
120 | # OS-specific files
121 | .DS_Store
122 | .DS_Store?
123 | ._*
124 | .Spotlight-V100
125 | .Trashes
126 | ehthumbs.db
127 | Thumbs.db
128 |
129 | # Legacy Eclipse project files
130 | .classpath
131 | .project
132 | .cproject
133 | .settings/
134 |
135 | # Mobile Tools for Java (J2ME)
136 | .mtj.tmp/
137 |
138 | # Package Files #
139 | *.war
140 | *.ear
141 |
142 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
143 | hs_err_pid*
144 |
145 | ## Plugin-specific files:
146 |
147 | # mpeltonen/sbt-idea plugin
148 | .idea_modules/
149 |
150 | # JIRA plugin
151 | atlassian-ide-plugin.xml
152 |
153 | # Mongo Explorer plugin
154 | .idea/mongoSettings.xml
155 |
156 | # Crashlytics plugin (for Android Studio and IntelliJ)
157 | com_crashlytics_export_strings.xml
158 | crashlytics.properties
159 | crashlytics-build.properties
160 | fabric.properties
161 |
162 | ### AndroidStudio Patch ###
163 |
164 | !/gradle/wrapper/gradle-wrapper.jar
165 |
166 | ### Kotlin ###
167 | # Compiled class file
168 |
169 | # Log file
170 |
171 | # BlueJ files
172 | *.ctxt
173 |
174 | # Mobile Tools for Java (J2ME)
175 |
176 | # Package Files #
177 | *.jar
178 | *.nar
179 | *.zip
180 | *.tar.gz
181 | *.rar
182 |
183 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
184 |
185 | # End of https://www.gitignore.io/api/kotlin,android,androidstudio
186 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-kapt'
4 | apply plugin: 'kotlin-android-extensions'
5 |
6 | android {
7 | compileSdkVersion 29
8 | buildToolsVersion "29.0.2"
9 | defaultConfig {
10 | applicationId "com.qusion.roundprogressbar"
11 | minSdkVersion 23
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 |
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 | kotlinOptions {
28 | jvmTarget = "1.8"
29 | }
30 | }
31 |
32 | dependencies {
33 | implementation project(':lib-roundprogressbar')
34 |
35 | implementation fileTree(dir: 'libs', include: ['*.jar'])
36 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
37 | implementation 'androidx.appcompat:appcompat:1.1.0'
38 | implementation 'com.google.android.material:material:1.1.0'
39 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
40 | }
41 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/qusion/roundprogressbar/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.qusion.roundprogressbar
2 |
3 | import android.os.Bundle
4 | import android.util.Log
5 | import android.view.View
6 | import com.google.android.material.snackbar.Snackbar
7 | import androidx.appcompat.app.AppCompatActivity
8 |
9 | import kotlinx.android.synthetic.main.activity_main.*
10 | import kotlin.random.Random
11 |
12 | class MainActivity : AppCompatActivity() {
13 |
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 | setContentView(R.layout.activity_main)
17 | }
18 |
19 | override fun onResume() {
20 | super.onResume()
21 |
22 | val random = Random(101)
23 | var progress: Int
24 | animate_button.setOnClickListener {
25 | progress = random.nextInt(0, 100)
26 | progressbar.progress = progress
27 | balance.text = "$${progress + 120f}"
28 | }
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_back.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_bag.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
16 |
23 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_car.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
16 |
23 |
30 |
37 |
44 |
51 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_coin_stack.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
16 |
23 |
30 |
37 |
44 |
51 |
58 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_pizza.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
16 |
23 |
30 |
37 |
44 |
51 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/font/roboto.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/font/roboto.ttf
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
29 |
30 |
43 |
44 |
52 |
53 |
58 |
59 |
69 |
70 |
77 |
78 |
79 |
80 |
81 |
93 |
94 |
95 |
105 |
106 |
111 |
112 |
113 |
123 |
124 |
133 |
134 |
144 |
145 |
156 |
157 |
158 |
159 |
169 |
170 |
175 |
176 |
177 |
187 |
188 |
197 |
198 |
208 |
209 |
220 |
221 |
222 |
223 |
233 |
234 |
239 |
240 |
241 |
251 |
252 |
261 |
262 |
272 |
273 |
284 |
285 |
286 |
296 |
297 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000616
4 | #000616
5 | #000616
6 |
7 | #26FFFFFF
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | android-roundprogressbar
3 | MainActivity
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/banner.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | ext.maven_gradle_version = '2.1'
6 | repositories {
7 | google()
8 | jcenter()
9 | mavenCentral()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:4.0.1'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | classpath "com.github.dcendents:android-maven-gradle-plugin:$maven_gradle_version"
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 | mavenCentral()
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/demo.gif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Apr 27 21:02:13 CEST 2020
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-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/kotlin,android,androidstudio
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the ART/Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 | out/
18 |
19 | # Gradle files
20 | .gradle/
21 | build/
22 |
23 | # Local configuration file (sdk path, etc)
24 | local.properties
25 |
26 | # Proguard folder generated by Eclipse
27 | proguard/
28 |
29 | # Log Files
30 | *.log
31 |
32 | # Android Studio Navigation editor temp files
33 | .navigation/
34 |
35 | # Android Studio captures folder
36 | captures/
37 |
38 | # IntelliJ
39 | *.iml
40 | .idea/workspace.xml
41 | .idea/tasks.xml
42 | .idea/gradle.xml
43 | .idea/assetWizardSettings.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 | .idea/caches
47 |
48 | # Keystore files
49 | # Uncomment the following line if you do not want to check your keystore files in.
50 | #*.jks
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 |
55 | # Google Services (e.g. APIs or Firebase)
56 | # google-services.json
57 |
58 | # Freeline
59 | freeline.py
60 | freeline/
61 | freeline_project_description.json
62 |
63 | # fastlane
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
68 | fastlane/readme.md
69 |
70 | ### Android Patch ###
71 | gen-external-apklibs
72 |
73 | ### AndroidStudio ###
74 | # Covers files to be ignored for android development using Android Studio.
75 |
76 | # Built application files
77 |
78 | # Files for the ART/Dalvik VM
79 |
80 | # Java class files
81 |
82 | # Generated files
83 |
84 | # Gradle files
85 | .gradle
86 |
87 | # Signing files
88 | .signing/
89 |
90 | # Local configuration file (sdk path, etc)
91 |
92 | # Proguard folder generated by Eclipse
93 |
94 | # Log Files
95 |
96 | # Android Studio
97 | /*/build/
98 | /*/local.properties
99 | /*/out
100 | /*/*/build
101 | /*/*/production
102 | *.ipr
103 | *~
104 | *.swp
105 |
106 | # Android Patch
107 |
108 | # External native build folder generated in Android Studio 2.2 and later
109 |
110 | # NDK
111 | obj/
112 |
113 | # IntelliJ IDEA
114 | *.iws
115 | /out/
116 |
117 | # User-specific configurations
118 | .idea/*
119 |
120 | # OS-specific files
121 | .DS_Store
122 | .DS_Store?
123 | ._*
124 | .Spotlight-V100
125 | .Trashes
126 | ehthumbs.db
127 | Thumbs.db
128 |
129 | # Legacy Eclipse project files
130 | .classpath
131 | .project
132 | .cproject
133 | .settings/
134 |
135 | # Mobile Tools for Java (J2ME)
136 | .mtj.tmp/
137 |
138 | # Package Files #
139 | *.war
140 | *.ear
141 |
142 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
143 | hs_err_pid*
144 |
145 | ## Plugin-specific files:
146 |
147 | # mpeltonen/sbt-idea plugin
148 | .idea_modules/
149 |
150 | # JIRA plugin
151 | atlassian-ide-plugin.xml
152 |
153 | # Mongo Explorer plugin
154 | .idea/mongoSettings.xml
155 |
156 | # Crashlytics plugin (for Android Studio and IntelliJ)
157 | com_crashlytics_export_strings.xml
158 | crashlytics.properties
159 | crashlytics-build.properties
160 | fabric.properties
161 |
162 | ### AndroidStudio Patch ###
163 |
164 | !/gradle/wrapper/gradle-wrapper.jar
165 |
166 | ### Kotlin ###
167 | # Compiled class file
168 |
169 | # Log file
170 |
171 | # BlueJ files
172 | *.ctxt
173 |
174 | # Mobile Tools for Java (J2ME)
175 |
176 | # Package Files #
177 | *.jar
178 | *.nar
179 | *.zip
180 | *.tar.gz
181 | *.rar
182 |
183 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
184 |
185 | # End of https://www.gitignore.io/api/kotlin,android,androidstudio
186 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | apply plugin: 'com.github.dcendents.android-maven'
6 |
7 | group = 'com.github.QusionDev'
8 |
9 | android {
10 | compileSdkVersion 29
11 | buildToolsVersion "29.0.2"
12 |
13 |
14 | defaultConfig {
15 | minSdkVersion 23
16 | targetSdkVersion 29
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
31 | }
32 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qusion/android-roundprogressbar/4ce32742c8c230fa767214b55f80a13a13dbdbe2/lib-roundprogressbar/consumer-rules.pro
--------------------------------------------------------------------------------
/lib-roundprogressbar/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/androidTest/java/com/qusion/lib_roundprogressbar/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.qusion.lib_roundprogressbar
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.qusion.lib_roundprogressbar.test", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/main/java/com/qusion/lib_roundprogressbar/RoundProgressBar.kt:
--------------------------------------------------------------------------------
1 | package com.qusion.lib_roundprogressbar
2 |
3 | import android.content.Context
4 | import android.content.res.TypedArray
5 | import android.graphics.*
6 | import android.util.AttributeSet
7 | import android.view.View
8 | import kotlin.math.cos
9 | import kotlin.math.sin
10 |
11 | class RoundProgressBar @JvmOverloads constructor(
12 | context: Context,
13 | attrs: AttributeSet? = null,
14 | defStyleAttr: Int = 0
15 | ) : View(context, attrs, defStyleAttr) {
16 |
17 | private var mPrimaryPaint: Paint? = null
18 | private var mRectF: RectF? = null
19 | private var mBackgroundPaint: Paint? = null
20 | private var mZeroProgressEnabled = false
21 | private var mPrimaryProgressColor = 0
22 | private var mBackgroundColor = 0
23 | private var mStrokeWidth = 0
24 | private var mBackgroundStrokeWidth = 0
25 | private var mMax = 100
26 | var mProgress = 0
27 | private var mAnimationProgress = 0f
28 | private var mEndCapSize = 0
29 | private var mEndCapVisible = false
30 | private var mAnimationDuration = 1000
31 | private var mProgressBarStyle = 0
32 | private var mBackgroundStyle = 0
33 |
34 | private var x = 0.0
35 | private var y = 0.0
36 | private var mWidth = 0
37 | private var mHeight = 0
38 |
39 | init {
40 | val a: TypedArray = if (attrs != null) {
41 | context.theme.obtainStyledAttributes(
42 | attrs,
43 | R.styleable.RoundProgressBar,
44 | 0, 0
45 | )
46 | } else {
47 | throw IllegalArgumentException("The attributes need to be passed")
48 | }
49 | try {
50 | mBackgroundColor =
51 | a.getColor(
52 | R.styleable.RoundProgressBar_background_color,
53 | context.getColor(R.color.roundprogressbar_bg_color)
54 | )
55 | mPrimaryProgressColor =
56 | a.getColor(
57 | R.styleable.RoundProgressBar_progress_color,
58 | context.getColor(R.color.roundprogressbar_colorPrimary)
59 | )
60 | mZeroProgressEnabled =
61 | a.getBoolean(R.styleable.RoundProgressBar_zero_progress_enabled, true)
62 | mMax = a.getInt(R.styleable.RoundProgressBar_max, 100)
63 | mProgress = a.getInt(R.styleable.RoundProgressBar_progress, 0)
64 | mAnimationProgress = mProgress.toFloat()
65 | mStrokeWidth = a.getDimensionPixelSize(R.styleable.RoundProgressBar_stroke_width, 8)
66 | mBackgroundStrokeWidth =
67 | a.getDimensionPixelSize(R.styleable.RoundProgressBar_background_stroke_width, 4)
68 | mEndCapSize =
69 | a.getDimensionPixelSize(R.styleable.RoundProgressBar_end_cap_size, 2 * mStrokeWidth)
70 | mEndCapVisible = a.getBoolean(R.styleable.RoundProgressBar_end_cap_visible, false)
71 | mAnimationDuration = a.getInteger(R.styleable.RoundProgressBar_animation_duration, 1000)
72 | mProgressBarStyle = a.getInteger(R.styleable.RoundProgressBar_style, 0)
73 | mBackgroundStyle = a.getInteger(R.styleable.RoundProgressBar_background_style, 0)
74 | } finally {
75 | a.recycle()
76 | }
77 |
78 | mBackgroundPaint = Paint().apply {
79 | isAntiAlias = true
80 | style = Paint.Style.STROKE
81 | strokeWidth = mBackgroundStrokeWidth.toFloat()
82 | color = mBackgroundColor
83 | strokeCap = Paint.Cap.ROUND
84 | }
85 |
86 | if (mBackgroundStyle == BackgroundStyle.DOTTED.type) {
87 | val path = Path().also {
88 | it.addCircle(0f, 0f, mBackgroundStrokeWidth.toFloat() / 2, Path.Direction.CW)
89 | }
90 | mBackgroundPaint!!.pathEffect =
91 | PathDashPathEffect(path, 50f, 0f, PathDashPathEffect.Style.ROTATE)
92 | }
93 | mPrimaryPaint = Paint().apply {
94 | isAntiAlias = true
95 | style = Paint.Style.STROKE
96 | strokeWidth = mStrokeWidth.toFloat()
97 | color = mPrimaryProgressColor
98 | strokeCap = Paint.Cap.ROUND
99 | }
100 | mRectF = RectF()
101 | }
102 |
103 | override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
104 | super.onSizeChanged(w, h, oldw, oldh)
105 | mRectF!![paddingLeft.toFloat() + mStrokeWidth, paddingTop.toFloat() + mStrokeWidth, w - paddingRight.toFloat() - mStrokeWidth] =
106 | h - paddingBottom.toFloat() - mStrokeWidth
107 | mWidth = w
108 | mHeight = h
109 | invalidate()
110 | }
111 |
112 | override fun onDraw(canvas: Canvas) {
113 | super.onDraw(canvas)
114 | mPrimaryPaint!!.style = Paint.Style.STROKE
115 | mPrimaryPaint!!.color = mPrimaryProgressColor
116 |
117 | val full: Boolean
118 | val sweepAngle: Float
119 | val progressStartAngle: Float
120 | if (mProgressBarStyle == ProgressBarStyle.FULL.type) {
121 | full = true
122 | sweepAngle = 360f
123 | progressStartAngle = 270f
124 | } else {
125 | full = false
126 | sweepAngle = 180f
127 | progressStartAngle = 180f
128 | }
129 |
130 | //Background
131 | canvas.drawArc(mRectF!!, 180f, sweepAngle, false, mBackgroundPaint!!)
132 | //Progress
133 | val primarySwipeAngle = mAnimationProgress * sweepAngle / mMax
134 | canvas.drawArc(mRectF!!, progressStartAngle, primarySwipeAngle, false, mPrimaryPaint!!)
135 |
136 | // Cap
137 | if (mEndCapVisible) {
138 | val r = (height - paddingLeft * 2 - mStrokeWidth * 2) / 2
139 | val offset = if (full) 90 else 180
140 | val trad = (primarySwipeAngle - offset) * (Math.PI / 180.0)
141 |
142 | x = (r * cos(trad))
143 | y = (r * sin(trad))
144 | mPrimaryPaint!!.style = Paint.Style.FILL
145 |
146 | if (mZeroProgressEnabled || mAnimationProgress > 0) {
147 | canvas.drawCircle(
148 | x.toFloat() + (mWidth / 2).toFloat(),
149 | y.toFloat() + (mHeight / 2).toFloat(),
150 | mEndCapSize.toFloat() / 2,
151 | mPrimaryPaint!!
152 | )
153 | }
154 | }
155 | }
156 |
157 | private fun setAnimationProgress(mAnimationProgress: Float) {
158 | this.mAnimationProgress = mAnimationProgress
159 | invalidate()
160 | }
161 |
162 | var progressColor: Int
163 | get() = mPrimaryProgressColor
164 | set(mPrimaryProgressColor) {
165 | this.mPrimaryProgressColor = mPrimaryProgressColor
166 | invalidate()
167 | }
168 |
169 | override fun setBackgroundColor(mBackgroundColor: Int) {
170 | this.mBackgroundColor = mBackgroundColor
171 | mBackgroundPaint!!.color = mBackgroundColor
172 | invalidate()
173 | }
174 |
175 | fun getBackgroundColor(): Int {
176 | return mBackgroundColor
177 | }
178 |
179 | var progress: Int
180 | get() = mProgress
181 | set(mProgress) {
182 | var mProg = if (mProgress < mMax) mProgress else mMax
183 | mProg = if (mProg < 0) 0 else mProg
184 | if (mProg != this.mProgress) {
185 | if (visibility == VISIBLE) {
186 | val animation = RoundProgressBarAnimation(this, mProg, ::setAnimationProgress)
187 | animation.duration = mAnimationDuration.toLong()
188 | this.startAnimation(animation)
189 | this.mProgress = mProg
190 | } else {
191 | this.mProgress = mProg
192 | }
193 | }
194 | }
195 |
196 | var max: Int
197 | get() = mMax
198 | set(mMax) {
199 | this.mMax = mMax
200 | invalidate()
201 | }
202 |
203 | var isZeroProgressEnabled: Boolean
204 | get() = mZeroProgressEnabled
205 | set(mZeroProgressEnabled) {
206 | this.mZeroProgressEnabled = mZeroProgressEnabled
207 | invalidate()
208 | }
209 |
210 | var endCapSize: Int
211 | get() = mEndCapSize
212 | set(mEndCapSize) {
213 | this.mEndCapSize = mEndCapSize
214 | invalidate()
215 | }
216 |
217 | var isEndCapVisible: Boolean
218 | get() = mEndCapVisible
219 | set(mEndCapVisible) {
220 | this.mEndCapVisible = mEndCapVisible
221 | invalidate()
222 | }
223 |
224 | var animationDuration: Int
225 | get() = mAnimationDuration
226 | set(mAnimationDuration) {
227 | this.mAnimationDuration = mAnimationDuration
228 | invalidate()
229 | }
230 |
231 |
232 | enum class ProgressBarStyle(val type: Int) {
233 | FULL(0),
234 | HALF(1)
235 | }
236 |
237 | enum class BackgroundStyle(val type: Int) {
238 | FULL(0),
239 | DOTTED(1)
240 | }
241 | }
242 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/main/java/com/qusion/lib_roundprogressbar/RoundProgressBarAnimation.kt:
--------------------------------------------------------------------------------
1 | package com.qusion.lib_roundprogressbar
2 |
3 | import android.view.animation.Animation
4 | import android.view.animation.Transformation
5 |
6 | class RoundProgressBarAnimation(
7 | private val roundProgressBar: RoundProgressBar,
8 | private val newProgress: Int,
9 | private val setAnimationProgress: (Float) -> Unit
10 | ) : Animation() {
11 |
12 | private val oldProgress = roundProgressBar.progress
13 |
14 | override fun applyTransformation(
15 | interpolatedTime: Float,
16 | transformation: Transformation?
17 | ) {
18 | val progress = if (oldProgress < newProgress) {
19 | oldProgress + ((newProgress - oldProgress) * interpolatedTime)
20 | } else {
21 | oldProgress - ((oldProgress - newProgress) * interpolatedTime)
22 | }
23 | setAnimationProgress(progress)
24 | roundProgressBar.requestLayout()
25 | }
26 |
27 |
28 | }
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00F0FF
4 | #26FFFFFF
5 |
6 |
--------------------------------------------------------------------------------
/lib-roundprogressbar/src/test/java/com/qusion/lib_roundprogressbar/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.qusion.lib_roundprogressbar
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Qusion
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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':lib-roundprogressbar'
2 | rootProject.name='RoundProgressBar'
3 |
--------------------------------------------------------------------------------