FabToast

Additional

Language
Java
Version
1.0 (Dec 20, 2017)
Created
Dec 20, 2017
Updated
Dec 23, 2017
Owner
Dean Spencer (Binary-Finery)
Contributor
Dean Spencer (Binary-Finery)
1
Activity
Badge
Generate
Download
Source code

Advertising

FabToast

  • min SDK 16 (Jelly Bean 4.1)
  • written in Java

To download the demo app for this library from Google Playstore so you can see it in action, click here

Installation

Add this into your root build.gradle file:

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

Add the dependency to your module build.gradle:

dependencies {
         compile 'com.github.Binary-Finery:FabToast:1.0'
 }

Usage

FabToast has 4 different types:

  • SUCCESS
  • INFORMATION
  • ERROR
  • WARNING

And can be displayed in 3 different positions on-screen:

  • DEFAULT (bottom)
  • CENTER
  • TOP

To display a FabToast is extremely simple, and achieved in a single line of code. For example, to display a SUCCESS FabToast at the default position (bottom):

FabToast.makeText(context, "I'm a Fab toast", FabToast.LENGTH_LONG, FabToast.SUCCESS,  FabToast.POSITION_DEFAULT).show();

to display a WARNING FabToast in the center of the screen:

FabToast.makeText(context, "I'm a Fab toast", FabToast.LENGTH_LONG, FabToast.WARNING,  FabToast.POSITION_CENTER).show();

to display an ERROR FabToast at the top of the screen:

FabToast.makeText(context, "I'm a Fab toast", FabToast.LENGTH_LONG, FabToast.ERROR,  FabToast.POSITION_TOP).show();

to display an INFORMATION FabToast at the default position:

FabToast.makeText(context, "I'm a Fab toast", FabToast.LENGTH_LONG, FabToast.INFORMATION,  FabToast.POSITION_DEFAULT).show();