markdowns

Tostada

License

This is a library that works both with kotlin and java.

Toast for everyone, you want jelly you got it, you want peanut butter, you got it.

Before you start

Add to your build.gradle project

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

Dependencies

Add to your build.gradle module

dependencies {
	...
	implementation 'com.github.joaogarrido98:tostada:1.2.0'
}

Usage

This is a step by step of how to use it.

Time can be either

Tostas.fast

or

Tostas.slow

Kotlin

Display an information Toast:

Tostas.info(this, "This is an information", Tostas.slow)

Display an error Toast:

Tostas.error(this, "This is an error", Tostas.slow)

Display a success Toast:

Tostas.success(this, "This is a success", Tostas.slow)

Display a warn Toast:

Tostas.warn(this, "This is a warning", Tostas.slow)

Display a neutral Toast:

Tostas.neutral(this, "This is a neutral", Tostas.slow)

Display a custom Toast:

val d = AppCompatResources.getDrawable(this, R.drawable.pink_stuff)
Tostas.custom(this, "Custom Toast", Tostas.slow, d!!, "#FF69B4")

Java

Display an information Toast:

Tostas.info(Activity.this, "This is an information", Tostas.fast);

Display an error Toast:

Tostas.error(Activity.this, "This is an error", Tostas.fast);

Display a success Toast:

Tostas.success(Activity.this, "This is a success", Tostas.fast);

Display a warn Toast:

Tostas.warn(Activity.this, "This is a warning", Tostas.fast);

Display a neutral Toast:

Tostas.neutral(Activity.this, "This is a neutral", Tostas.fast);

Display a custom Toast:

Drawable d = AppCompatResources.getDrawable(getActivity(), R.drawable.pink_stuff)
Tostas.custom(Activity.this, "Custom Toast", Tostas.fast, d, "#FF69B4");