Just another custom Android Toast π but We have Butter and Jam π
1 Add it in your root build.gradle at the end of repositories
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
2 Add the dependency
dependencies {
compile 'com.github.IsPra94:EasyToast:1.0.0'
}
1 Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
2 Add the dependency
<dependency>
<groupId>com.github.IsPra94</groupId>
<artifactId>EasyToast</artifactId>
<version>1.0.0</version>
</dependency>
EasyToast.success(MainActivity.this, "Success!!!"); //Default duration : Toast.LENGTH_SHORT
EasyToast.success(MainActivity.this, "Success!!!", Toast.LENGTH_LONG);
EasyToast.success(MainActivity.this, "Success!!!", R.drawable.custom_icon, Toast.LENGTH_LONG);
EasyToast.error(MainActivity.this, "Error!!!"); //Default duration : Toast.LENGTH_SHORT
EasyToast.error(MainActivity.this, "Error!!!", Toast.LENGTH_LONG);
EasyToast.error(MainActivity.this, "Error!!!", R.drawable.custom_icon, Toast.LENGTH_LONG);
EasyToast.info(MainActivity.this, "Info!!!"); //Default duration : Toast.LENGTH_SHORT
EasyToast.info(MainActivity.this, "Info!!!", Toast.LENGTH_LONG);
EasyToast.info(MainActivity.this, "Info!!!", R.drawable.custom_icon, Toast.LENGTH_LONG);
EasyToast.warning(MainActivity.this, "Warning!!!"); //Default duration : Toast.LENGTH_SHORT
EasyToast.warning(MainActivity.this, "Warning!!!", Toast.LENGTH_LONG);
EasyToast.warning(MainActivity.this, "Warning!!!", R.drawable.custom_icon, Toast.LENGTH_LONG);
EasyToast.custom(MainActivity.this, "Custom w/o icon"); //Default duration : Toast.LENGTH_SHORT
EasyToast.custom(MainActivity.this, "Custom w/o icon", Toast.LENGTH_LONG);
EasyToast.custom(MainActivity.this, "Custom w/ icon", R.drawable.custom_icon, Toast.LENGTH_LONG);
EasyToast.custom(MainActivity.this, "Custom colors w/o icon", getResources().getColor(R.color.background), getResources().getColor(R.color.text_color), Toast.LENGTH_LONG);
EasyToast.custom(MainActivity.this, "Custom colors w/ icon", R.drawable.custom_icon, getResources().getColor(R.color.background), getResources().getColor(R.color.text_color), Toast.LENGTH_LONG);