Toastest
This is a library for customizing toasts!
By using it, you can set background, text size, text color, font and icon to your toasts and using anim to display it.
Prerequisites
Add this in your root build.gradle
file (not your module build.gradle
file):
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Dependency
Add this to your module's build.gradle
file (make sure the version matches the JitPack badge above):
dependencies {
...
implementation 'com.github.ZahraHeydari:Toastest:1.0.2'
}
Usage
Each method always returns a Toast
object, so you can customize the Toast with below methods.
This displays a Toast with an icon.
Toastest.makeToast(context, "This is a toast with an icon.", iconDrawable,Toast.LENGTH_SHORT).show()
This displays a Toast with a new background.
Toastest.makeToast(context, background, "This a toast with a background.", Toast.LENGTH_SHORT).show()
This displays a Toast with a new font type.
Toastest.makeToast(context, "This a toast with a new font type.", TEXT_TYPEFACE, Toast.LENGTH_SHORT).show()
This displays a Toast with a new text size.
Toastest.makeToast(context, "This a toast with a new text size.", TEXT_SIZE, Toast.LENGTH_SHORT).show()
The makeGravity()
method makes a Toast with new Gravity:
makeGravity(toast,YOUR_GRAVITY)
The makeAnim()
method makes a toast by ObjectAnimator as below:
makeAnim(toast, propertyName, animDuration, animInterpolator, from, to)
And you can create your custom Toasts with the custom()
method:
Toastest.custom(context, "This is a fully customized toast.", iconDrawable, backgroundDrawable, TEXT_SIZE, TEXT_TYPEFACE, Toast.LENGTH_SHORT).show()
Author
- ZARA