Enhanced Snackbar for Android.


  1. Two types of ProgressBar (TYPE_HORIZONTAL and TYPE_CIRULAR) are available (see image below). It can also be used as a normal SnackBar.
  2. Supports multi-lines of message.
  3. Supports long action text by moving it to next line as per Material Design.
  4. Supports swipe to dimiss behaviour even without providing CoordinatorLayout. (Or you can remove this behaviour for CoordinatorLayout)
  5. Additional views can be added to animate with the SnackProgressBar.
  6. Provides OverlayLayout to prevent user input.
  7. Provides a queue system.
  8. Icon can be added.
  9. Supports bundle in SnackProgressBar to carry information.
  10. Supports changing element color and text size.

Image of SnackProgressBar

Getting Started

NOTE: v4.0 is a huge leap from v3.4 and offers much better flexibility. Please take note when migrating.


Start by creating an instance of SnackProgressBarManager in your activity.
If possible, the root view of the activity should be provided and can be any type of layout.

private SnackProgressBarManager snackProgressBarManager;

protected void onCreate(Bundle savedInstanceState) {
    // always have one instance of SnackProgressBarManager only in the activity
    snackProgressBarManager = new SnackProgressBarManager(view)
            // (optional) set the view which will animate with SnackProgressBar e.g. FAB when CoordinatorLayout is not used
            // (optional) change progressBar color, default = R.color.colorAccent
            // (optional) change background color, default = BACKGROUND_COLOR_DEFAULT (#FF323232)
            // (optional) change text size, default = 14sp
            // (optional) set max lines, default = 2
            // (optional) register onDisplayListener
            .setOnDisplayListener(new SnackProgressBarManager.OnDisplayListener() {
                public void onShown(SnackProgressBar snackProgressBar, int onDisplayId) {
                    // do something

                public void onDismissed(SnackProgressBar snackProgressBar, int onDisplayId) {
                    // do something


Create a SnackProgressBar by calling the following examples.

SnackProgressBar normalType = new SnackProgressBar(
        SnackProgressBar.TYPE_NORMAL, "TYPE_NORMAL - " + queue)
        // (optional) allow user input, default = FALSE
        // (optional) allow user swipe to dismiss, default = FALSE
        // (optional) set icon
// create a bundle and attach to snackProgressBar which can be retrieved via OnDisplayListener
Bundle bundle = new Bundle();
bundle.putInt("queue", queue);

// TYPE_NORMAL with action
SnackProgressBar normalTypeWithAction = new SnackProgressBar(
        SnackProgressBar.TYPE_NORMAL, "TYPE_NORMAL - If the action text is too long, a higher layout is used.")
        // set action button
        .setAction("DISMISS", new SnackProgressBar.OnActionClickListener() {
            public void onActionClick() {
                // do something

SnackProgressBar horizontalType = new SnackProgressBar(
        SnackProgressBar.TYPE_HORIZONTAL, "TYPE_HORIZONTAL - Loading...")
        // (optional) set the type of progressBar, default = FALSE
        // (optional) set max progress, default = 100
        // (optional) show percentage, default = FALSE

// TYPE_CIRCULAR with action
SnackProgressBar circularTypeWithAction = new SnackProgressBar(
        SnackProgressBar.TYPE_CIRCULAR, "TYPE_CIRCULAR - Loading...")
        .setAction("DISMISS", new SnackProgressBar.OnActionClickListener() {
            public void onActionClick() {
                // do something

Note that action can be inserted in every type of SnackProgressBar.


Show the SnackProgressBar by calling:

// LENGTH_SHORT, LENGTH_LONG, LENGTH_INDEFINITE or other positive millis can be used, SnackProgressBarManager.LENGTH_LONG);  

To enable callback for OnShown and OnDismissed, include a onDisplayId when calling show().

int onDisplayId = 100;, SnackProgressBarManager.LENGTH_LONG, onDisplayId);

Or you can add the SnackProgressBar into memory and call it later.

// it is stored in HashMap, so storeId must be unique for each SnackProgressBar, else it will be overwritten
int storeId = 100;
snackProgressBarManager.put(snackProgressBar, storeId);, SnackProgressBarManager.LENGTH_LONG);

Calling show() will put the SnackProgressBar into a queue, which will be shown after those in queue before it has been dismissed
(by user action or set showDuration).

Note: If LENGTH_INDEFINITE is specified for the queued SnackProgressBar, adding a new SnackProgressBar into the queue will cause
the previous SnackProgressBar to use LENGTH_SHORT instead, dismissed and then show the new SnackProgressBar.


Calling show() will always animate the hiding and showing of SnackProgressBar between queue. Use updateTo() instead to modify the
displayed SnackProgressBar without animation. To modify the currently showing SnackProgressBar:

// get the currently showing indeterminateType and change the message
SnackProgressBar snackProgressBar = snackProgressBarManager.getLastShown();
snackProgressBar.setMessage("new message");
// calling updateTo() will not hide and show again the SnackProgressBar


Call snackProgressBarManager.dismiss() to dismiss the currently showing SnackProgressBar. The next SnackProgressBar in queue will be shown.
Call snackProgressBarManager.dismissAll() to dismiss the currently showing SnackProgressBar and clear all other SnackProgressBars in queue.

Set Progress

Call snackProgressBarManager.setProgress() to set the progress of ProgressBar.


For further information, see

See demo at


In the project Gradle:

allprojects {
    repositories {
        maven { url "" }

In the app Gradle:

dependencies {
    implementation 'com.github.tingyik90:snackprogressbar:version'

NOTE: The latest java version is v2.2 and may include unfixed bugs. Higher versions are in Kotlin. The DemoActivity is still in Java.