Skip to content

mhadikz/Toaster

Repository files navigation


Toaster
Toaster

You can generate a toast message easily and fast by Toaster.

Toaster statuses

Toaster has four styles for different statuses that include information, success, warning, and error.

Toaster-Information Toaster-Success
Toaster-Warning Toaster-Error

Dependency

Add this line to your build.gradle file:

dependencies {
	    implementation 'com.github.mhadikz:toaster:1.0.0'
}

How To Use

Toaster needs some parameters for generating your toast and call show(). You have to create a builder for showing Toaster message:

new Toaster.Builder(<Context>)
                    .setTitle(<Title text>)
                    .setDescription(<Description text>)
                    .setDuration(<Duration time by selecting from Toaster>)
                    .setStatus(<Toast status by selecting from Toaster.Status>)
                    .show();

Example

new Toaster.Builder(this)
                    .setTitle(getString(R.string.info_title))
                    .setDescription(getString(R.string.info_description))
                    .setDuration(Toaster.LENGTH_SHORT)
                    .setStatus(Toaster.Status.INFO)
                    .show();