The Wayback Machine - https://web.archive.org/web/20210116063805/https://github.com/TheHasnatBD/SweetToast
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

SweetToast

Screenshots of toasts

default info success warning
error custom (only text) custom (only icon) custom (full)

Setup

Step 1
Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
	...
	maven { url 'https://jitpack.io' }
	}
}

Step 2
Add the dependency

dependencies {
    ...
    implementation 'com.github.TheHasnatBD:SweetToast:1.0.2'
}

Usage

Android Default Toast

To display default short Toast-

SweetToast.defaultShort(context, "YOUR STRING");

To display default long Toast-

SweetToast.defaultLong(context, "YOUR STRING");

SweetToast Default Toast

(without duration parameter, every Default Toast's duration is Toast.LENGTH_SHORT)
To display a success Toast-

SweetToast.success(context, "YOUR STRING");
SweetToast.success(context, "YOUR STRING", duration);

To display an info Toast-

SweetToast.info(context, "YOUR STRING");
SweetToast.info(context, "YOUR STRING", duration);

To display a warning Toast-

SweetToast.warning(context, "YOUR STRING");
SweetToast.warning(context, "YOUR STRING", duration);

To display an error Toast-

SweetToast.error(context, "YOUR STRING");
SweetToast.error(context, "YOUR STRING", duration);

Custom Toast

( duration parameter is must be needed in custom method)
(textColor takes a int value.
textColor example- Color.WHITE or, getResources().getColor(R.color.colorWhite) or Color.parseColor("#FFFFFF"))


To display a partial-custom Toast-

// Only custom Icon >> in pre-defined backgroundColor and textColor : LightGRAY and BLACK
SweetToast.custom(context, "YOUR STRING", drawableIcon, duration);

To display a custom Text Toast without Icon-

SweetToast.custom(context, "YOUR STRING", textColor, backgroundDrawable, duration);

To display a FULLY custom Toast-

SweetToast.custom(context, "YOUR STRING", drawableIcon, textColor, backgroundDrawable, duration);

SweetToast Demo App


(If you find/face any problem, please open an issue or make a pull request)


You can’t perform that action at this time.