Skip to content

Latest commit

 

History

History
121 lines (88 loc) · 3.57 KB

README.md

File metadata and controls

121 lines (88 loc) · 3.57 KB

Tostcu

Tostcu makes Toasts to feed your app.

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.hamurcuabi:Tostcu:1.0.0'
}

Configuration

This step is optional, but if you want you can configure some Tostcu parameters. Place this anywhere in your app:

Toasty.Config.getInstance()
    .setErrorColor(@ColorInt int errorColor) // optional
    .setInfoColor(@ColorInt int infoColor) // optional
    .setSuccessColor(@ColorInt int successColor) // optional
    .setWarningColor(@ColorInt int warningColor) // optional
    .setToastTypeface(@NonNull Typeface typeface) // optional
    .setTextSize(int sizeInSp) // optional
    .setWithAnim(boolean with_anim)//optional
    .apply(); // required

You can reset the configuration by using reset() method:

Toasty.Config.reset();

Usage

This following basic methodes have default variables. You can change them we have some easy methodes.

```LENGTH_SHORT, 
```with_anim=true,
```text_size=16 sp, 
```typeface=(sans-serif-condensed", Typeface.NORMAL),
```Gravity.Center

To display basic error Toast:

Tostcu.error(yourContext, "This is an error toast.");

To display basic success Toast:

Tostcu.success(yourContext, "This is an success toast.");

To display basic info Toast:

Tostcu.info(yourContext, "This is an info toast.");

To display basic warning Toast:

Tostcu.warning(yourContext, "This is an warning toast.");

You can also create your custom Toasts with the custom() method:

Tostcu.custom(yourContext, "I'm a custom Toast", yourDrwableResid,duration, bg_color, gravity, with_anim,typeface,text_size);

Your messages can be CharSequence or StringRes

Tostcu.warning(yourContext, "This is an warning toast.");

or

Tostcu.warning(yourContext, R.string.warning_message);

Icon has a simple blink animation

This blink animation can be set false but it is true default.

Screenshots

Apps using Tostcu

Muziczak Free Mp3
  [![](https://jitpack.io/v/hamurcuabi/Tostcu.svg)](https://jitpack.io/#hamurcuabi/Tostcu)