Skip to content

An Android library that takes the standard Android Toast to the next level with built-in icons from font-awesome and many styling options that gives your app and user experience an extra awesome feeling!

License

Notifications You must be signed in to change notification settings

inaseem/EasyToast

Repository files navigation

EasyToast

platform API

An Android library that takes the standard Android Toast to the next level with built-in icons from font-awesome and many styling options that gives your app and user experience an extra awesome feeling!


Success Toast
Info Toast
Error Toast
Warning Toast
Default Toast
Confusing Toast

Prerequisites

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

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	implementation 'com.github.naseemali925:EasyToast:0.0.1'

Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD!

To display the default Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.DEFAULT);

To display a success Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.SUCCESS);

To display an info Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.INFO);

To display a warning Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.WARNING);

To display the error Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.ERROR);

To display the confusing Toast:

EasyToast.makeText(this,"Hello World !",EasyToast.LENGTH_LONG,EasyToast.CONFUSING);

You can also remove the android icon on top-right corner by passing last parameter false.

EasyToast.makeText(this, "I'm an EasyToast", EasyToast.LENGTH_LONG, EasyToast.INFO, false).show();

With The Builder Pattern

	EasyToast easyToast=new ToastBuilder(this)
                .textSize(16)
                .textColor(Color.WHITE)
		.type(EasyToast.SUCCESS)
                .showTopIcon(true)
                .leftIcon(FA.FA_CHECK)
                .typeface(someTypeface)
                .topIcon(FA.FA_ANGELLIST)
                .text("That's An Easy Toast")
                .build();
        easyToast.show();

Use Icons From Font Awesome

Use The FA Class To Access And Use The Icon

  FA.FA_CHECK
  FA.FA_BELL
  .
  .
  .
  //Choose Any From 900+ Icons
  
  //Or Use A Drawable
  EasyToast easyToast=new ToastBuilder(this)
                .textColor(Color.WHITE)
		.type(EasyToast.SUCCESS)
                .leftIcon(R.drawable.some_drawable)
                .topIcon(R.drawable.some_drawable)
                .text("That's An Easy Toast")
                .build();
        easyToast.show();

Use Font Awesome With Other Views

  FA.with(context).initialize();
  LinearLayout vGroup=(LinearLayout)findViewById(...);
  FA.addTo(vGroup);// It Will Add Font Awesome To All ChildViews That Supports Text(TextView,EditText,Button)
  FA.addTo(SomeTextView);// Adds Font Awesome To This TextView
  FA.addTo(SomeButton);// Adds Font Awesome To This Button
  FA.addTo(SomeEditText);// Adds Font Awesome To This EditText
  //Wanna Use Font-Awesome Icons Along Text
  someTextViewWithFA.setText("This Is A BUS "+FA.FA_BUS);

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact - Let's become friend

License

MIT License

Copyright (c) 2018 Naseem Ali

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the license conditions.

About

An Android library that takes the standard Android Toast to the next level with built-in icons from font-awesome and many styling options that gives your app and user experience an extra awesome feeling!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages