:barber: [Android Library] Stacked dual progress indicator progress-bar
Stacked Horizontal ProgressBar is available in the MavenCentral, so getting it as simple as adding it as a dependency inside your build.gradle file
implementation "com.github.nisrulz:stackedhorizontalprogressbar:$version"
where $version
corresponds to latest version published in
Put the StackedHorizontalProgressBar element in your layout
<com.github.nisrulz.stackedhorizontalprogressbar.StackedHorizontalProgressBar
android:id="@+id/stackedhorizontalprogressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="?android:attr/progressBarStyleHorizontal"
android:progressDrawable="@drawable/stacked_horizontal_progress"/>
Reference in code as below
val primary_pts = 3
val secondary_pts = 6
val max = 10
val stackedHorizontalProgressBar = findViewById<StackedHorizontalProgressBar>(R.id.stackedhorizontalprogressbar)
stackedHorizontalProgressBar.let {
it.max = max
it.progress = primary_pts
it.secondaryProgress = secondary_pts
}
If you wish to edit the colors, just edit the colors.xml
file under the res
> values
folder and add the below colors (modify the values as per your requirement)
<!-- Stacked Horizontal Progressbar Colors -->
<color name="shpbr_primary_progress">#3F51B5</color>
<color name="shpbr_secondary_progress">#FF4081</color>