Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Latest commit

 

History

History
116 lines (97 loc) · 3.17 KB

README.md

File metadata and controls

116 lines (97 loc) · 3.17 KB

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)