├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── ProgressView.gif ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── progress │ │ └── progressviewexample │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── progress │ │ │ └── progressviewexample │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── 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 │ └── test │ └── java │ └── com │ └── progress │ └── progressviewexample │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── progressview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── progress │ │ └── progressview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── progress │ │ │ └── progressview │ │ │ └── ProgressView.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── progress │ └── progressview │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimaami/AndroidProgressView/6cb6d8232895c72da3824012a6a5230f64b5d491/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ProgressView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimaami/AndroidProgressView/6cb6d8232895c72da3824012a6a5230f64b5d491/ProgressView.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidProgressView 2 | Progress view with arc, line and circle shapes and gradient effect 3 | 4 | ### [New] Kotlin version 5 | Check [here](https://github.com/shimaami/AndroidProgressView-Kotlin) 6 | 7 | ![](ProgressView.gif) 8 | 9 | # Attributes 10 | | Name | Description | Type | Default | Range | 11 | | ------------- | ------------- | ------------- | ------------- | ------------- | 12 | | pvDirection | Direction of the progress | enum | fromLeft (clockwise) | fromLeft, fromRight | 13 | | pvShape | Shape of the progress view | enum | arc | arc, circle, line | 14 | | pvProgress | Progress value | float | 0 | 0 to 1 | 15 | | pvBackgroundColor | Progress background color | color | Color.BLACK | - | 16 | | pvProgressColor | Progress color | color | Color.RED | - | 17 | | pvBackgroundWidth | Progress background width | dimension | 2dp | - | 18 | | pvProgressWidth | Progress width | dimension | 10dp | - | 19 | | pvAnimateDuration | Animation duration | integer | 1500 | - | 20 | 21 | # Home To Install 22 | ``` 23 | allprojects { 24 | repositories { 25 | ... 26 | jcenter() 27 | } 28 | } 29 | ``` 30 | ``` 31 | implementation 'com.shimaami.android:progressview:1.0.1' 32 | ``` 33 | If you have problems with appcompat use 34 | ``` 35 | implementation ("com.shimaami.android:progressview:1.0") { 36 | exclude module: "appcompat-v7" 37 | } 38 | ``` 39 | 40 | # Home To Use 41 | ### XML 42 | ``` 43 | 51 | ``` 52 | ### Apply gradient effect 53 | ``` 54 | int[] colorList = new int[]{Color.GREEN, Color.YELLOW, Color.RED}; 55 | mProgressView.applyGradient(colorList); 56 | ``` 57 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.progress.progressview" 7 | minSdkVersion 19 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(include: ['*.jar'], dir: 'libs') 23 | implementation 'com.android.support:appcompat-v7:28.0.0-rc02' 24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 28 | implementation project(':progressview') 29 | } 30 | -------------------------------------------------------------------------------- /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/androidTest/java/com/progress/progressviewexample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.progress.progressviewexample; 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 | * Instrumented 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.progress.progressview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/progress/progressviewexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.progress.progressviewexample; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | import com.progress.progressview.ProgressView; 9 | 10 | import java.util.Random; 11 | 12 | public class MainActivity extends AppCompatActivity implements View.OnClickListener { 13 | 14 | private ProgressView mProgressView, mProgressView1, mProgressView2, 15 | mProgressLine, mProgressCircle; 16 | private Random r = new Random(1); 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_main); 22 | 23 | mProgressView = findViewById(R.id.progressView); 24 | mProgressView1 = findViewById(R.id.progressView1); 25 | mProgressView2 = findViewById(R.id.progressView2); 26 | mProgressLine = findViewById(R.id.progressLine); 27 | mProgressCircle = findViewById(R.id.progressCircle); 28 | findViewById(R.id.btn_progress).setOnClickListener(this); 29 | findViewById(R.id.btn_direction).setOnClickListener(this); 30 | 31 | int[] colorList = new int[]{Color.GREEN, Color.YELLOW, Color.RED}; 32 | mProgressView2.applyGradient(colorList); 33 | mProgressView1.applyGradient(colorList); 34 | mProgressLine.applyGradient(colorList); 35 | mProgressCircle.applyGradient(colorList); 36 | 37 | } 38 | 39 | @Override 40 | public void onClick(View view) { 41 | if (view.getId() == R.id.btn_progress) { 42 | float progress = r.nextFloat(); 43 | mProgressView.setProgress(progress); 44 | mProgressView1.setProgress(progress); 45 | mProgressView2.setProgress(progress); 46 | mProgressLine.setProgress(progress); 47 | mProgressCircle.setProgress(progress); 48 | } else if (view.getId() == R.id.btn_direction) { 49 | mProgressView1.setProgressDirection(toggleDirection(mProgressView1.getProgressDirection())); 50 | mProgressView2.setProgressDirection(toggleDirection(mProgressView2.getProgressDirection())); 51 | mProgressCircle.setProgressDirection(toggleDirection(mProgressCircle.getProgressDirection())); 52 | mProgressLine.setProgressDirection(toggleDirection(mProgressLine.getProgressDirection())); 53 | 54 | } 55 | } 56 | 57 | private ProgressView.Direction toggleDirection(ProgressView.Direction d) { 58 | if (d == ProgressView.Direction.FROM_LEFT) { 59 | return ProgressView.Direction.FROM_RIGHT; 60 | } 61 | 62 | return ProgressView.Direction.FROM_LEFT; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /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_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/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 19 | 20 | 26 | 27 | 33 | 34 | 35 | 39 | 40 | 48 | 49 | 61 | 62 | 63 |