Progress Bar Android

The library has two available progress bar classes ProgressBar and ProgressBarAntiAlias. The anti-alias one uses PorterDuff mode with multiple bitmap, for smooth clipping, the result is better but it tend to be slower. For creating custom progress bar check out the official wiki page.

Add to your project

Add the jitpack maven repository

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

Add the dependency

dependencies {
  implementation 'com.github.slaviboy:ProgressBar:v0.1.0'
}

How to use

To create a ProgressBar just include the code below in your main activity layout file.

<com.slaviboy.progressbar.ProgressBar
     android:id="@+id/progress_bar"
     android:layout_width="200dp"
     android:layout_height="wrap_content"
     android:adjustViewBounds="true"
     android:scaleType="centerCrop"
     android:layout_marginBottom="10dp"
     app:corner_radius="100dp"
     android:padding="2dp"
     app:layout_constraintLeft_toLeftOf="parent"
     app:layout_constraintTop_toTopOf="parent"
     app:percentage="50"
     app:start_animation="true"
     app:srcCompat="@drawable/green_progress_bar" />

To change the loading percentage in real time, use the percentage property.

// set loading percentage to 75
val progressBar : ProgressBar = findViewById(R.id.progress_bar)
progressBar.percentage = 75.0f

GitHub