[Please don't use v1.2 or 1.2 they are deleted and not meant for production , they are actually not usable]
Step 1. Add the JitPack repository to your build file
gradle
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.sad-adnan:customToast:v1.3'
}
From version 1.1 you have default value of toast as Toast>LENGTH_SHORT so you can just give one parameter (2nd one) less, if you need short length.
CustomToast.ShowSuccessToast(MainActivity.this,"Congratulations"); // 2nd parameter DEFAULT value false --> Toast.LENGTH_SHORT
CustomToast.ShowSuccessToast(MainActivity.this,false,"Congratulations"); // 2nd parameter true --> Toast.LENGTH_LONG , false --> Toast.LENGTH_SHORT
CustomToast.ShowErrorToast(MainActivity.this,false,"We are extremely sorry."); // 2nd parameter true --> Toast.LENGTH_LONG , false --> Toast.LENGTH_SHORT
CustomToast.ShowInfoToast(MainActivity.this,false,"We have updated your status."); // 2nd parameter true --> Toast.LENGTH_LONG , false --> Toast.LENGTH_SHORT
you have to pass drawable resource id (R.drawable.yourdrawable) and color id (R.color.yourcolor) in 4th and 5th Parameter respectively
CustomToast.showToastWithCustomDrawableAndBG(MainActivity.this,false,"Custom Icon",R.drawable.ic_baseline_auto_delete_24,R.color.toastColor); // 2nd parameter true --> Toast.LENGTH_LONG , false --> Toast.LENGTH_SHORT
CustomToast.showToastWithoutIcon(MainActivity.this,false,"Without icon",R.color.toastColor2); // this method will only show text, without any drawable , 2nd parameter true --> Toast.LENGTH_LONG , false --> Toast.LENGTH_SHORT