Skip to content
Toastie is a customizable Android toast library.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app
art
gradle/wrapper
toastie
.gitignore
LICENSE
README.md ReadMe updated. Jun 1, 2019
build.gradle
gradle.properties
gradlew Create git May 18, 2019
gradlew.bat Create git May 18, 2019
settings.gradle Jitpack fixes. May 18, 2019

README.md

Toastie

Android Arsenal API

Getting Started

Gradle

Step 1. Add the JitPack repository to your build file

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

Note: Please check above for the latest version!

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

Step 2. Add the dependency

dependencies {
    implementation 'com.github.MrNtlu:Toastie:latest.version'
}

Maven

Step 1. Add the JitPack repository to your build file

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

Step 2. Add the dependency

<dependency>
  <groupId>com.github.MrNtlu</groupId>
  <artifactId>Toastie</artifactId>
  <version>latest.version</version>
</dependency>

Usage

Warning Toast:

Toastie.warning(MainActivity.this,"Warning Toast", Toast.LENGTH_LONG).show();
Toastie.centerWarning(MainActivity.this,"Warning Toast", Toast.LENGTH_LONG).show();
Toastie.topWarning(MainActivity.this,"Warning Toast", Toast.LENGTH_LONG).show();

Success Toast:

Toastie.success(MainActivity.this,"Success Toast",Toast.LENGTH_LONG).show();
Toastie.centerSuccess(MainActivity.this,"Success Toast",Toast.LENGTH_LONG).show();
Toastie.topSuccess(MainActivity.this,"Success Toast",Toast.LENGTH_LONG).show();

Info Toast:

Toastie.info(MainActivity.this,"Info Toast.",Toast.LENGTH_LONG).show();
Toastie.centerInfo(MainActivity.this,"Info Toast.",Toast.LENGTH_LONG).show();
Toastie.topInfo(MainActivity.this,"Info Toast.",Toast.LENGTH_LONG).show();

Error Toast:

Toastie.error(MainActivity.this,"Error Toast.",Toast.LENGTH_LONG).show();
Toastie.centerError(MainActivity.this,"Error Toast.",Toast.LENGTH_LONG).show();
Toastie.topError(MainActivity.this,"Error Toast.",Toast.LENGTH_LONG).show();

Custom Toast:

Toastie.custom(MainActivity.this,"Custom Toast.",R.drawable.icon,R.color.background,Toast.LENGTH_LONG).show();
Toastie.centerCustom(MainActivity.this,"Custom Toast.",R.drawable.icon,R.color.background,Toast.LENGTH_LONG).show();
Toastie.topCustom(MainActivity.this,"Custom Toast.",R.drawable.icon,R.color.background,Toast.LENGTH_LONG).show();

Fully customizable toast, you can set the attributes that you need.

Toastie.allCustom(MainActivity.this)
                        .setTypeFace(Typeface.DEFAULT_BOLD)
                        .setTextSize(16)
                        .setCardRadius(25)
                        .setCardElevation(10)
                        .setIcon(R.drawable.ic_error_black_24dp)
                        .setCardBackgroundColor(R.color.colorAccent)
                        .setMessage("Fully customizable toast. But in a different way.")
                        .setGravity(Gravity.CENTER,5,5)
                        .createToast(Toast.LENGTH_LONG)
                        .show();

Same as previous one but different way calling it.

Toastie.allCustom(MainActivity.this,"Fully custom toast. Ugly as ... :)",R.drawable.ic_info_black_36dp,
                        R.color.infoColor,cornerRadius,elevation,textSize,Typeface.SANS_SERIF,Gravity.TOP, xOffset,yOffset,Toast.LENGTH_LONG).show();

Screenshots

You can’t perform that action at this time.