Skip to content

aokilipa/Toaster

 
 

Repository files navigation

Toaster

API

A lightweight library for implementing custom android Toasts. Unlike the stock toasts, these ones appear at the top of your app, overlaying your actionbar/toolbar. This library is also stocked with a couple of customization options.

Setup

Add this in your root build.gradle file.

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

Add this to your module's build.gradle file

dependencies {
	...
	compile 'com.github.noelomo:Toaster:1.0.0'
}

Usage

This library is used in an almost similar manner as the stock Toast widget:

Stock without any icon

Toaster.makeText(getApplicationContext(), "This is the DEFAULT toast", Toaster.LENGTH_SHORT, Toaster.DEFAULT).show();

####Result:

Info Toast

Toaster.makeText(getApplicationContext(), "This is an INFO toast", Toaster.LENGTH_SHORT, Toaster.INFO).show();

####Result:

Success Toast

Toaster.makeText(getApplicationContext(), "This is a SUCCESS toast", Toaster.LENGTH_SHORT, Toaster.SUCCESS).show();

####Result:

Warning Toast

Toaster.makeText(getApplicationContext(), "This is a WARNING toast", Toaster.LENGTH_SHORT, Toaster.WARNING).show();

####Result:

Error Toast

Toaster.makeText(getApplicationContext(), "This is an ERROR toast", Toaster.LENGTH_SHORT, Toaster.ERROR).show();

####Result:

Custom Toast

Toaster.makeText(getApplicationContext(), "This is a CUSTOM toast", Toaster.LENGTH_SHORT, Toaster.CUSTOM, R.drawable.ic_check_circle_white_24px, R.color.default_color).show();

####Result:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%