Skip to content

Latest commit

 

History

History
192 lines (134 loc) · 5.92 KB

README.md

File metadata and controls

192 lines (134 loc) · 5.92 KB

TastyToasty

API
An easy-to-use library to create tasty 😋 Toasts with a bunch of flavours 🌈 It also provides effortless methods to create Instagram like Toasts 💓

Article

Installation

Add this in your root build.gradle file (not your module build.gradle file):

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

Add this to your module's build.gradle file :

dependencies {
	...
    implementation 'com.github.usman18:TastyToasty:v1.2'
}

Usage

Instagram Toasts

  1. Instagram Like

TastyToasty.instaLike(MainActivity.this, "1").show();


Similarly 2. instaFollower and 3. instaComment can be used



  1. Instagram All

TastyToasty.instaAll(MainActivity.this, "101","20","60").show();


VIBGYOR Toasts 🌈

  1. VIOLET

TastyToasty.violet(MainActivity.this, "Its lit", R.drawable.ic_whatshot).show();

Similarly the rest of VIBGYOR can be used


You can pass null for those arguments which you don't want in your Toast (eg Toast w/o icon or w/o Text). We've handled it for you 🤗


Standard Toasts

  1. Success

TastyToasty.success(MainActivity.this, "Task Successful").show();

Similarly the rest of standard (error, trending, star) can be used



Custom Toasts

1. using makeText()



// Pass the last attribute as false or null if your do not want the tail in Toast
TastyToasty.makeText(MainActivity.this, "This is a custom toast",TastyToasty.LONG, R.drawable.ic_action_favourite, R.color.violet, R.color.white, true).show();

2. Builder Method (More easier to use)


new TastyToasty.Builder(MainActivity.this)
  .setText("This one is using builder method")    
  .setBackgroundColor(R.color.green)      
  .setIconId(R.drawable.ic_verified_user)
  .showTail(true) // Pass false or null or don't call at all if you don't want the "tail" in your toast
  .show();

Note:

Using builder method you can create customized Toasts pretty easily. Only call the methods for attributes which you would like to have in your Toast. For example, if you want a Toast with just icon, just call that method (make sure you always pass the context though) and ignore the rest of the attribute setting methods. Below is an example of the same.



//Default text color is white and default background color is pinkinsh red
new TastyToasty.Builder(MainActivity.this)
    .setIconId(R.drawable.ic_whatshot)
    .show();


Like my work ? You can tip me here

Contributions

Contributions are always welcome. Please fork this repository and contribute using pull requests. The pull requests will be thoroughly assessed and if found significant will be accepted.

Lets become friends

My email : uk32971@gmail.com