# RoundCornerProgressBar **Repository Path**: prostory/RoundCornerProgressBar ## Basic Information - **Project Name**: RoundCornerProgressBar - **Description**: fork from https://github.com/akexorcist/RoundCornerProgressBar - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-11-24 - **Last Updated**: 2025-01-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Round%20Corner%20Progress%20Bar-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/1375) [ ![Download](https://api.bintray.com/packages/akexorcist/maven/round-corner-progress-bar/images/download.svg) ](https://bintray.com/akexorcist/maven/round-corner-progress-bar) ![Minimum SDK Version](https://img.shields.io/badge/minSdkVersion-17-brightgreen) [![Build Status](https://travis-ci.org/akexorcist/Android-RoundCornerProgressBar.svg?branch=master)](https://travis-ci.org/akexorcist/Android-RoundCornerProgressBar) RoundCornerProgressBar === Round corner is cool. Let's make your progress bar to round corner ![Round Corner Progress Bar Sample](/image/header.jpg) Colorful progress bar with round corner on progress which you can customized a color and corner radius Installation === ```groovy implementation 'com.akexorcist:round-corner-progress-bar:2.1.1' ``` Migrate from 2.0.x to 2.1.x or higher --- ### Moving from MavenCentral to JCenter with new artifact ID From (MavenCentral) ```groovy // Old (MavenCentral) implementation 'com.akexorcist:RoundCornerProgressBar:2.0.3' // New (JCenter) implementation 'com.akexorcist:round-corner-progress-bar:2.1.1' ``` ### BaseRoundCornerProgressBar.OnProgressChangedListener Change the view ID parameter in `onProgressChanged` to View class ```kotlin // Old fun onProgressChanged( viewId: Int, progress: Float, isPrimaryProgress: Boolean, isSecondaryProgress: Boolean ) // New fun onProgressChanged( view: View, progress: Float, isPrimaryProgress: Boolean, isSecondaryProgress: Boolean ) ``` ### Custom your own progress bar by extends BaseRoundCornerProgressBar Use AnimatedRoundCornerProgressBar instead of BaseRoundCornerProgressBar for progress change animation support. ```Kotlin class CustomRoundCornerProgressBar: AnimatedRoundCornerProgressBar() { ... } ``` And you do not have to create the `GradientDrawable` by yourself anymore. `drawProgress` will send it as parameter. ```kotlin // Old fun drawProgress( layoutProgress: LinearLayout, max: Float, progress: Float, totalWidth: Float, radius: Int, padding: Int, progressColor: Int, isReverse: Boolean ) // New fun drawProgress( layoutProgress: LinearLayout, progressDrawable: GradientDrawable, max: Float, progress: Float, totalWidth: Float, radius: Int, padding: Int, isReverse: Boolean ) ``` Release Notes === ### 2.1.1 * Fix bug in ([#57](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/57)) ([#77](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/77)) ### 2.1.0 * `CenteredRoundCornerProgressBar` added ([#42](https://github.com/akexorcist/Android-RoundCornerProgressBar/issues/42)) * `IndeterminateRoundCornerProgressBar` and `IndeterminateCenteredRoundCornerProgressBar` added * `IconRoundCornerProgressBar` now support for `Bitmap` and `Drawable` for icon * Animation for progress update (disable by default) added. This feature applied to all progress bars * 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))) * Text gravity when inside/outside and text position priority attribute in `TextRoundCornerProgressBar` added * Integer value support for progress setter (convert to float inside) added * Update to Gradle Plugin 3.6.3 and Gradle 5.6.4 * Migrate from Android Support to AndroidX * Still in Java! (will be Kotlin in next version) * 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)) * Moved from MavenCentral to JCenter. Please see "Installation" section for new artifact ID * All new sample code. You should try it! * Add useful annotations for Kotlin ### 2.0.X * New code structure, Easy for further development Demo === [![Round Corner Progress Bar Demo (Google Play)](/image/google_play.jpg)](https://play.google.com/store/apps/details?id=com.akexorcist.roundcornerprogressbar) Overview === ### Round Corner Progress Bar Simple round corner progress bar ![Round Corner Progress Bar](/image/overview_simple.jpg) ### CenteredRoundCornerProgressBar Round corner progress bar with progress expands from the center ![Centered Round Corner Progress Bar](/image/overview_centered.jpg) ### Icon Round Corner Progress Bar Round corner progress bar with heading icon ![Icon Round Corner Progress Bar](/image/overview_icon.jpg) ### TextRoundCornerProgressBar Round corner progress bar with text inside the progress ![Icon Round Corner Progress Bar](/image/overview_text.jpg) ### IndeterminateRoundCornerProgressBar and IndeterminateCenteredRoundCornerProgressBar Simple round corner progress bar and centered round corner progress bar with indeterminate animation ![Indeterminate Round Corner Progress Bar and Indeterminate Centered Round Corner Progress Bar](/image/overview_indeterminate.gif) Feature =========================== ### Standard Features * Primary progress and secondary progress supported * Primary progress, secondary progress and progress background color are customizable * Customize your own progress background padding * Customize your own progress's corner radius * Reversing progress bar supported * Progress bar with gradient color? Yes! * Progress change animation? Absolutely yes! ### Component Features * Progress expanding from center with `CenteredRoundCornerProgressBar` * Heading icon supported with `IconRoundCornerProgressBar` * Text inside progress supported with `TextRoundCornerProgressBar` * Indeterminate animation supported with `IndeterminateRoundCornerProgressBar` or `IndeterminateCenteredRoundCornerProgressBar` Usage =========================== For using custom attribute of progress bar, define 'app' namespace as root view attribute in your layout ```xml xmlns:app="http://schemas.android.com/apk/res-auto" ``` RoundCornerProgressBar ------------------------------- ### Example ```xml ``` ![Round Corner Progress Bar](/image/sample_simple.jpg) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Progress fun getMax(): Float fun setMax(max: Float) fun getProgress(): Float fun setProgress(progress: Int) fun setProgress(progress: Float) fun getSecondaryProgress(): Float fun setSecondaryProgress(secondaryProgress: Int) fun setSecondaryProgress(secondaryProgress: Float) // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float // Animation fun enableAnimation() fun disableAnimation() fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) fun isProgressAnimating(): Boolean fun isSecondaryProgressAnimating(): Boolean // Reversing Progress fun isReverse(): Boolean fun setReverse(isReverse: Boolean) // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) // Listener fun setOnProgressChangedListener(listener: OnProgressChangedListener) ``` CenteredRoundCornerProgressBar --- Same as RoundCornerProgressBar but reversing does not supported. ### Example ```xml ``` ![Centerd Round Corner Progress Bar](/image/sample_centered.jpg) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Progress fun getMax(): Float fun setMax(max: Float) fun getProgress(): Float fun setProgress(progress: Int) fun setProgress(progress: Float) fun getSecondaryProgress(): Float fun setSecondaryProgress(secondaryProgress: Int) fun setSecondaryProgress(secondaryProgress: Float) // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float // Animation fun enableAnimation() fun disableAnimation() fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) fun isProgressAnimating(): Boolean fun isSecondaryProgressAnimating(): Boolean // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) // Listener fun setOnProgressChangedListener(listener: OnProgressChangedListener) ``` IconRoundCornerProgressBar ------------------------------- Icon size is required for this progress bar. Use `wrap_content` for `layout_height` is recommended. ```xml ``` ### Example ```xml ``` ![Icon Round Corner Progress Bar](/image/sample_icon.jpg) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Progress fun getMax(): Float fun setMax(max: Float) fun getProgress(): Float fun setProgress(progress: Int) fun setProgress(progress: Float) fun getSecondaryProgress(): Float fun setSecondaryProgress(secondaryProgress: Int) fun setSecondaryProgress(secondaryProgress: Float) // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float fun getIconSize(): Int fun setIconSize(size: Int) fun getIconPadding(): Int fun setIconPadding(padding: Int) fun getIconPaddingLeft(): Int fun setIconPaddingLeft(padding: Int) fun getIconPaddingTop(): Int fun setIconPaddingTop(padding: Int) fun getIconPaddingRight(): Int fun setIconPaddingRight(padding: Int) fun getIconPaddingBottom(): Int fun setIconPaddingBottom(padding: Int) // Animation fun enableAnimation() fun disableAnimation() fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) fun isProgressAnimating(): Boolean fun isSecondaryProgressAnimating(): Boolean // Reversing Progress fun isReverse(): Boolean fun setReverse(isReverse: Boolean) // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) fun getColorIconBackground(): Int fun setIconBackgroundColor(color: Int) // Icon fun getIconImageResource(): Int fun setIconImageResource(resId: Int) fun getIconImageBitmap(): Birmap fun setIconImageBitmap(bitmap: Bitmap) fun getIconImageDrawable(): Drawable fun setIconImageDrawable(drawable: Drawable) // Listener fun setOnProgressChangedListener(listener: OnProgressChangedListener) fun setOnIconClickListener(listener: OnIconClickListener) ``` TextRoundCornerProgressBar --- ### Example ```xml ``` ![Text Round Corner Progress Bar](/image/sample_text.jpg) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Progress fun getMax(): Float fun setMax(max: Float) fun getProgress(): Float fun setProgress(progress: Int) fun setProgress(progress: Float) fun getSecondaryProgress(): Float fun setSecondaryProgress(secondaryProgress: Int) fun setSecondaryProgress(secondaryProgress: Float) // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float fun getTextProgressSize(): Int fun setTextProgressSize(size: Int) fun getTextProgressMargin(): Int fun setTextProgressMargin(margin: Int) // Animation fun enableAnimation() fun disableAnimation() fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) fun isProgressAnimating(): Boolean fun isSecondaryProgressAnimating(): Boolean // Reversing Progress fun isReverse(): Boolean fun setReverse(isReverse: Boolean) // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) fun getTextProgressColor(): Int fun setTextProgressColor(color: Int) // Text fun getProgressText(): String fun setProgressText(text: String) // Position fun getTextPositionPriority(): Int fun setTextPositionPriority(priority: Int) fun getTextInsideGravity(): Int fun setTextInsideGravity(gravity: Int) fun getTextOutsideGravity(): Int fun setTextOutsideGravity(gravity: Int) // Listener fun setOnProgressChangedListener(listener: OnProgressChangedListener) ``` IndeterminateRoundCornerProgressBar --- ### Example ```xml ``` ![Indeterminate Round Corner Progress Bar](/image/sample_indeterminate.gif) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float // Animation fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) // Reversing Progress fun isReverse(): Boolean fun setReverse(isReverse: Boolean) // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) ``` IndeterminateCenteredRoundCornerProgressBar --- Same as IndeterminateRoundCornerProgressBar ### Example ```xml ``` ![Indeterminate Centered Round Corner Progress Bar](/image/sample_indeterminate_centered.gif) ### Layout XML ```xml ``` ### Public Methods ```kotlin // Dimension fun getRadius(): Int fun setRadius(radius: Int) fun getPadding(): Int fun setPadding(padding: Int) fun getLayoutWidth(): Float // Animation fun getAnimationSpeedScale(): Float fun setAnimationSpeedScale(scale: Float) // Reversing Progress fun isReverse(): Boolean fun setReverse(isReverse: Boolean) // Color fun getProgressBackgroundColor(): Int fun setProgressBackgroundColor(color: Int) fun getProgressColor(): Int fun setProgressColor(color: Int) fun getProgressColors(): IntArray fun setProgressColors(colors: IntArray) fun getSecondaryProgressColor(): Int fun setSecondaryProgressColor(color: Int) fun getSecondaryProgressColors(): IntArray fun setSecondaryProgressColors(colors: IntArray) ``` Apply Gradient Progress Bar Color --- Gradient color for progress bar must be in int array resource. At least 2 colors. ```xml #009688 #80CBC4 ``` ![Gradient Progress Bar Color](/image/sample_gradient.jpg) Progress bar does not clipped when size changed. So the gradient color will fully display without clipping also. Apply Progress Change Animation --- Animation when progress change is disabled by default (exclude `IndeterminateProgressBar` and `IndeterminateCenteredProgressBar`). So you have to enable the animation by XML attribute or programmatically ```xml ``` When progress changed, the animation will applied automatically. ![Comparison Between With/Without Animation](/image/animation_comparison.gif) Animation speed scale's value is float betweeen 0.2 - 5.0 (default is 1.0). Higher for slow down the animation, lower for speed up. Related Articles =========================== Thai Language : [Round Corner Progress Bar สำหรับคนบ้าขอบมน](http://www.akexorcist.com/2015/01/round-corner-progress-bar-library.html) Special Thanks =========================== @first087, @redsanso What's Next =========================== * IconTextRoundCornerProgressBar ([#69](https://github.com/akexorcist/Android-RoundCornerProgressBar/pull/69)) * Support color resource in color related attributes * Add set max progress with integer * Set outside/inside text color in `TextRoundCornerProgressBar` separately Known Issues === * Incorrect progress showing in `CenteredRoundCornerProgressBar` with 1%-2% value * Incorrect text's width in `TextRoundCornerProgressBar` when `outside` priority and value close to 100% * `setProgress(progress: Int)` does not update text position Licence =========================== Copyright 2020 Akexorcist Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.