├── round-corner-progress-bar ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── attrs.xml │ │ └── layout │ │ │ ├── layout_round_corner_progress_bar.xml │ │ │ ├── layout_text_round_corner_progress_bar.xml │ │ │ └── layout_icon_round_corner_progress_bar.xml │ │ └── java │ │ └── com │ │ └── akexorcist │ │ └── roundcornerprogressbar │ │ ├── CenteredRoundCornerProgressBar.kt │ │ ├── indeterminate │ │ ├── IndeterminateRoundCornerProgressBar.kt │ │ └── IndeterminateCenteredRoundCornerProgressBar.kt │ │ ├── RoundCornerProgressBar.kt │ │ ├── common │ │ └── AnimatedRoundCornerProgressBar.kt │ │ ├── IconRoundCornerProgressBar.kt │ │ └── TextRoundCornerProgressBar.kt ├── proguard-rules.pro └── build.gradle.kts ├── image ├── header.jpg ├── google_play.jpg ├── sample_icon.jpg ├── sample_text.jpg ├── overview_icon.jpg ├── overview_text.jpg ├── sample_simple.jpg ├── overview_centered.jpg ├── overview_simple.jpg ├── sample_centered.jpg ├── sample_gradient.jpg ├── animation_comparison.gif ├── overview_indeterminate.gif ├── sample_indeterminate.gif └── sample_indeterminate_centered.gif ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── app ├── src │ └── main │ │ ├── ic_launcher-playstore.png │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_clock.png │ │ │ ├── ic_android.png │ │ │ ├── ic_download.png │ │ │ └── ic_television.png │ │ ├── drawable-mdpi │ │ │ ├── ic_clock.png │ │ │ ├── ic_android.png │ │ │ ├── ic_download.png │ │ │ └── ic_television.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_clock.png │ │ │ ├── ic_android.png │ │ │ ├── ic_download.png │ │ │ └── ic_television.png │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ ├── drawable-xxhdpi │ │ │ ├── ic_android.png │ │ │ ├── ic_clock.png │ │ │ ├── ic_download.png │ │ │ └── ic_television.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ ├── drawable-night │ │ │ └── shape_sample_card_background.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable │ │ │ └── shape_sample_card_background.xml │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── values-night │ │ │ └── colors.xml │ │ └── layout │ │ │ ├── activity_main.xml │ │ │ ├── fragment_indeterminate_demo.xml │ │ │ ├── fragment_simple_demo.xml │ │ │ ├── fragment_centered_demo.xml │ │ │ ├── fragment_text_demo.xml │ │ │ └── fragment_icon_demo.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── akexorcist │ │ └── roundcornerprogressbar │ │ └── example │ │ ├── ViewPagerAdapter.kt │ │ ├── fragment │ │ ├── IndeterminateDemoFragment.kt │ │ ├── SimpleDemoFragment.kt │ │ ├── CenteredDemoFragment.kt │ │ ├── IconDemoFragment.kt │ │ └── TextDemoFragment.kt │ │ └── MainActivity.kt ├── proguard-rules.pro └── build.gradle.kts ├── settings.gradle.kts ├── .github └── workflows │ └── android.yml ├── .gitignore ├── gradle.properties ├── MIGRATION.md ├── CHANGELOG.md ├── gradlew.bat ├── publish └── mavencentral.gradle ├── gradlew └── LICENSE /round-corner-progress-bar/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /image/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/header.jpg -------------------------------------------------------------------------------- /image/google_play.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/google_play.jpg -------------------------------------------------------------------------------- /image/sample_icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_icon.jpg -------------------------------------------------------------------------------- /image/sample_text.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_text.jpg -------------------------------------------------------------------------------- /image/overview_icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/overview_icon.jpg -------------------------------------------------------------------------------- /image/overview_text.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/overview_text.jpg -------------------------------------------------------------------------------- /image/sample_simple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_simple.jpg -------------------------------------------------------------------------------- /image/overview_centered.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/overview_centered.jpg -------------------------------------------------------------------------------- /image/overview_simple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/overview_simple.jpg -------------------------------------------------------------------------------- /image/sample_centered.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_centered.jpg -------------------------------------------------------------------------------- /image/sample_gradient.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_gradient.jpg -------------------------------------------------------------------------------- /image/animation_comparison.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/animation_comparison.gif -------------------------------------------------------------------------------- /image/overview_indeterminate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/overview_indeterminate.gif -------------------------------------------------------------------------------- /image/sample_indeterminate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_indeterminate.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /image/sample_indeterminate_centered.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/image/sample_indeterminate_centered.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-hdpi/ic_clock.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-mdpi/ic_clock.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xhdpi/ic_clock.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-hdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-hdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-mdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-mdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xhdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xxhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xxhdpi/ic_clock.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_television.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-hdpi/ic_television.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_television.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-mdpi/ic_television.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_television.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xhdpi/ic_television.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xxhdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_television.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/drawable-xxhdpi/ic_television.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akexorcist/RoundCornerProgressBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 13 22:23:18 ICT 2021 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-8.14.3-bin.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/shape_sample_card_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /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/drawable/shape_sample_card_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #5f5f5f 5 | #7f7f7f 6 | #00000000 7 | 8 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | pluginManagement { 4 | repositories { 5 | google() 6 | mavenCentral() 7 | gradlePluginPortal() 8 | } 9 | } 10 | 11 | dependencyResolutionManagement { 12 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 13 | repositories { 14 | google() 15 | mavenCentral() 16 | } 17 | } 18 | 19 | rootProject.name = "Round Corner Progress Bar" 20 | include(":app", ":round-corner-progress-bar") 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 48dp 3 | 2dp 4 | 260dp 5 | 16sp 6 | 12sp 7 | 8dp 8 | 8dp 9 | 16dp 10 | 8dp 11 | 16dp 12 | 24dp 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | test: 11 | name: Unit Test 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: set up JDK 17 17 | uses: actions/setup-java@v3 18 | with: 19 | distribution: 'adopt' 20 | java-version: '17' 21 | cache: 'gradle' 22 | 23 | - name: Grant execute permission for gradlew 24 | run: chmod +x gradlew 25 | 26 | - name: Run Clean 27 | run: ./gradlew clean 28 | 29 | - name: Run build compatibility test 30 | run: ./gradlew assembleDebug 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 /Applications/ADT/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle.kts. 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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /round-corner-progress-bar/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 /Applications/ADT/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle.kts. 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 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/ViewPagerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example 2 | 3 | import androidx.fragment.app.Fragment 4 | import androidx.fragment.app.FragmentActivity 5 | import androidx.viewpager2.adapter.FragmentStateAdapter 6 | import com.akexorcist.roundcornerprogressbar.example.fragment.* 7 | 8 | class ViewPagerAdapter(activity: FragmentActivity) : FragmentStateAdapter(activity) { 9 | override fun getItemCount(): Int = 5 10 | 11 | override fun createFragment(position: Int): Fragment = when (position) { 12 | 0 -> SimpleDemoFragment.newInstance() 13 | 1 -> CenteredDemoFragment.newInstance() 14 | 2 -> IconDemoFragment.newInstance() 15 | 3 -> TextDemoFragment.newInstance() 16 | 4 -> IndeterminateDemoFragment.newInstance() 17 | else -> SimpleDemoFragment.newInstance() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #6200EE 5 | #6200EE 6 | #E91E63 7 | 8 | #10FFFFFF 9 | 10 | #10FFFFFF 11 | #C62828 12 | #F44336 13 | #40F44336 14 | #C62828 15 | #E57373 16 | #FFFFFF 17 | 18 | 19 | @color/sample_progress_gradient_start 20 | @color/sample_progress_gradient_end 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #6200EE 5 | #6200EE 6 | #E91E63 7 | 8 | #FFFFFF 9 | #0A000000 10 | 11 | #0A000000 12 | #D32F2F 13 | #EF5350 14 | #40EF5350 15 | #D32F2F 16 | #E57373 17 | #222222 18 | 19 | 20 | @color/sample_progress_gradient_start 21 | @color/sample_progress_gradient_end 22 | 23 | 24 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | libraryVersion = "2.2.2" 3 | 4 | compileSdk = "36" 5 | minSdk = "21" 6 | targetSdk = "36" 7 | 8 | kotlin = "2.2.0" 9 | androidGradlePlugin = "8.11.1" 10 | 11 | [libraries] 12 | core = { module = "androidx.core:core-ktx", version = "1.16.0" } 13 | appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.1" } 14 | material = { module = "com.google.android.material:material", version = "1.12.0" } 15 | constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.2.1" } 16 | lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version = "2.9.2" } 17 | annotation = { module = "androidx.annotation:annotation", version = "1.9.1" } 18 | 19 | roundCornerProgressBar = { module = "com.akexorcist:round-corner-progress-bar", version = "2.2.2" } 20 | 21 | [plugins] 22 | android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } 23 | kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } 24 | maven-publish = { id = "com.vanniktech.maven.publish", version = "0.34.0" } 25 | android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/assetWizardSettings.xml 41 | .idea/dictionaries 42 | .idea/libraries 43 | .idea/caches 44 | 45 | # Keystore files 46 | # Uncomment the following line if you do not want to check your keystore files in. 47 | #*.jks 48 | 49 | # External native build folder generated in Android Studio 2.2 and later 50 | .externalNativeBuild 51 | 52 | # Google Services (e.g. APIs or Firebase) 53 | google-services.json 54 | 55 | # Freeline 56 | freeline.py 57 | freeline/ 58 | freeline_project_description.json 59 | 60 | # fastlane 61 | fastlane/report.xml 62 | fastlane/Preview.html 63 | fastlane/screenshots 64 | fastlane/test_output 65 | fastlane/readme.md 66 | .idea 67 | .DS_Store 68 | -------------------------------------------------------------------------------- /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=-Xmx2048m -Dfile.encoding=UTF-8 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 | android.defaults.buildfeatures.buildconfig=true 23 | android.nonTransitiveRClass=false 24 | android.nonFinalResIds=false -------------------------------------------------------------------------------- /MIGRATION.md: -------------------------------------------------------------------------------- 1 | # Migration 2 | 3 | ## Migrate from 2.0 to 2.1+ 4 | 5 | ### BaseRoundCornerProgressBar.OnProgressChangedListener 6 | 7 | Change the view ID parameter in `onProgressChanged` to View class 8 | 9 | ```kotlin 10 | // Old 11 | fun onProgressChanged( 12 | viewId: Int, 13 | progress: Float, 14 | isPrimaryProgress: Boolean, 15 | isSecondaryProgress: Boolean 16 | ) 17 | 18 | // New 19 | fun onProgressChanged( 20 | view: View, 21 | progress: Float, 22 | isPrimaryProgress: Boolean, 23 | isSecondaryProgress: Boolean 24 | ) 25 | ``` 26 | 27 | ### Custom your own progress bar by extends BaseRoundCornerProgressBar 28 | 29 | Use AnimatedRoundCornerProgressBar instead of BaseRoundCornerProgressBar for progress change animation support. 30 | 31 | ```Kotlin 32 | class CustomRoundCornerProgressBar: AnimatedRoundCornerProgressBar() { 33 | /* ... */ 34 | } 35 | ``` 36 | 37 | And you do not have to create the `GradientDrawable` by yourself anymore. `drawProgress` will send it as parameter. 38 | 39 | ```kotlin 40 | // Old 41 | fun drawProgress( 42 | layoutProgress: LinearLayout, 43 | max: Float, 44 | progress: Float, 45 | totalWidth: Float, 46 | radius: Int, 47 | padding: Int, 48 | progressColor: Int, 49 | isReverse: Boolean 50 | ) 51 | 52 | // New 53 | fun drawProgress( 54 | layoutProgress: LinearLayout, 55 | progressDrawable: GradientDrawable, 56 | max: Float, 57 | progress: Float, 58 | totalWidth: Float, 59 | radius: Int, 60 | padding: Int, 61 | isReverse: Boolean 62 | ) 63 | ``` -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/res/layout/layout_round_corner_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 24 | 25 | 29 | 30 | 35 | 36 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget 2 | import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile 3 | 4 | plugins { 5 | alias(libs.plugins.android.application) 6 | alias(libs.plugins.kotlin.android) 7 | } 8 | 9 | android { 10 | namespace = "com.akexorcist.roundcornerprogressbar.example" 11 | compileSdk = libs.versions.compileSdk.get().toInt() 12 | 13 | defaultConfig { 14 | applicationId = "com.akexorcist.roundcornerprogressbar" 15 | minSdk = libs.versions.minSdk.get().toInt() 16 | targetSdk = libs.versions.targetSdk.get().toInt() 17 | versionCode = 20202 18 | versionName = libs.versions.libraryVersion.get() 19 | } 20 | 21 | buildTypes { 22 | release { 23 | isMinifyEnabled = true 24 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") 25 | } 26 | } 27 | 28 | compileOptions { 29 | sourceCompatibility = JavaVersion.VERSION_17 30 | targetCompatibility = JavaVersion.VERSION_17 31 | } 32 | 33 | buildFeatures { 34 | viewBinding = true 35 | } 36 | } 37 | 38 | tasks.withType().configureEach { 39 | compilerOptions { 40 | jvmTarget.set(JvmTarget.JVM_17) 41 | freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") 42 | } 43 | } 44 | 45 | dependencies { 46 | implementation(libs.core) 47 | implementation(libs.appcompat) 48 | implementation(libs.material) 49 | implementation(libs.constraintlayout) 50 | implementation(libs.lifecycle.runtime.ktx) 51 | 52 | // implementation(libs.roundCornerProgressBar) 53 | implementation(project(":round-corner-progress-bar")) 54 | } 55 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/java/com/akexorcist/roundcornerprogressbar/CenteredRoundCornerProgressBar.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.GradientDrawable 5 | import android.os.Build 6 | import android.util.AttributeSet 7 | import android.widget.LinearLayout 8 | import androidx.annotation.Keep 9 | import androidx.annotation.RequiresApi 10 | 11 | @Keep 12 | open class CenteredRoundCornerProgressBar : RoundCornerProgressBar { 13 | constructor(context: Context) : super(context) 14 | 15 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) 16 | 17 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) 18 | 19 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 20 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) 21 | 22 | override fun drawProgress( 23 | layoutProgress: LinearLayout, 24 | progressDrawable: GradientDrawable, 25 | max: Float, 26 | progress: Float, 27 | totalWidth: Float, 28 | radius: Int, 29 | padding: Int, 30 | isReverse: Boolean, 31 | ) { 32 | super.drawProgress(layoutProgress, progressDrawable, max, progress, totalWidth, radius, padding, isReverse) 33 | val params = layoutProgress.layoutParams as MarginLayoutParams 34 | val ratio = max / progress 35 | val progressWidth = (totalWidth - (padding * 2)) / ratio 36 | val deltaWidth = totalWidth - progressWidth 37 | params.setMargins( 38 | (deltaWidth / 2).toInt(), 39 | params.topMargin, 40 | (deltaWidth / 2).toInt(), 41 | params.bottomMargin, 42 | ) 43 | layoutProgress.layoutParams = params 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/fragment/IndeterminateDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.akexorcist.roundcornerprogressbar.example.databinding.FragmentIndeterminateDemoBinding 9 | 10 | class IndeterminateDemoFragment : Fragment() { 11 | private lateinit var binding: FragmentIndeterminateDemoBinding 12 | 13 | companion object { 14 | fun newInstance(): Fragment = IndeterminateDemoFragment() 15 | } 16 | 17 | override fun onCreateView( 18 | inflater: LayoutInflater, 19 | container: ViewGroup?, 20 | savedInstanceState: Bundle? 21 | ): View { 22 | binding = FragmentIndeterminateDemoBinding.inflate(layoutInflater, container, false) 23 | return binding.root 24 | } 25 | 26 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 27 | super.onViewCreated(view, savedInstanceState) 28 | with(binding) { 29 | textViewIndeterminate1.text = getIndeterminate1Description() 30 | textViewIndeterminate2.text = getIndeterminate2Description() 31 | textViewIndeterminate3.text = getIndeterminate3Description() 32 | textViewIndeterminate4.text = getIndeterminate4Description() 33 | } 34 | } 35 | 36 | private fun getIndeterminate1Description() = """ 37 | |Animation Speed Scale : x1 38 | """.trimMargin() 39 | 40 | private fun getIndeterminate2Description() = """ 41 | |Animation Speed Scale : x3 42 | """.trimMargin() 43 | 44 | private fun getIndeterminate3Description() = """ 45 | |Animation Speed Scale : x0.5 46 | """.trimMargin() 47 | 48 | private fun getIndeterminate4Description() = """ 49 | |Animation Speed Scale : x1 50 | """.trimMargin() 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 21 | 24 | 25 | 28 | 29 | 32 | 33 | 36 | 37 | 40 | 41 | 42 | 43 | 48 | 49 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/res/layout/layout_text_round_corner_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 24 | 25 | 29 | 30 | 35 | 36 | 41 | 42 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/java/com/akexorcist/roundcornerprogressbar/indeterminate/IndeterminateRoundCornerProgressBar.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.indeterminate 2 | 3 | import android.content.Context 4 | import android.os.Build 5 | import android.util.AttributeSet 6 | import android.view.View 7 | import android.widget.LinearLayout 8 | import androidx.annotation.Keep 9 | import androidx.annotation.RequiresApi 10 | import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar 11 | 12 | @Suppress("unused") 13 | @Keep 14 | open class IndeterminateRoundCornerProgressBar : RoundCornerProgressBar { 15 | constructor(context: Context) : super(context) 16 | 17 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) 18 | 19 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) 20 | 21 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 22 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) 23 | 24 | override fun initView() { 25 | super.initView() 26 | setMax(100) 27 | } 28 | 29 | override fun onProgressChangeAnimationUpdate(layout: LinearLayout, current: Float, to: Float) { 30 | if (!isShown) { 31 | super.stopProgressAnimationImmediately() 32 | } 33 | } 34 | 35 | override fun onProgressChangeAnimationEnd(layout: LinearLayout) { 36 | if (isShown) { 37 | startIndeterminateAnimation() 38 | } 39 | } 40 | 41 | override fun onVisibilityChanged(changedView: View, visibility: Int) { 42 | super.onVisibilityChanged(changedView, visibility) 43 | if (visibility == View.VISIBLE) { 44 | startIndeterminateAnimation() 45 | } 46 | } 47 | 48 | private fun startIndeterminateAnimation() { 49 | disableAnimation() 50 | setProgress(0) 51 | enableAnimation() 52 | setProgress(100) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RoundCornerProgressBar Demo 3 | 4 | 5 | 6 | Simple 7 | Centered 8 | Icon 9 | Text 10 | Indeterminate 11 | 12 | Round Corner Progress Bar 13 | Centered Round Corner Progress Bar 14 | Icon Round Corner Progress Bar 15 | Text Round Corner Progress Bar 16 | Indeterminate Round Corner Progress Bar 17 | Indeterminate Centered Round Corner Progress Bar 18 | 19 | -2 20 | -20 21 | +2 22 | +20 23 | Enable Animation 24 | Gradient Progress Color 25 | Start 26 | End 27 | Inside Text Gravity 28 | Outside Text Gravity 29 | Text Position Priority 30 | Inside 31 | Outside 32 | Loading... 33 | 34 | 35 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/java/com/akexorcist/roundcornerprogressbar/indeterminate/IndeterminateCenteredRoundCornerProgressBar.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.indeterminate 2 | 3 | import android.content.Context 4 | import android.os.Build 5 | import android.util.AttributeSet 6 | import android.view.View 7 | import android.widget.LinearLayout 8 | import androidx.annotation.Keep 9 | import androidx.annotation.RequiresApi 10 | import com.akexorcist.roundcornerprogressbar.CenteredRoundCornerProgressBar 11 | 12 | @Suppress("unused") 13 | @Keep 14 | open class IndeterminateCenteredRoundCornerProgressBar : CenteredRoundCornerProgressBar { 15 | constructor(context: Context) : super(context) 16 | 17 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) 18 | 19 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super( 20 | context, 21 | attrs, 22 | defStyleAttr 23 | ) 24 | 25 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 26 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super( 27 | context, 28 | attrs, 29 | defStyleAttr, 30 | defStyleRes 31 | ) 32 | 33 | override fun initView() { 34 | super.initView() 35 | setMax(100) 36 | } 37 | 38 | override fun onProgressChangeAnimationUpdate(layout: LinearLayout, current: Float, to: Float) { 39 | if (!isShown) { 40 | super.stopProgressAnimationImmediately() 41 | } 42 | } 43 | 44 | override fun onProgressChangeAnimationEnd(layout: LinearLayout) { 45 | if (isShown) { 46 | startIndeterminateAnimation() 47 | } 48 | } 49 | 50 | override fun onVisibilityChanged(changedView: View, visibility: Int) { 51 | super.onVisibilityChanged(changedView, visibility) 52 | if (visibility == View.VISIBLE) { 53 | startIndeterminateAnimation() 54 | } 55 | } 56 | 57 | private fun startIndeterminateAnimation() { 58 | disableAnimation() 59 | setProgress(0) 60 | enableAnimation() 61 | setProgress(100) 62 | } 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example 2 | 3 | import android.os.Bundle 4 | import android.view.ViewGroup 5 | import androidx.activity.enableEdgeToEdge 6 | import androidx.appcompat.app.AppCompatActivity 7 | import androidx.core.view.ViewCompat 8 | import androidx.core.view.WindowInsetsCompat 9 | import androidx.core.view.updateLayoutParams 10 | import com.akexorcist.roundcornerprogressbar.example.databinding.ActivityMainBinding 11 | import com.google.android.material.tabs.TabLayoutMediator 12 | 13 | class MainActivity : AppCompatActivity() { 14 | private val binding: ActivityMainBinding by lazy { ActivityMainBinding.inflate(layoutInflater) } 15 | 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | enableEdgeToEdge() 19 | setContentView(binding.root) 20 | ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets -> 21 | val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) 22 | v.updateLayoutParams { 23 | topMargin = insets.top 24 | leftMargin = insets.left 25 | bottomMargin = insets.bottom 26 | rightMargin = insets.right 27 | } 28 | WindowInsetsCompat.CONSUMED 29 | } 30 | 31 | val adapter = ViewPagerAdapter(this) 32 | binding.viewPager.adapter = adapter 33 | TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position -> 34 | tab.text = getString( 35 | when (position) { 36 | 0 -> R.string.tab_round_corner_progress_bar 37 | 1 -> R.string.tab_centered_round_corner_progress_bar 38 | 2 -> R.string.tab_icon_round_corner_progress_bar 39 | 3 -> R.string.tab_text_round_corner_progress_bar 40 | 4 -> R.string.tab_indeterminate_round_corner_progress_bar 41 | else -> R.string.blank 42 | } 43 | ) 44 | }.attach() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/res/layout/layout_icon_round_corner_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 26 | 27 | 34 | 35 | 39 | 40 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Release Notes 2 | ==== 3 | 4 | 2.2.2 5 | -- 6 | * Migrate to Gradle Kotlin DSL 7 | * Update dependencies and Gradle version 8 | * Support Android 16 (Target SDK 36) 9 | * Update AGP 8.11.1 and Gradle 8.14.3 10 | * Refactoring and improvements 11 | * Fix incorrect badge link for Google Dev Library 12 | 13 | 2.2.1 14 | -- 15 | * Gradle 8.0 16 | * Android Gradle Plugin 8.1.0 17 | * Using Java 17 for Compile & Kotlin options 18 | 19 | 2.2.0 20 | -- 21 | * Convert all Java classes to Kotlin 22 | * Gradle 7.5 23 | * Android Gradle Plugin 7.4.2 24 | * Kotlin 1.8.20 25 | * Compile & Target SDK version 33 26 | * Minimum SDK version 17 27 | * Update dependencies 28 | * AndroidX Annotation 1.6.0 29 | 30 | 2.1.2 31 | -- 32 | * Fix unspecified module error 33 | 34 | 2.1.1 35 | -- 36 | * Fix bug in ([#57](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/57)) ([#77](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/77)) 37 | 38 | 2.1.0 39 | ---- 40 | * `CenteredRoundCornerProgressBar` added ([#42](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/42)) 41 | * `IndeterminateRoundCornerProgressBar` and `IndeterminateCenteredRoundCornerProgressBar` added 42 | * `IconRoundCornerProgressBar` now support for `Bitmap` and `Drawable` for icon 43 | * Animation for progress update (disable by default) added. This feature applied to all progress bars 44 | * Gradient progress color support (both primary and secondary progress) added. This feature applied to all progress bars (([#39](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/39))) 45 | * Text gravity when inside/outside and text position priority attribute in `TextRoundCornerProgressBar` added 46 | * Integer value support for progress setter (convert to float inside) added 47 | * Update to Gradle Plugin 3.6.3 and Gradle 5.6.4 48 | * Migrate from Android Support to AndroidX 49 | * Still in Java! (will be Kotlin in next version) 50 | * Fix bug in ([#43](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/43)) ([#20](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/20)) ([#74](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/74)) 51 | * Moved from MavenCentral to JCenter. Please see "Installation" section for new artifact ID 52 | * All new sample code. You should try it! 53 | * Add useful annotations for Kotlin 54 | 55 | 2.0.X 56 | ---- 57 | * New code structure for further development 58 | -------------------------------------------------------------------------------- /round-corner-progress-bar/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.kotlin.dsl.withType 2 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget 3 | import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile 4 | 5 | plugins { 6 | alias(libs.plugins.android.library) 7 | alias(libs.plugins.kotlin.android) 8 | alias(libs.plugins.maven.publish) 9 | id("signing") 10 | } 11 | 12 | android { 13 | namespace = "com.akexorcist.roundcornerprogressbar" 14 | compileSdk = libs.versions.compileSdk.get().toInt() 15 | 16 | defaultConfig { 17 | minSdk = libs.versions.minSdk.get().toInt() 18 | } 19 | 20 | buildTypes { 21 | release { 22 | isMinifyEnabled = false 23 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") 24 | } 25 | } 26 | 27 | compileOptions { 28 | sourceCompatibility = JavaVersion.VERSION_17 29 | targetCompatibility = JavaVersion.VERSION_17 30 | } 31 | } 32 | 33 | tasks.withType().configureEach { 34 | compilerOptions { 35 | jvmTarget.set(JvmTarget.JVM_17) 36 | freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation(libs.appcompat) 42 | implementation(libs.annotation) 43 | } 44 | 45 | mavenPublishing { 46 | publishToMavenCentral() 47 | signAllPublications() 48 | coordinates("com.akexorcist", "round-corner-progress-bar", libs.versions.libraryVersion.get()) 49 | pom { 50 | name.set("Round Corner Progress Bar") 51 | description.set("A progress bar with round corner for Android.") 52 | url.set("https://github.com/akexorcist/Android-RoundCornerProgressBar") 53 | licenses { 54 | license { 55 | name.set("The Apache Software License, Version 2.0") 56 | url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") 57 | distribution.set("repo") 58 | } 59 | } 60 | developers { 61 | developer { 62 | id.set("akexorcist") 63 | name.set("Akexorcist") 64 | email.set("akexorcist@gmail.com") 65 | } 66 | } 67 | scm { 68 | connection.set("scm:git:github.com/akexorcist/Android-RoundCornerProgressBar.git") 69 | developerConnection.set("scm:git:ssh://github.com:akexorcist/Android-RoundCornerProgressBar.git") 70 | url.set("https://github.com/akexorcist/Android-RoundCornerProgressBar") 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/java/com/akexorcist/roundcornerprogressbar/RoundCornerProgressBar.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.GradientDrawable 5 | import android.os.Build 6 | import android.util.AttributeSet 7 | import android.widget.LinearLayout 8 | import androidx.annotation.Keep 9 | import androidx.annotation.RequiresApi 10 | import com.akexorcist.roundcornerprogressbar.common.AnimatedRoundCornerProgressBar 11 | 12 | @Keep 13 | open class RoundCornerProgressBar : AnimatedRoundCornerProgressBar { 14 | constructor(context: Context) : super(context) 15 | 16 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) 17 | 18 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) 19 | 20 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 21 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) 22 | 23 | override fun initLayout(): Int = R.layout.layout_round_corner_progress_bar 24 | 25 | override fun initStyleable(context: Context, attrs: AttributeSet?) {} 26 | 27 | override fun initView() {} 28 | 29 | override fun drawProgress( 30 | layoutProgress: LinearLayout, 31 | progressDrawable: GradientDrawable, 32 | max: Float, 33 | progress: Float, 34 | totalWidth: Float, 35 | radius: Int, 36 | padding: Int, 37 | isReverse: Boolean, 38 | ) { 39 | val newRadius = radius - (padding / 2f) 40 | progressDrawable.cornerRadii = floatArrayOf( 41 | newRadius, 42 | newRadius, 43 | newRadius, 44 | newRadius, 45 | newRadius, 46 | newRadius, 47 | newRadius, 48 | newRadius, 49 | ) 50 | layoutProgress.background = progressDrawable 51 | val ratio = max / progress 52 | val progressWidth = ((totalWidth - (padding * 2)) / ratio).toInt() 53 | val progressParams = layoutProgress.layoutParams as MarginLayoutParams 54 | progressParams.width = progressWidth 55 | if (padding + (progressWidth / 2) < radius) { 56 | val margin = (radius - padding).coerceAtLeast(0) - (progressWidth / 2) 57 | progressParams.topMargin = margin 58 | progressParams.bottomMargin = margin 59 | } else { 60 | progressParams.topMargin = 0 61 | progressParams.bottomMargin = 0 62 | } 63 | layoutProgress.layoutParams = progressParams 64 | } 65 | 66 | override fun onViewDraw() {} 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | 17 | 22 | 23 | 31 | 32 | 36 | 37 | 41 | 42 | 46 | 47 | 51 | 52 | 56 | 57 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /round-corner-progress-bar/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /publish/mavencentral.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'signing' 3 | 4 | task androidJavadocJar(type: Jar) { 5 | archiveClassifier.set('javadoc') 6 | from("$buildDir/javadoc") 7 | } 8 | 9 | task androidSourcesJar(type: Jar) { 10 | archiveClassifier.set('sources') 11 | if (project.plugins.findPlugin("com.android.library")) { 12 | from android.sourceSets.main.java.srcDirs 13 | from android.sourceSets.main.kotlin.srcDirs 14 | } else { 15 | from sourceSets.main.java.srcDirs 16 | from sourceSets.main.kotlin.srcDirs 17 | } 18 | } 19 | 20 | group = project.groupId 21 | version = project.versionName 22 | 23 | ext["signing.keyId"] = '' 24 | ext["signing.password"] = '' 25 | ext["signing.secretKeyRingFile"] = '' 26 | ext["ossrhUsername"] = '' 27 | ext["ossrhPassword"] = '' 28 | ext["sonatypeStagingProfileId"] = '' 29 | 30 | ext["signing.keyId"] = getEnvironmentOrPropertyValue('SIGNING_KEY_ID') 31 | ext["signing.password"] = getEnvironmentOrPropertyValue('SIGNING_PASSWORD') 32 | ext["signing.secretKeyRingFile"] = getEnvironmentOrPropertyValue('SIGNING_SECRET_KEY_RING_FILE') 33 | ext["ossrhUsername"] = getEnvironmentOrPropertyValue('OSSRH_USERNAME') 34 | ext["ossrhPassword"] = getEnvironmentOrPropertyValue('OSSRH_PASSWORD') 35 | ext["sonatypeStagingProfileId"] = getEnvironmentOrPropertyValue('SONATYPE_STAGING_PROFILE_ID') 36 | 37 | private def getEnvironmentOrPropertyValue(String key) { 38 | return System.getenv(key) ?: getProperty(key) ?: "" 39 | } 40 | 41 | publishing { 42 | publications { 43 | release(MavenPublication) { 44 | groupId project.groupId 45 | artifactId project.artifactId 46 | version project.versionName 47 | 48 | if (project.plugins.findPlugin("com.android.library")) { 49 | artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") 50 | } else { 51 | artifact("$buildDir/libs/${project.getName()}-${version}.jar") 52 | } 53 | 54 | artifact androidJavadocJar 55 | artifact androidSourcesJar 56 | 57 | pom { 58 | name = project.libraryName 59 | description = project.libraryDescription 60 | url = project.siteUrl 61 | licenses { 62 | license { 63 | name = project.licenseName 64 | url = project.licenseUrl 65 | } 66 | } 67 | developers { 68 | developer { 69 | id = project.developerId 70 | name = project.developName 71 | email = project.developerEmail 72 | } 73 | } 74 | scm { 75 | connection = project.gitUrl 76 | developerConnection = project.gitUrl 77 | url = project.siteUrl 78 | } 79 | withXml { 80 | def dependenciesNode = asNode().appendNode('dependencies') 81 | project.configurations.implementation.allDependencies.each { 82 | if (it.name != 'unspecified') { 83 | def dependencyNode = dependenciesNode.appendNode('dependency') 84 | dependencyNode.appendNode('groupId', it.group) 85 | dependencyNode.appendNode('artifactId', it.name) 86 | dependencyNode.appendNode('version', it.version) 87 | } 88 | } 89 | } 90 | } 91 | } 92 | } 93 | repositories { 94 | maven { 95 | name = "sonatype" 96 | url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 97 | credentials { 98 | username ossrhUsername 99 | password ossrhPassword 100 | } 101 | } 102 | } 103 | } 104 | 105 | signing { 106 | sign publishing.publications 107 | } 108 | -------------------------------------------------------------------------------- /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 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/fragment/SimpleDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.akexorcist.roundcornerprogressbar.example.R 9 | import com.akexorcist.roundcornerprogressbar.example.databinding.FragmentSimpleDemoBinding 10 | 11 | class SimpleDemoFragment : Fragment() { 12 | private lateinit var binding: FragmentSimpleDemoBinding 13 | 14 | companion object { 15 | fun newInstance(): Fragment = SimpleDemoFragment() 16 | } 17 | 18 | override fun onCreateView( 19 | inflater: LayoutInflater, 20 | container: ViewGroup?, 21 | savedInstanceState: Bundle? 22 | ): View { 23 | binding = FragmentSimpleDemoBinding.inflate(layoutInflater, container, false) 24 | return binding.root 25 | } 26 | 27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 28 | super.onViewCreated(view, savedInstanceState) 29 | with(binding) { 30 | textViewSimple1.text = getSimple1Description() 31 | textViewSimple2.text = getSimple2Description() 32 | textViewSimple3.text = getSimple3Description() 33 | textViewSimple4.text = getSimple4Description() 34 | textViewSimple5.text = getSimple5Description() 35 | buttonSimpleCustomIncrease.setOnClickListener { increaseCustomProgress() } 36 | buttonSimpleCustomExtraIncrease.setOnClickListener { extraIncreaseCustomProgress() } 37 | buttonSimpleCustomDecrease.setOnClickListener { decreaseCustomProgress() } 38 | buttonSimpleCustomExtraDecrease.setOnClickListener { extraDecreaseCustomProgress() } 39 | checkBoxAnimationEnable.setOnCheckedChangeListener { _, isChecked -> 40 | onAnimationEnableCheckedChange( 41 | isChecked 42 | ) 43 | } 44 | checkBoxGradientProgressColor.setOnCheckedChangeListener { _, isChecked -> 45 | onApplyGradientProgressColorCheckedChange( 46 | isChecked 47 | ) 48 | } 49 | progressBarSimpleCustom.setOnProgressChangedListener { _, _, isPrimaryProgress, _ -> 50 | if (isPrimaryProgress) { 51 | updateCustomProgressText() 52 | } 53 | } 54 | } 55 | updateCustomProgressText() 56 | } 57 | 58 | private fun onAnimationEnableCheckedChange(isChecked: Boolean) { 59 | with(binding) { 60 | if (isChecked) { 61 | progressBarSimpleCustom.enableAnimation() 62 | } else { 63 | progressBarSimpleCustom.disableAnimation() 64 | } 65 | } 66 | } 67 | 68 | private fun onApplyGradientProgressColorCheckedChange(isChecked: Boolean) { 69 | with(binding) { 70 | if (isChecked) { 71 | progressBarSimpleCustom.setProgressColors(resources.getIntArray(R.array.sample_progress_gradient)) 72 | } else { 73 | @Suppress("DEPRECATION") 74 | progressBarSimpleCustom.setProgressColor(resources.getColor(R.color.sample_progress_primary)) 75 | } 76 | } 77 | } 78 | 79 | private fun increaseCustomProgress() { 80 | with(binding) { 81 | progressBarSimpleCustom.setProgress(progressBarSimpleCustom.getProgress() + 2) 82 | } 83 | updateCustomSecondaryProgress() 84 | } 85 | 86 | private fun extraIncreaseCustomProgress() { 87 | with(binding) { 88 | progressBarSimpleCustom.setProgress(progressBarSimpleCustom.getProgress() + 20) 89 | } 90 | updateCustomSecondaryProgress() 91 | } 92 | 93 | private fun decreaseCustomProgress() { 94 | with(binding) { 95 | progressBarSimpleCustom.setProgress(progressBarSimpleCustom.getProgress() - 2) 96 | } 97 | updateCustomSecondaryProgress() 98 | } 99 | 100 | private fun extraDecreaseCustomProgress() { 101 | with(binding) { 102 | progressBarSimpleCustom.setProgress(progressBarSimpleCustom.getProgress() - 20) 103 | } 104 | updateCustomSecondaryProgress() 105 | } 106 | 107 | private fun updateCustomSecondaryProgress() { 108 | with(binding) { 109 | progressBarSimpleCustom.setSecondaryProgress(progressBarSimpleCustom.getProgress() + 10) 110 | } 111 | } 112 | 113 | private fun updateCustomProgressText() { 114 | with(binding) { 115 | textViewSimpleCustom.text = "${progressBarSimpleCustom.getProgress()}" 116 | } 117 | } 118 | 119 | private fun getSimple1Description() = """ 120 | |Max : 100 121 | |Progress : 50 122 | |Radius : 0dp 123 | |Padding : 4dp 124 | |Width : 260dp 125 | |Height : 30dp 126 | """.trimMargin() 127 | 128 | private fun getSimple2Description() = """ 129 | |Max : 100 130 | |Progress : 40 131 | |SecondaryProgress : 60 132 | |Radius : 10dp 133 | |Padding : 2dp 134 | |Width : 260dp 135 | |Height : 30dp 136 | """.trimMargin() 137 | 138 | private fun getSimple3Description() = """ 139 | |Max : 100 140 | |Progress : 20 141 | |SecondaryProgress : 75 142 | |Radius : 80dp 143 | |Padding : 2dp 144 | |Reverse : True 145 | |Width : 260dp 146 | |Height : 30dp 147 | """.trimMargin() 148 | 149 | private fun getSimple4Description() = """ 150 | |Max : 100 151 | |Progress : 80 152 | |Radius : 20dp 153 | |Padding : 2dp 154 | |Width : 260dp 155 | |Height : 20dp 156 | """.trimMargin() 157 | 158 | private fun getSimple5Description() = """ 159 | |Max : 200 160 | |Progress : 20 161 | |Radius : 20dp 162 | |Padding : 10dp 163 | |Width : 260dp 164 | |Height : 50dp 165 | """.trimMargin() 166 | } 167 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/fragment/CenteredDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.akexorcist.roundcornerprogressbar.example.R 9 | import com.akexorcist.roundcornerprogressbar.example.databinding.FragmentCenteredDemoBinding 10 | 11 | class 12 | CenteredDemoFragment : Fragment() { 13 | private lateinit var binding: FragmentCenteredDemoBinding 14 | 15 | companion object { 16 | fun newInstance(): Fragment = CenteredDemoFragment() 17 | } 18 | 19 | override fun onCreateView( 20 | inflater: LayoutInflater, 21 | container: ViewGroup?, 22 | savedInstanceState: Bundle? 23 | ): View { 24 | binding = FragmentCenteredDemoBinding.inflate(layoutInflater, container, false) 25 | return binding.root 26 | } 27 | 28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 29 | super.onViewCreated(view, savedInstanceState) 30 | with(binding) { 31 | textViewCentered1.text = getCentered1Description() 32 | textViewCentered2.text = getCentered2Description() 33 | textViewCentered3.text = getCentered3Description() 34 | textViewCentered4.text = getCentered4Description() 35 | textViewCentered5.text = getCentered5Description() 36 | buttonCenteredCustomIncrease.setOnClickListener { increaseCustomProgress() } 37 | buttonCenteredCustomExtraIncrease.setOnClickListener { extraIncreaseCustomProgress() } 38 | buttonCenteredCustomDecrease.setOnClickListener { decreaseCustomProgress() } 39 | buttonCenteredCustomExtraDecrease.setOnClickListener { extraDecreaseCustomProgress() } 40 | checkBoxAnimationEnable.setOnCheckedChangeListener { _, isChecked -> 41 | onAnimationEnableCheckedChange( 42 | isChecked 43 | ) 44 | } 45 | checkBoxGradientProgressColor.setOnCheckedChangeListener { _, isChecked -> 46 | onApplyGradientProgressColorCheckedChange( 47 | isChecked 48 | ) 49 | } 50 | progressBarCenteredCustom.setOnProgressChangedListener { _, _, isPrimaryProgress, _ -> 51 | if (isPrimaryProgress) { 52 | updateCustomProgressText() 53 | } 54 | } 55 | } 56 | updateCustomProgressText() 57 | } 58 | 59 | private fun onAnimationEnableCheckedChange(isChecked: Boolean) { 60 | with(binding) { 61 | if (isChecked) { 62 | progressBarCenteredCustom.enableAnimation() 63 | } else { 64 | progressBarCenteredCustom.disableAnimation() 65 | } 66 | } 67 | } 68 | 69 | private fun onApplyGradientProgressColorCheckedChange(isChecked: Boolean) { 70 | with(binding) { 71 | if (isChecked) { 72 | progressBarCenteredCustom.setProgressColors(resources.getIntArray(R.array.sample_progress_gradient)) 73 | } else { 74 | @Suppress("DEPRECATION") 75 | progressBarCenteredCustom.setProgress(resources.getColor(R.color.sample_progress_primary)) 76 | } 77 | } 78 | } 79 | 80 | private fun increaseCustomProgress() { 81 | with(binding) { 82 | progressBarCenteredCustom.setProgress(progressBarCenteredCustom.getProgress() + 2) 83 | } 84 | updateCustomSecondaryProgress() 85 | } 86 | 87 | private fun extraIncreaseCustomProgress() { 88 | with(binding) { 89 | progressBarCenteredCustom.setProgress(progressBarCenteredCustom.getProgress() + 20) 90 | } 91 | updateCustomSecondaryProgress() 92 | } 93 | 94 | private fun decreaseCustomProgress() { 95 | with(binding) { 96 | progressBarCenteredCustom.setProgress(progressBarCenteredCustom.getProgress() - 2) 97 | } 98 | updateCustomSecondaryProgress() 99 | } 100 | 101 | private fun extraDecreaseCustomProgress() { 102 | with(binding) { 103 | progressBarCenteredCustom.setProgress(progressBarCenteredCustom.getProgress() - 20) 104 | } 105 | updateCustomSecondaryProgress() 106 | } 107 | 108 | private fun updateCustomSecondaryProgress() { 109 | with(binding) { 110 | progressBarCenteredCustom.setSecondaryProgress(progressBarCenteredCustom.getProgress() + 10) 111 | } 112 | } 113 | 114 | private fun updateCustomProgressText() { 115 | with(binding) { 116 | textViewCenteredCustom.text = "${progressBarCenteredCustom.getProgress()}" 117 | } 118 | } 119 | 120 | private fun getCentered1Description() = """ 121 | |Max : 100 122 | |Progress : 50 123 | |Radius : 0dp 124 | |Padding : 4dp 125 | |Width : 260dp 126 | |Height : 30dp 127 | """.trimMargin() 128 | 129 | private fun getCentered2Description() = """ 130 | |Max : 100 131 | |Progress : 40 132 | |SecondaryProgress : 60 133 | |Radius : 10dp 134 | |Radius : 10dp 135 | |Padding : 2dp 136 | |Width : 260dp 137 | |Height : 30dp 138 | """.trimMargin() 139 | 140 | private fun getCentered3Description() = """ 141 | |Max : 100 142 | |Progress : 20 143 | |SecondaryProgress : 75 144 | |Radius : 80dp 145 | |Padding : 2dp 146 | |Reverse : True 147 | |Width : 260dp 148 | |Height : 30dp 149 | """.trimMargin() 150 | 151 | private fun getCentered4Description() = """ 152 | |Max : 100 153 | |Progress : 80 154 | |Radius : 20dp 155 | |Padding : 2dp 156 | |Width : 260dp 157 | |Height : 20dp 158 | """.trimMargin() 159 | 160 | private fun getCentered5Description() = """ 161 | |Max : 200 162 | |Progress : 20 163 | |Radius : 20dp 164 | |Padding : 10dp 165 | |Width : 260dp 166 | |Height : 50dp 167 | """.trimMargin() 168 | } 169 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_indeterminate_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 24 | 25 | 30 | 31 | 36 | 37 | 46 | 47 | 48 | 53 | 54 | 60 | 61 | 70 | 71 | 72 | 80 | 81 | 86 | 87 | 93 | 94 | 103 | 104 | 105 | 110 | 111 | 116 | 117 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/fragment/IconDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.akexorcist.roundcornerprogressbar.example.R 9 | import com.akexorcist.roundcornerprogressbar.example.databinding.FragmentIconDemoBinding 10 | 11 | class IconDemoFragment : Fragment() { 12 | private lateinit var binding: FragmentIconDemoBinding 13 | 14 | companion object { 15 | fun newInstance(): Fragment = IconDemoFragment() 16 | } 17 | 18 | override fun onCreateView( 19 | inflater: LayoutInflater, 20 | container: ViewGroup?, 21 | savedInstanceState: Bundle? 22 | ): View { 23 | binding = FragmentIconDemoBinding.inflate(layoutInflater, container, false) 24 | return binding.root 25 | } 26 | 27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 28 | super.onViewCreated(view, savedInstanceState) 29 | with(binding) { 30 | textViewIcon1.text = getIcon1Description() 31 | textViewIcon2.text = getIcon2Description() 32 | textViewIcon3.text = getIcon3Description() 33 | textViewIcon4.text = getIcon4Description() 34 | textViewIcon5.text = getIcon5Description() 35 | textViewIcon6.text = getIcon6Description() 36 | textViewIcon7.text = getIcon7Description() 37 | buttonIconCustomIncrease.setOnClickListener { increaseCustomProgress() } 38 | buttonIconCustomExtraIncrease.setOnClickListener { extraIncreaseCustomProgress() } 39 | buttonIconCustomDecrease.setOnClickListener { decreaseCustomProgress() } 40 | buttonIconCustomExtraDecrease.setOnClickListener { extraDecreaseCustomProgress() } 41 | checkBoxAnimationEnable.setOnCheckedChangeListener { _, isChecked -> 42 | onAnimationEnableCheckdChange( 43 | isChecked 44 | ) 45 | } 46 | checkBoxGradientProgressColor.setOnCheckedChangeListener { _, isChecked -> 47 | onApplyGradientProgressColorCheckedChange( 48 | isChecked 49 | ) 50 | } 51 | progressBarIconCustom.setOnProgressChangedListener { _, _, isPrimaryProgress, _ -> 52 | if (isPrimaryProgress) { 53 | updateCustomProgressText() 54 | } 55 | } 56 | } 57 | updateCustomProgressText() 58 | } 59 | 60 | private fun onAnimationEnableCheckdChange(isChecked: Boolean) { 61 | with(binding) { 62 | if (isChecked) { 63 | progressBarIconCustom.enableAnimation() 64 | } else { 65 | progressBarIconCustom.disableAnimation() 66 | } 67 | } 68 | } 69 | 70 | private fun onApplyGradientProgressColorCheckedChange(isChecked: Boolean) { 71 | with(binding) { 72 | if (isChecked) { 73 | progressBarIconCustom.setProgressColors(resources.getIntArray(R.array.sample_progress_gradient)) 74 | } else { 75 | @Suppress("DEPRECATION") 76 | progressBarIconCustom.setProgressColor(resources.getColor(R.color.sample_progress_primary)) 77 | } 78 | } 79 | } 80 | 81 | private fun increaseCustomProgress() { 82 | with(binding) { 83 | progressBarIconCustom.setProgress(progressBarIconCustom.getProgress() + 2) 84 | } 85 | updateCustomSecondaryProgress() 86 | } 87 | 88 | private fun extraIncreaseCustomProgress() { 89 | with(binding) { 90 | progressBarIconCustom.setProgress(progressBarIconCustom.getProgress() + 20) 91 | } 92 | updateCustomSecondaryProgress() 93 | } 94 | 95 | private fun decreaseCustomProgress() { 96 | with(binding) { 97 | progressBarIconCustom.setProgress(progressBarIconCustom.getProgress() - 2) 98 | } 99 | updateCustomSecondaryProgress() 100 | } 101 | 102 | private fun extraDecreaseCustomProgress() { 103 | with(binding) { 104 | progressBarIconCustom.setProgress(progressBarIconCustom.getProgress() - 20) 105 | } 106 | updateCustomSecondaryProgress() 107 | } 108 | 109 | private fun updateCustomSecondaryProgress() { 110 | with(binding) { 111 | progressBarIconCustom.setSecondaryProgress(progressBarIconCustom.getProgress() + 30) 112 | } 113 | } 114 | 115 | private fun updateCustomProgressText() { 116 | with(binding) { 117 | textViewIconCustom.text = "${progressBarIconCustom.getProgress()}" 118 | } 119 | } 120 | 121 | private fun getIcon1Description() = """ 122 | |Max : 150 123 | |Progress : 90 124 | |Icon Size : 40dp 125 | |Icon Padding : 5dp 126 | |Radius : 5dp 127 | |Background Padding : 2dp 128 | |Width : 260dp 129 | |Height : Wrap Content 130 | """.trimMargin() 131 | 132 | private fun getIcon2Description() = """ 133 | |Max : 150 134 | |Progress : 90 135 | |Icon Size : 40dp 136 | |Icon Padding : 5dp 137 | |Radius : 5dp 138 | |Background Padding : 2dp 139 | |Reverse : True 140 | |Width : 260dp 141 | |Height : Wrap Content 142 | """.trimMargin() 143 | 144 | private fun getIcon3Description() = """ 145 | |Max : 150 146 | |Progress : 50 147 | |Secondary Progress : 80 148 | |Icon Size : 25dp 149 | |Icon Padding : 5dp 150 | |Radius : 5dp 151 | |Background Padding : 5dp 152 | |Reverse : True 153 | |Width : 260dp 154 | |Height : Wrap Content 155 | """.trimMargin() 156 | 157 | private fun getIcon4Description() = """ 158 | |Max : 150 159 | |Progress : 40 160 | |Icon Size : 70dp 161 | |Icon Padding : 5dp 162 | |Radius : 5dp 163 | |Background Padding : 10dp 164 | |Width : 260dp 165 | |Height : Wrap Content 166 | """.trimMargin() 167 | 168 | private fun getIcon5Description() = """ 169 | |Max : 150 170 | |Progress : 150 171 | |Icon Size : 30dp 172 | |Icon Padding : 3dp 173 | |Radius : 5dp 174 | |Background Padding : 5dp 175 | |Width : 260dp 176 | |Height : Wrap Content 177 | """.trimMargin() 178 | 179 | private fun getIcon6Description() = """ 180 | |Max : 150 181 | |Progress : 5 182 | |Icon Size : 50dp 183 | |Icon Padding : 3dp 184 | |Radius : 20dp 185 | |Background Padding : 10dp 186 | |Width : 260dp 187 | |Height : Wrap Content 188 | """.trimMargin() 189 | 190 | private fun getIcon7Description() = """ 191 | |No Icon Image 192 | |Max : 150 193 | |Progress : 100 194 | |Icon Size : 20dp 195 | |Icon Padding : 10dp 196 | |Radius : 30dp 197 | |Background Padding : 5dp 198 | |Width : 260dp 199 | |Height : Wrap Content 200 | """.trimMargin() 201 | } 202 | -------------------------------------------------------------------------------- /app/src/main/java/com/akexorcist/roundcornerprogressbar/example/fragment/TextDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.akexorcist.roundcornerprogressbar.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar 9 | import com.akexorcist.roundcornerprogressbar.example.databinding.FragmentTextDemoBinding 10 | 11 | class TextDemoFragment : Fragment() { 12 | private lateinit var binding: FragmentTextDemoBinding 13 | 14 | companion object { 15 | fun newInstance(): Fragment = TextDemoFragment() 16 | } 17 | 18 | override fun onCreateView( 19 | inflater: LayoutInflater, 20 | container: ViewGroup?, 21 | savedInstanceState: Bundle? 22 | ): View { 23 | binding = FragmentTextDemoBinding.inflate(layoutInflater, container, false) 24 | return binding.root 25 | } 26 | 27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 28 | super.onViewCreated(view, savedInstanceState) 29 | with(binding) { 30 | textViewText1.text = getText1Description() 31 | textViewText2.text = getText2Description() 32 | textViewText3.text = getText3Description() 33 | textViewText4.text = getText4Description() 34 | textViewText5.text = getText5Description() 35 | buttonTextCustomIncrease.setOnClickListener { increaseCustomProgress() } 36 | buttonTextCustomExtraIncrease.setOnClickListener { extraIncreaseCustomProgress() } 37 | buttonTextCustomDecrease.setOnClickListener { decreaseCustomProgress() } 38 | buttonTextCustomExtraDecrease.setOnClickListener { extraDecreaseCustomProgress() } 39 | checkBoxAnimationEnable.setOnCheckedChangeListener { _, isChecked -> 40 | onAnimationEnableCheckdChange( 41 | isChecked 42 | ) 43 | } 44 | progressBarTextCustom.setOnProgressChangedListener { _, _, isPrimaryProgress, _ -> 45 | if (isPrimaryProgress) { 46 | updateCustomProgressText() 47 | } 48 | } 49 | radioButtonInsideGravityStart.setOnCheckedChangeListener { _, isChecked -> 50 | if (isChecked) { 51 | updateInsideTextGravityCustomProgress(TextRoundCornerProgressBar.GRAVITY_START) 52 | } 53 | } 54 | radioButtonInsideGravityEnd.setOnCheckedChangeListener { _, isChecked -> 55 | if (isChecked) { 56 | updateInsideTextGravityCustomProgress(TextRoundCornerProgressBar.GRAVITY_END) 57 | } 58 | } 59 | radioButtonOutsideGravityStart.setOnCheckedChangeListener { _, isChecked -> 60 | if (isChecked) { 61 | updateOutsideTextGravityCustomProgress(TextRoundCornerProgressBar.GRAVITY_START) 62 | } 63 | } 64 | radioButtonOutsideGravityEnd.setOnCheckedChangeListener { _, isChecked -> 65 | if (isChecked) { 66 | updateOutsideTextGravityCustomProgress(TextRoundCornerProgressBar.GRAVITY_END) 67 | } 68 | } 69 | radioButtonTextPositionPriorityInside.setOnCheckedChangeListener { _, isChecked -> 70 | if (isChecked) { 71 | updateTextPositionPriorityCustomProgress(TextRoundCornerProgressBar.PRIORITY_INSIDE) 72 | } 73 | } 74 | radioButtonTextPositionPriorityOutside.setOnCheckedChangeListener { _, isChecked -> 75 | if (isChecked) { 76 | updateTextPositionPriorityCustomProgress(TextRoundCornerProgressBar.PRIORITY_OUTSIDE) 77 | } 78 | } 79 | } 80 | updateCustomProgressText() 81 | } 82 | 83 | private fun onAnimationEnableCheckdChange(isChecked: Boolean) { 84 | with(binding) { 85 | if (isChecked) { 86 | progressBarTextCustom.enableAnimation() 87 | } else { 88 | progressBarTextCustom.disableAnimation() 89 | } 90 | } 91 | } 92 | 93 | private fun increaseCustomProgress() { 94 | with(binding) { 95 | progressBarTextCustom.setProgress(progressBarTextCustom.getProgress() + 2) 96 | } 97 | } 98 | 99 | private fun extraIncreaseCustomProgress() { 100 | with(binding) { 101 | progressBarTextCustom.setProgress(progressBarTextCustom.getProgress() + 20) 102 | } 103 | } 104 | 105 | private fun decreaseCustomProgress() { 106 | with(binding) { 107 | progressBarTextCustom.setProgress(progressBarTextCustom.getProgress() - 2) 108 | } 109 | } 110 | 111 | private fun extraDecreaseCustomProgress() { 112 | with(binding) { 113 | progressBarTextCustom.setProgress(progressBarTextCustom.getProgress() - 20) 114 | } 115 | } 116 | 117 | private fun updateInsideTextGravityCustomProgress(gravity: Int) { 118 | with(binding) { 119 | progressBarTextCustom.setTextInsideGravity(gravity) 120 | } 121 | } 122 | 123 | private fun updateOutsideTextGravityCustomProgress(gravity: Int) { 124 | with(binding) { 125 | progressBarTextCustom.setTextOutsideGravity(gravity) 126 | } 127 | } 128 | 129 | private fun updateTextPositionPriorityCustomProgress(priority: Int) { 130 | with(binding) { 131 | progressBarTextCustom.setTextPositionPriority(priority) 132 | } 133 | } 134 | 135 | private fun updateCustomProgressText() { 136 | with(binding) { 137 | progressBarTextCustom.setProgressText("${progressBarTextCustom.getProgress()}") 138 | } 139 | } 140 | 141 | private fun getText1Description() = """ 142 | |Max : 100 143 | |Progress : 50 144 | |Radius : 0dp 145 | |Padding : 4dp 146 | |Width : 260dp 147 | |Height : 30dp 148 | """.trimMargin() 149 | 150 | private fun getText2Description() = """ 151 | |Max : 100 152 | |Progress : 40 153 | |SecondaryProgress : 60 154 | |Radius : 10dp 155 | |Padding : 2dp 156 | |Text Inside Gravity : End 157 | |Width : 260dp 158 | |Height : 30dp 159 | """.trimMargin() 160 | 161 | private fun getText3Description() = """ 162 | |Max : 100 163 | |Progress : 20 164 | |SecondaryProgress : 75 165 | |Radius : 80dp 166 | |Padding : 2dp 167 | |Reverse : True 168 | |Text Position Priority : Outside 169 | |Width : 260dp 170 | |Height : 30dp 171 | """.trimMargin() 172 | 173 | private fun getText4Description() = """ 174 | |Max : 100 175 | |Progress : 80 176 | |Radius : 20dp 177 | |Padding : 2dp 178 | |Text Size : 12sp 179 | |Width : 260dp 180 | |Height : 20dp 181 | """.trimMargin() 182 | 183 | private fun getText5Description() = """ 184 | |Max : 200 185 | |Progress : 20 186 | |Radius : 20dp 187 | |Padding : 10dp 188 | |Width : 260dp 189 | |Height : 50dp 190 | """.trimMargin() 191 | } 192 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_simple_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 24 | 25 | 30 | 31 | 43 | 44 | 50 | 51 |