RoundedProgressBar

Using the RoundedProgressBar library you have a wide range of customizable options for making progress bars that have rounded edges. Below I've made a gif highlighting just a few examples of different looking progress bars created with this library:

roundedProgressBarDemo

Gradle Setup ⚙️

If you don't have this already, add it to your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Then you can add the dependency to your app build.gradle file:

dependencies {
    ...
    implementation 'com.github.MackHartley:RoundedProgressBar:1.0'
}

Features ?

  1. Percentage complete text displayed on right hand side of progress bar
  2. Progress bar and progress text animation upon progress change
  3. The progress bar, background view, progress text and background text can all have different colors
  4. The progress bar doesn't look weird at lower values (a common issue with progress bar solutions)
  5. Progress bar can be set to any height and width

Additionally, the RoundedProgressBar handles all state on config changes including situations where there are multiple progress bars:

savesStateOnConfigChange

Public Methods and Xml Attributes ⌨️

These are the methods which can be called on the RoundedProgressBar class:

setProgressPercentage(progressPercentage: Double, shouldAnimate: Boolean = true)
getProgressPercentage(): Double

setProgressColor(colorRes: Int) // Sets the color of the 'progress' part of the progress bar
setProgressBgColor(colorRes: Int) // Sets the color of the progress bar background

setTextColor(colorRes: Int) // Sets text color for when it is drawn over the progress part of progress bar
setBgTextColor(colorRes: Int) // Sets text color for when it is drawn over the progress bar background
setTextSize(sizeInPixels: Float)
showProgressText(shouldShowProgressText: Boolean) // Hide or show the progress text

setAnimationLength(newAnimationLength: Long)

Each setter is accessible via xml as well. Here I've mapped each setter to its corresponding xml attribute:

Method Xml Attribute
setProgressPercentage(...) rpbProgress
setProgressColor(...) rpbProgressColor
setProgressBgColor(...) rpbProgressBgColor
setTextSize(...) rpbTextSize
setTextColor(...) rpbTextColor
setBgTextColor(...) rpbBgTextColor
showProgressText(...) rpbShowProgressText
setAnimationLength(...) rpbAnimationLength

GitHub