🎈 A customizable, Changeable color, Changeable position, dismissable Toast
Step 1. Add the JitPack repository to your build file
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Step 2.Add the dependency below to your module's build.gradle
file:
dependencies {
implementation 'com.github.koohyar7342:MyToast:1.0.1'
}
MyToast.show(
context = this,
message = "the toast message",
type = MyToast.DialogType.ERROR, // DEFAULT, INFO, ERROR, COPY, SUCCESS
delayMillis = 2500, // Toast duration in Millisecond
position = MyToast.DialogPosition.CENTER, // CENTER, BOTTOM, TOP
lifecycle= lifecycle // for dismissing toast when lifecycleOwner finished
)
Declare these colors in your app colors.xml to override MyToast default colors:
<color name="mt_copy_background_color">###</color>
<color name="mt_success_background_color" >###</color>
<color name="mt_info_background_color" >###</color>
<color name="mt_error_background_color">###</color>
<color name="mt_default_background_color">###</color>
<color name="mt_text_color" >###</color>
<color name="mt_icon_tint" >###</color>
Support me here https://koohyar7342.github.io
Also, follow me on GitHub for my next creations!