Android Toastify
Show Android Toast in Singeton design pattern with queue.
Features
- If multiple same toast are generated simultaneously, all toasts will be merged into one. Currently all the toasts shows one after another, creating bad UX.
- If multiple different toasts are generated, it will be displaced in a queue on after another.
Step 1
Gradle
Add to root project gradle
allprojects {
repositories {
maven {
url "https://jitpack.io"
}
}
}
Add dependency to app gradle
implementation 'com.github.collegeduniadevelopers:Toastify:Tag'
Step 2
Show Toast
ToastGenerate.getInstance(context)
.createToastMessage(ToastModel(type: ToastType,title: String, message: String?, leftImg: Drawable?, length: ToastLength? = ToastLength.SHORT))
ToastType:
- ToastType.SUCCESS
- ToastType.NORMAL
- ToastType.ERROR
- ToastType.WARNING
ToastLength:
- ToastLength.SHORT
- ToastLength.LONG
That’s pretty much it. Thanks