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 |
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 (make sure the version matches the JitPack badge above):
dependencies {
...
implementation 'com.github.naseemali925:EasyToast:0.0.1'
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();
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 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();
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);
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 .
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.