├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── fonts │ │ └── dincond_boldalternate.ttf │ ├── java │ └── com │ │ └── fphoenixcorneae │ │ └── smartprogressbar │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── font │ └── arial.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 │ ├── arrays.xml │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── preview └── smart_progress_bar.png ├── settings.gradle └── smartProgressBar ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── fphoenixcorneae │ └── progressbar │ ├── ProgressBarLayout.kt │ └── SmartProgressBar.kt └── res └── values └── attrs.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | /.idea 15 | /.gradle 16 | /gradle 17 | /gradlew 18 | /gradlew.bat 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmartProgressBar 2 | 漂亮的进度条,如丝般顺滑,样式风格有水平、竖直、圆环、扇形...... 3 | ------------------------------------------------------------ 4 | 5 |
6 | 7 |
8 | 9 | ----------------------------- 10 | 11 | How to include it in your project: 12 | -------------- 13 | **Step 1.** Add the JitPack repository to your build file 14 | ```groovy 15 | allprojects { 16 | repositories { 17 | ... 18 | maven { url 'https://jitpack.io' } 19 | } 20 | } 21 | ``` 22 | 23 | **Step 2.** Add the dependency 24 | ```groovy 25 | dependencies { 26 | implementation 'com.github.FPhoenixCorneaE:SmartProgressBar:1.0.3' 27 | } 28 | ``` 29 | 30 | xml中使用 31 | -------------- 32 | `水平样式进度条` 33 | ```xml 34 | 59 | ``` 60 | 61 | `竖直样式进度条` 62 | ```xml 63 | 88 | ``` 89 | 90 | `圆环样式进度条` 91 | ```xml 92 | 113 | ``` 114 | 115 | `扇形样式进度条` 116 | ```xml 117 | 137 | ``` 138 | 139 | -------------------- 140 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 30 7 | defaultConfig { 8 | applicationId "com.wkz.smartprogressbar" 9 | minSdkVersion 19 10 | targetSdkVersion 30 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | compileOptions { 22 | targetCompatibility JavaVersion.VERSION_1_8 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | } 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 30 | implementation 'androidx.core:core-ktx:1.3.2' 31 | implementation 'androidx.appcompat:appcompat:1.2.0' 32 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 33 | testImplementation 'junit:junit:4.13.2' 34 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 36 | 37 | // implementation 'com.github.FPhoenixCorneaE:SmartProgressBar:1.0.3' 38 | implementation project(path: ':smartProgressBar') 39 | } 40 | -------------------------------------------------------------------------------- /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 | 5 | 6 | 7 | 8 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/dincond_boldalternate.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FPhoenixCorneaE/SmartProgressBar/357c47cd95d17ba5ec1e162cd410406f2eb1043a/app/src/main/assets/fonts/dincond_boldalternate.ttf -------------------------------------------------------------------------------- /app/src/main/java/com/fphoenixcorneae/smartprogressbar/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fphoenixcorneae.smartprogressbar 2 | 3 | import android.animation.Animator 4 | import android.animation.AnimatorListenerAdapter 5 | import android.os.Bundle 6 | import android.util.Log 7 | import androidx.appcompat.app.AppCompatActivity 8 | import kotlinx.android.synthetic.main.activity_main.* 9 | 10 | class MainActivity : AppCompatActivity() { 11 | 12 | private var isFullReduction = false 13 | private var isShowTime = false 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | setContentView(R.layout.activity_main) 18 | initView() 19 | initListener() 20 | } 21 | 22 | private fun initView() { 23 | pblProgress.addProgressAnimatorUpdateListener { 24 | 25 | } 26 | pblProgress.addProgressAnimatorListener(object : AnimatorListenerAdapter() { 27 | override fun onAnimationEnd(animation: Animator?) { 28 | super.onAnimationEnd(animation) 29 | Log.i("onAnimationEnd", "onAnimationEnd") 30 | } 31 | }) 32 | } 33 | 34 | private fun initListener() { 35 | btnShowTemperatureText.setOnClickListener { 36 | isShowTime = false 37 | var beginTemperature = when (isFullReduction) { 38 | true -> 100f 39 | else -> 80f 40 | } 41 | val endTemperature = when (isFullReduction) { 42 | true -> 80f 43 | else -> 100f 44 | } 45 | when { 46 | isFullReduction -> { 47 | pblProgress.mSmartProgressBar.setProgressWithNoAnimation(0f) 48 | pblProgress.mSmartProgressBar.setIsAnimated(true) 49 | it.postDelayed({ 50 | beginTemperature = 99f 51 | pblProgress.setTemperatureText(beginTemperature, endTemperature) 52 | }, 3000) 53 | } 54 | else -> { 55 | pblProgress.mSmartProgressBar.setIsAnimated(false) 56 | } 57 | } 58 | pblProgress.setTemperatureText(beginTemperature, endTemperature) 59 | } 60 | btnShowTimeText.setOnClickListener { 61 | isShowTime = true 62 | pblProgress.setTimeText(60, isFullReduction) 63 | } 64 | btnTurnDirection.setOnClickListener { 65 | isFullReduction = !isFullReduction 66 | when (isShowTime) { 67 | true -> { 68 | btnShowTimeText.performClick() 69 | } 70 | else -> { 71 | btnShowTemperatureText.performClick() 72 | } 73 | } 74 | } 75 | btnPause.setOnClickListener { 76 | pblProgress.pauseProgressAnimation() 77 | } 78 | btnResume.setOnClickListener { 79 | pblProgress.resumeProgressAnimation() 80 | } 81 | btnCancel.setOnClickListener { 82 | pblProgress.cancelProgressAnimation() 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /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/font/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FPhoenixCorneaE/SmartProgressBar/357c47cd95d17ba5ec1e162cd410406f2eb1043a/app/src/main/res/font/arial.ttf -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 37 | 38 | 44 | 45 | 66 | 67 | 92 | 93 | 115 | 116 | 117 | 123 | 124 | 144 | 145 | 167 | 168 | 169 | 172 | 173 | 213 | 214 |