SnackProgressBar
Enhanced Snackbar for Android.
Features
- Two types of ProgressBar (TYPE_HORIZONTAL and TYPE_CIRULAR) are available (see image below). It can also be used as a normal SnackBar.
- Supports multi-lines of message.
- Supports long action text by moving it to next line as per Material Design.
- Supports swipe to dimiss behaviour even without providing CoordinatorLayout. (Or you can remove this behaviour for CoordinatorLayout)
- Additional views can be added to animate with the SnackProgressBar.
- Provides OverlayLayout to prevent user input.
- Provides a queue system.
- Icon can be added.
- Supports bundle in SnackProgressBar to carry information.
- Supports changing element color and text size.
Getting Started
NOTE: v4.0 is a huge leap from v3.4 and offers much better flexibility. Please take note when migrating.
SnackProgressBarManager
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.
SnackProgressBar
Create a SnackProgressBar by calling the following examples.
Note that action
can be inserted in every type of SnackProgressBar.
Show
Show the SnackProgressBar by calling:
To enable callback for OnShown
and OnDismissed
, include a onDisplayId
when calling show()
.
Or you can add the SnackProgressBar into memory and call it later.
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.
Update
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:
Dismiss
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.
JavaDoc
For further information, see https://tingyik90.github.io/snackprogressbar/lib/.
Download
In the project Gradle:
In the app Gradle:
NOTE: The latest java version is v2.2 and may include unfixed bugs. Higher versions are in Kotlin. The DemoActivity is still in Java.