Skip to content

Commit 5102652

Browse files
authored
Merge pull request #7 from LiteSoftware/dev
Release 1.0
2 parents dd5ca3c + 07651df commit 5102652

18 files changed

Lines changed: 114 additions & 8 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'com.android.library'
33
id 'kotlin-android'
4+
id 'maven-publish'
45
}
56

67
android {
@@ -30,5 +31,21 @@ android {
3031
}
3132
}
3233

34+
task androidSourcesJar(type: Jar) {
35+
classifier 'sources'
36+
from android.sourceSets.main.java.srcDirs
37+
}
38+
39+
project.afterEvaluate {
40+
publishing {
41+
publications {
42+
release(MavenPublication) {
43+
from components.release
44+
artifact androidSourcesJar // optional sources
45+
}
46+
}
47+
}
48+
}
49+
3350
dependencies {
3451
}
File renamed without changes.

CircularProgressBar/src/main/java/com/javavirys/circularprogressbar/CircularProgressBar.kt renamed to CircularProgressBarLib/src/main/java/com/javavirys/circularprogressbar/CircularProgressBar.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.javavirys.circularprogressbar
1717

18+
import android.animation.ValueAnimator
1819
import android.content.Context
1920
import android.graphics.Canvas
2021
import android.graphics.Color
@@ -164,7 +165,7 @@ class CircularProgressBar
164165

165166
fun getProgress() = pProgress
166167

167-
fun setProgress(progress: Int) {
168+
fun setProgressWithoutAnimation(progress: Int) {
168169
if (progress != pProgress) {
169170
pProgress = when {
170171
pProgress > 100 -> 100
@@ -174,4 +175,13 @@ class CircularProgressBar
174175
invalidate()
175176
}
176177
}
178+
179+
fun setProgress(progress: Int) {
180+
if (progress == pProgress) return
181+
ValueAnimator.ofInt(pProgress, progress).apply {
182+
addUpdateListener { setProgressWithoutAnimation(it.animatedValue as Int) }
183+
duration = 600
184+
start()
185+
}
186+
}
177187
}
File renamed without changes.

README.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,73 @@
11
# CircularProgressBar
2-
Circular progress bar
2+
Circular progress bar is a simple, easy-to-use speedometer-like circular progress bar.
3+
4+
<img src="screens/1_1.png" width="30%" /> <img src="screens/1_2.png" width="30%" /> <img src="screens/1_3.png" width="30%" />
5+
6+
## How to use
7+
Add view to your layout:
8+
```xml
9+
<com.javavirys.circularprogressbar.CircularProgressBar
10+
android:id="@+id/progress"
11+
android:layout_width="260dp"
12+
android:layout_height="260dp"
13+
app:layout_constraintBottom_toTopOf="@+id/speedTextView"
14+
app:layout_constraintEnd_toEndOf="parent"
15+
app:layout_constraintStart_toStartOf="parent"
16+
app:layout_constraintTop_toTopOf="parent"
17+
app:outerArcWidth="8dp"
18+
app:outerArcColor="#00d000"
19+
app:lineWidth="6dp"
20+
app:lineColor="@color/purple_200"
21+
app:smallPointSize="12dp"
22+
app:bigPointSize="30dp"
23+
app:progress="33" />
24+
```
25+
26+
Than find it in code and set progress:
27+
```kotlin
28+
val circularProgress = findViewById<CircularProgressBar>(R.id.circular_progress)
29+
// you can set current progress value
30+
circularProgress.setProgress(value)
31+
// You can set the progress value without animation
32+
circularProgress.setProgressWithoutAnimation(value)
33+
// you can get progress value using following getter
34+
circularProgress.getProgress()
35+
```
36+
37+
---
38+
39+
### Download using Gradle
40+
41+
Add this in your root `build.gradle` at the end of `repositories` in `allprojects` section:
42+
```groovy
43+
allprojects {
44+
repositories {
45+
maven { url 'https://jitpack.io' }
46+
}
47+
}
48+
```
49+
50+
Then add this dependency to your **module-level** `build.gradle` in `dependencies` section:
51+
```groovy
52+
implementation 'com.github.test:CircularProgressBar:1.0'
53+
```
54+
55+
---
56+
57+
### License
58+
59+
```
60+
Copyright 2021 Vitaliy Sychov. All rights reserved.
61+
62+
Licensed under the Apache License, Version 2.0 (the "License");
63+
you may not use this file except in compliance with the License.
64+
You may obtain a copy of the License at
65+
66+
http://www.apache.org/licenses/LICENSE-2.0
67+
68+
Unless required by applicable law or agreed to in writing, software
69+
distributed under the License is distributed on an "AS IS" BASIS,
70+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71+
See the License for the specific language governing permissions and
72+
limitations under the License.
73+
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ buildscript {
2020
maven { url 'https://jitpack.io' }
2121
}
2222
dependencies {
23-
classpath "com.android.tools.build:gradle:7.0.3"
23+
classpath "com.android.tools.build:gradle:7.0.4"
2424
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
2525
}
2626
}

jitpack.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
jdk:
2+
- openjdk11
3+
4+
install:
5+
- ./gradlew assemble :CircularProgressBarLib:publishToMavenLocal

0 commit comments

Comments
 (0)